-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
world_size = 2 will raise error "array split does not result in an equal division" #374
Comments
Thank you for the report. if not share_embedding_table:
vocab_size = embed_w.shape[0]
lm_head_weight = embed_w.copy()
if vocab_size % tensor_parallel != 0:
# padding
vocab_size_padded = tensorrt_llm_bloom.lm_head.out_features * tensor_parallel
pad_width = vocab_size_padded - vocab_size
lm_head_weight = np.pad(lm_head_weight, ((pad_width, 0), (0, 0)),
'constant',
constant_values=0)
tensorrt_llm_bloom.lm_head.weight.value = split_matrix_tp(
lm_head_weight, tensor_parallel, rank, dim=0) We will fix it soon. |
@byshiue /TensorRT-LLM/examples/llama/weight.py:237 in load_from_hf_llama │ How to fix it? |
Can you share the config.json of your model? By defualt, the vocab_size of llama-13b is 32000, it should be divided by 2. |
in my model, the vocab_size is 151851 |
You can refer the above idea to add pad into the lm_head. |
solved |
Model : YeungNLP/bloomz-2b6-zh
Exec COMMAND:
python build.py --model_dir bloomz-2b6
--dtype float16
--use_gemm_plugin float16
--use_gpt_attention_plugin float16
--output_dir ./bloom_trt/trt_engines/fp16/2-gpu/
--world_size 2
ERROR log:
[TRT-LLM] [I] Loading weights from HF BLOOM...
Traceback (most recent call last):
File "/app/tensorrt_llm/examples/bloom/build.py", line 515, in
build(0, args)
File "/app/tensorrt_llm/examples/bloom/build.py", line 485, in build
engine = build_rank_engine(builder, builder_config, engine_name,
File "/app/tensorrt_llm/examples/bloom/build.py", line 364, in build_rank_engine
load_from_hf_bloom(tensorrt_llm_bloom,
File "/app/tensorrt_llm/examples/bloom/weight.py", line 200, in load_from_hf_bloom
tensorrt_llm_bloom.lm_head.weight.value = split_matrix_tp(
File "/app/tensorrt_llm/examples/bloom/weight.py", line 90, in split_matrix_tp
return np.ascontiguousarray(split(v, tensor_parallel, rank, dim=dim))
File "/app/tensorrt_llm/examples/bloom/weight.py", line 34, in split
return np.ascontiguousarray(np.split(v, tp_size, axis=dim)[idx])
File "<array_function internals>", line 180, in split
File "/usr/local/lib/python3.10/dist-packages/numpy/lib/shape_base.py", line 872, in split
raise ValueError(
ValueError: array split does not result in an equal division
The text was updated successfully, but these errors were encountered: