TensorRT-LLM icon indicating copy to clipboard operation
TensorRT-LLM copied to clipboard

build for mixtral 8x7b failed

Open terryaic opened this issue 2 years ago • 9 comments

reported this issue: [12/29/2023-02:37:01] [TRT] [E] 4: Internal error: plugin node LLaMAForCausalLM/layers/0/mlp/PLUGIN_V2_MixtureOfExperts_0 requires 3990561489024 bytes of scratch space, but only 25393692672 is available.

trt-llm version: 0.7.1

terryaic avatar Dec 29 '23 02:12 terryaic

Please share your scripts to build engine.

byshiue avatar Dec 31 '23 12:12 byshiue

I had double checked the procedure, and found out that the error only happend on the main branch, not the tag of v0.7.1 which should be the same with the main stream but actually not the same at all. the submission of #754 is not on the v0.7.1. https://github.com/NVIDIA/TensorRT-LLM/pull/754, I have check the example/run.py file, and found out that the modificaion of #754 is not applied to v0.7.1. WHY? the build script is as following.

python llama/build.py --model_dir /workspace/lib/models/Mixtral-8x7B-v0.1
--use_inflight_batching
--enable_context_fmha
--use_gemm_plugin
--world_size 4
--tp_size 4
--use_weight_only
--parallel_build
--output_dir /workspace/lib/models/trt_engines/mixtral/tp4-weight-only-071

terryaic avatar Jan 01 '24 09:01 terryaic

We update main branch more frequently to support new features and fix bugs in real time. The v0.7.1 is a stable branch, which passes more QA and tests.

byshiue avatar Jan 03 '24 01:01 byshiue

I had the same issue in 0.7.1 release when I tried to build engine for 2 & 8 H100 GPUs. Instead of Mixtral-8x7B-v0.1, I tried Mixtral-8x7B-Instruct-v0.1. I expected the flow should be the same as it is just fine-tuning version.

Command: python examples/llama/build.py --model_dir Mixtral-8x7B-Instruct-v0.1 --dtype float16 --remove_input_padding --use_gpt_attention_plugin float16 --enable_context_fmha --use_gemm_plugin float16 --max_batch_size 32 --output_dir ./examples/mixtral/out/8x7b_instruct_v0.1/fp16_2gpu/ --world_size=2 --tp_size=2 --parallel_build

Error info:

[01/05/2024-19:10:08] [TRT] [E] 4: Internal error: plugin node LLaMAForCausalLM/layers/0/mlp/PLUGIN_V2_MixtureOfExperts_0 requires 27489938178176 bytes of scratch space, but only 84942979072 is available. Try increasing the workspace size with IBuilderConfig::setMemoryPoolLimit().

[01/05/2024-19:10:08] [TRT] [E] 4: [pluginV2Builder.cpp::makeRunner::519] Error Code 4: Internal Error (Internal error: plugin node LLaMAForCausalLM/layers/0/mlp/PLUGIN_V2_MixtureOfExperts_0 requires 27489938178176 bytes of scratch space, but only 84942979072 is available. Try increasing the workspace size with IBuilderConfig::setMemoryPoolLimit().
)
[01/05/2024-19:10:08] [TRT-LLM] [E] Engine building failed, please check the error log.
[01/05/2024-19:10:08] [TRT-LLM] [I] Config saved to ./examples/mixtral/out/8x7b_instruct_v0.1/fp16_2gpu/config.json.
Traceback (most recent call last):

It seems the model is still looking for space in the GPUs for full-precision loading even I assign it as float16.

taozhang9527 avatar Jan 05 '24 19:01 taozhang9527

The same question on main branch, can anyone have a look?

littletomatodonkey avatar Jan 10 '24 09:01 littletomatodonkey

Could you check if you can repro the error without --remove_input_padding?

Normally, latest update has a fix in the plugin.

mickaelseznec avatar Jan 10 '24 13:01 mickaelseznec

Could you check if you can repro the error without --remove_input_padding?

Normally, latest update has a fix in the plugin.

@mickaelseznec That works fine for me, thanks! I will also try the latest code tomorrow.

littletomatodonkey avatar Jan 10 '24 13:01 littletomatodonkey

By removing the --remove_input_padding option, it successfully built the engine.

I remember the --remove_input_padding option is required for in-flight batching. Does it mean this model do not support in-flight batching mode? Why do we have to remove this option in order to make it work?

taozhang9527 avatar Jan 10 '24 21:01 taozhang9527

By removing the --remove_input_padding option, it successfully built the engine.

I was asking that just to make sure that we're all talking about the same bug. It should have been fixed in latest updates. If you still encounter the problem, please reopen this issue :)

mickaelseznec avatar Jan 17 '24 09:01 mickaelseznec