Repository navigation
Support InternLM models - #266
wangruohui wants to merge 27 commits into
Conversation
add internlm in quant support table
|
|
||
| ## Support Matrix | ||
| * FP16 / BF16 | ||
| <!-- * FP8 --> |
There was a problem hiding this comment.
Please delete all comment lines in support Matrix.
| --engine_dir ./internlm-chat-20b/trt_engines/smoothquant/1-gpu | ||
| ``` | ||
|
|
||
| #### FP8 Post-Training Quantization |
There was a problem hiding this comment.
No need to mention FP8 at current stage.
| --tp_size 2 | ||
| ``` | ||
| --> | ||
| #### Groupwise quantization (AWQ/GPTQ) |
|
|
||
| ```bash | ||
| python3 hf_llama_convert.py -i /llama-models/llama-7b-hf -o /llama/smooth_llama_7B/int8_kv_cache/ --calibrate-kv-cache -t fp16 | ||
| python3 hf_llama_convert.py -i llama-7b-hf -o smooth_llama_7B/int8_kv_cache/ --calibrate-kv-cache -t fp16 |
There was a problem hiding this comment.
why we need to update llama doc?
There was a problem hiding this comment.
a mistake during commit, recovered.
| | OPT | Y | Y | Y | . | . | . | . | . | . | | ||
| | SantaCoder | Y | Y | Y | . | . | . | . | . | . | | ||
| | StarCoder | Y | Y | Y | . | . | . | . | . | . | | ||
| | InternLM | Y | Y | Y | ? | Y | Y | Y | ? | ? | |
|
Hi @wangruohui , we're going to publish lots of update to main branch this week. Of coz, we'll add your name into the co-author list and credit your work on the release notes for internllm model. Is that ok for you? |
Hi @nv-guomingz , It's OK for me. Please move on. |
|
Hi @wangruohui , we just pushed an update to the main branch, and we added you as co-author, which is also mentioned in the announcement. I'm going to close this PR, please let us know if you have any questions. Thanks again for the great contribution. |
|
Hi, guys. Sorry to trouble you. I want to support InternLM2 models such as internlm2-chat-7b into your amazing project. Could you guys give me some tips on how to do it more neatly? Here are some things that should be considered:
I've tried to modify examples/llama/convert_checkpoint.py and it could build and run on fp16. But how could it be done more neatly? Should I create a new Looking forward to your kind reply. |
|
Hi @RunningLeon, Thanks for your contributing on TensorRT-LLM. It's ok for me to create the unique or dedicated internlm2 folder at current stage but we can't guarantee that it won't not be removed (merged into internlm) later. We're actively working on new builder workflow and relateive api refactoring, the convert_checkpoint.py will be a thin wrapper in the next formal release. Thanks, |
|
Hi, @RunningLeon I'm troubled by internlm2 to tensorrt, I'v tried use llama convert, but weight names are different. |
@nv-guomingz hi, thanks for your kind reply. I noticed that in the new workflow for quantization, we are using |
@ChengYouFancy hi, for internlm2, you can convert it to llama style, but there's some thing you need to change.
once there's a good pipeline, we'll pull a request to tensorrt-llm. |
Thanks for your kind reply, I followed your pipeline to convert it to tensorrt successfully. It's an amazing job.
Do you have some idea about the inference result? |
|
@ChengYouFancy hi, did you fix the rope in cpp and rebuild trtllm? |
I followed the pipeline:
|
|
@ChengYouFancy hi, you may need to check the input prompt to see if it has the correct chat template. You can add a template in here TensorRT-LLM/examples/utils.py Line 41 in 850b6fa |
input text looks like is correct
|
|
@ChengYouFancy Have you rebuild and reinstall trtllm ? |
I haven't, should I do it after I fixed the rope in cpp? |
Yes. You should rebuild and reinstall after fixing cpp |
Thanks a lot, I will try it |
I'v tried to rebuild tensorrtllm, but cmake failed. and I could not search any similar issue to help me |
Hi @RunningLeon AMMO is not open-sourced yet and I don't we have plan to open source it soon.
Currently, the typical workflow is we add a new model supporting on high precision and AMMO team will responsible for quantizing the model. |
@nv-guomingz hi, Got it. Thanks for your quick reply. |
Thank you very much, after rebuild and reinstall trtllm, I've convert internlm2 to tensorrt_llm successfully and the inference result is correct finally |
|
@nv-guomingz hi, could you kindly review this PR #1392 if you have time? Thanks in advance. |
Hi @RunningLeon , thanks for your great contribution to TRT-LLM project. cc @juney-nvidia @kaiyux @byshiue for vis |
Hello, I was doing inference after converting internlm2 to llama and got an error: Can the converted model be loaded directly using AutoModelForCausalLM.from_pretrained? Or should it be directly converted into tensorrt form? |
|
@icoderzqliu hi, the converted llama-style internlm2 can be loaded and run with transformers. Not met your issue. Are you using internlm2-chat-20b? BTW, you can try pr #1392, no need to convert to llama style. |
@RunningLeon hi, thank you for your quick reply. Yes, I use internlm2-chat-20b. I will try to use this pr #1392. It seems that the source code needs to be changed. Is there any more detailed steps that I can follow? |
|
@RunningLeon hi,we use lora finetuned the internlm2 model. Now we can convert the base model to llama, but not lora part, we tried to change the code of InternLM/tools/convert2llame.py to transfer lora to llama style, but did not work. Is there any other tools could work for lora? |
|
@ChengYouFancy hi, sorry for the late reply due to the vacation. Maybe you can open an issue to https://github.com/InternLM/InternLM since the convert script is provided by them. |

This PR support InternLM model based on main branch. It is a follow up of #123 with rebased on to main.
Supported TRTLLM build options includes:
Tested on both internlm-chat-7b and internlm-chat-20b.