InternLM/tools/transformers
Sun Peng fa7337b37b initial commit 2023-07-06 12:55:23 +08:00
..
README.md initial commit 2023-07-06 12:55:23 +08:00
configuration_internlm.py initial commit 2023-07-06 12:55:23 +08:00
intern_moss_example.py initial commit 2023-07-06 12:55:23 +08:00
internlm_sft_on_moss.py initial commit 2023-07-06 12:55:23 +08:00
modeling_internlm.py initial commit 2023-07-06 12:55:23 +08:00
tokenization_internlm.py initial commit 2023-07-06 12:55:23 +08:00

README.md

InternLM Transformers

该文件夹下包含了 transformers 格式的 InternLM 模型。

权重转换

../tools/convert2hf.py 可以将训练保存的权重一键转换为 transformers 格式。

python convert2hf.py --src_folder origin_ckpt/ --tgt_folder hf_ckpt/ --tokenizer tokenizes/tokenizer.model

然后可以使用 from_pretrained 接口加载:

from modeling_internlm import InternLMForCausalLM

model = InternForCausalLM.from_pretrained("hf_ckpt/")

moss_example.py 展示了如何使用 LoRA 来在 fnlp/moss-moon-002-sft 数据集上进行微调的样例。