Skip to content
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

Support internlm2 #1392

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

RunningLeon
Copy link

@RunningLeon RunningLeon commented Apr 2, 2024

This PR supports the conversion of internlm2 from hf to trt-llm checkpoints with :

  • fp16/bf16
  • tp

@PaulX1029
Copy link

image
做了相应修改后engine build不成功,请问可以怎样解决呢?
我的命令是:
python3 convert_checkpoint.py --model_dir /mnt/checkpoint/models/internlm2-chat-20b/ --dtype float16 --output_dir /mnt/tllm_checkpoint/internlm2-chat-20b/tllm_checkpoint_1gpu_tp1

trtllm-build --checkpoint_dir /mnt/tllm_checkpoint/internlm2-chat-20b/tllm_checkpoint_1gpu_tp1/ --output_dir /mnt/trt_engines/internlm2-chat-20b/fp16/1-gpu/ --gemm_plugin float16 --max_batch_size=32 --max_input_len=2048 --max_output_len=2048

@PaulX1029
Copy link

image 做了相应修改后engine build不成功,请问可以怎样解决呢? 我的命令是: python3 convert_checkpoint.py --model_dir /mnt/checkpoint/models/internlm2-chat-20b/ --dtype float16 --output_dir /mnt/tllm_checkpoint/internlm2-chat-20b/tllm_checkpoint_1gpu_tp1

trtllm-build --checkpoint_dir /mnt/tllm_checkpoint/internlm2-chat-20b/tllm_checkpoint_1gpu_tp1/ --output_dir /mnt/trt_engines/internlm2-chat-20b/fp16/1-gpu/ --gemm_plugin float16 --max_batch_size=32 --max_input_len=2048 --max_output_len=2048
版本信息:
image

@RunningLeon
Copy link
Author

RunningLeon commented Apr 10, 2024

@PaulX1029 Hi, have you rebuilt and reinstalled tensorrt-llm? You can find the installation location by pip3 show tensorrt_llmand check tensorrt_llm/models/__init__.py to see if MODEL_MAP is as expected:

@PaulX1029
Copy link

@RunningLeon 请问您是采用什么build的方式,我是从pip安装的trtllm,我想要跟您对齐build方式重新进行

@RunningLeon
Copy link
Author

@RunningLeon 请问您是采用什么build的方式,我是从pip安装的trtllm,我想要跟您对齐build方式重新进行

#266 (comment)

@cqy930325
Copy link

@RunningLeon 很感谢你的工作!想问下internvl-1.5的internlm2-20b 网络跟普通internlm2-20b有什么区别吗,我用了PR里的转换脚本转出来之后都是乱码。

@ChengYouFancy
Copy link

@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?
tips: we can't export base model and lora to one single model, because we want to use https://github.com/NVIDIA/TensorRT-LLM/tree/main/examples/llama#run-llama-with-several-lora-checkpoints this feature. Thus, if we can transfer internlm2 lora to llama style, then we can use examples/hf_lora_convert.py to build trt-llm

@RunningLeon
Copy link
Author

@nv-guomingz Hi, sorry to bother you, but when will this PR be merged? Do I need to fix the conflicts?
THX

@byshiue byshiue requested a review from nv-guomingz May 15, 2024 10:18
@byshiue byshiue added the triaged Issue has been triaged by maintainers label May 15, 2024
@RunningLeon
Copy link
Author

@nv-guomingz hi, the conflicts with main branch are resolved. Looking forward to your review comments. THX.

@DefTruth
Copy link

@RunningLeon 请问下为什么internlm2需要单独一个convert_checkpoint.py呢?而不是复用llama的convert_checkpoint.py,internlm是直接使用llama的convert_checkpoint.py

@RunningLeon
Copy link
Author

@RunningLeon 请问下为什么internlm2需要单独一个convert_checkpoint.py呢?而不是复用llama的convert_checkpoint.py,internlm是直接使用llama的convert_checkpoint.py

hi, internlm2 W_qkv是在一起的,其次一些参数命名是和llama没有对齐的。因而没法直接使用llama的convert_checkpoint.py

@DefTruth
Copy link

@RunningLeon 请问下为什么internlm2需要单独一个convert_checkpoint.py呢?而不是复用llama的convert_checkpoint.py,internlm是直接使用llama的convert_checkpoint.py

hi, internlm2 W_qkv是在一起的,其次一些参数命名是和llama没有对齐的。因而没法直接使用llama的convert_checkpoint.py

Thank you for this explanation!

@nv-guomingz
Copy link
Collaborator

Hi @RunningLeon sorry for late response due to internal task priority.
Would u please rebase the code firstly and I'll try to merge your MR into main branch this week.

@RunningLeon
Copy link
Author

Hi @RunningLeon sorry for late response due to internal task priority. Would u please rebase the code firstly and I'll try to merge your MR into main branch this week.

@nv-guomingz Done. Hope merging with main is OK.

@nv-guomingz
Copy link
Collaborator

Hi @RunningLeon sorry for late response due to internal task priority. Would u please rebase the code firstly and I'll try to merge your MR into main branch this week.

@nv-guomingz Done. Hope merging with main is OK.

Thanks @RunningLeon. Could u please rebase your commits into one single commit? That would be more easy for further integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been triaged by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants