상업용 응용 | ?포옹얼굴 | ?업데이트 뉴스 | ?보고 문제 | 기술 보고서
채팅 웹 | ?API | ?모델러
영어 | 简体中文
Discord와 WeChat에서 우리와 함께하세요
InternLM2.5 시리즈는 다음 기능을 포함하여 출시되었습니다.
뛰어난 추론 능력 : Llama3 및 Gemma2-9B와 같은 모델을 능가하는 수학 추론에 대한 최첨단 성능.
1M 컨텍스트 창 : 1M 길이 컨텍스트의 건초 더미에서 바늘을 찾는 데 거의 완벽하며 LongBench와 같은 긴 컨텍스트 작업에서 최고의 성능을 발휘합니다. 1M 컨텍스트 추론을 위해 LMDeploy를 사용해 보세요. 자세한 내용과 파일 채팅 데모는 여기에서 확인할 수 있습니다.
더욱 강력한 도구 사용 : InternLM2.5는 100개 이상의 웹 페이지에서 정보 수집을 지원하며 해당 구현은 곧 Lagent에서 출시될 예정입니다. InternLM2.5는 지침 따르기, 도구 선택 및 반영에서 더 나은 도구 활용 관련 기능을 갖추고 있습니다. 예시를 참조하세요.
[2024.08.01] InternLM2.5-1.8B, InternLM2.5-1.8B-Chat, InternLM2.5-20B 및 InternLM2.5-20B-Chat을 출시합니다. 자세한 내용은 아래의 모델 동물원을 참조하여 다운로드하거나 모델 카드를 참조하세요.
[2024.07.19] InternLM2-Reward 시리즈 보상 모델을 1.8B, 7B, 20B 크기로 출시합니다. 자세한 내용은 아래의 모델 동물원을 참조하여 다운로드하거나 모델 카드를 참조하세요.
[2024.07.03] InternLM2.5-7B, InternLM2.5-7B-Chat, InternLM2.5-7B-Chat-1M을 출시합니다. 자세한 내용은 아래의 모델 동물원을 참조하여 다운로드하거나 모델 카드를 참조하세요.
[2024.03.26] InternLM2 기술보고서를 공개합니다. 자세한 내용은 arXiv를 참조하세요.
[2024.01.31] InternLM2-1.8B와 관련 채팅 모델을 출시합니다. 최고의 성능을 유지하면서 더 저렴한 배포 옵션을 제공합니다.
[2024.01.23] 사전 학습 및 SFT 체크포인트가 포함된 InternLM2-Math-7B 및 InternLM2-Math-20B를 출시합니다. 작은 크기로 ChatGPT를 능가합니다. 자세한 내용과 다운로드는 InternLM-Math를 참조하세요.
[2024.01.17] InternLM2-7B 및 InternLM2-20B와 모든 차원에서 더욱 강력한 기능을 갖춘 해당 채팅 모델을 출시합니다. 자세한 내용은 아래의 모델 동물원을 참조하여 다운로드하거나 모델 카드를 참조하세요.
[2023.12.13] InternLM-7B-Chat 및 InternLM-20B-Chat 체크포인트가 업데이트되었습니다. 개선된 미세 조정 전략을 통해 새로운 채팅 모델은 더욱 다양한 스타일로 더 높은 품질의 응답을 생성할 수 있습니다.
[2023.09.20] InternLM-20B가 기본버전과 채팅버전으로 출시되었습니다.
모델 | 트랜스포머(HF) | 모델스코프(HF) | 오픈엑스랩(HF) | OpenXLab(원본) | 출시일 |
---|---|---|---|---|---|
인턴LM2.5-1.8B | ?internlm2_5-1_8b | internlm2_5-1_8b | 2024-08-05 | ||
InternLM2.5-1.8B-채팅 | ?internlm2_5-1_8b-채팅 | internlm2_5-1_8b-채팅 | 2024-08-05 | ||
인턴LM2.5-7B | ?internlm2_5-7b | internlm2_5-7b | 2024-07-03 | ||
InternLM2.5-7B-채팅 | ?internlm2_5-7b-채팅 | internlm2_5-7b-채팅 | 2024-07-03 | ||
InternLM2.5-7B-Chat-1M | ?internlm2_5-7b-chat-1m | internlm2_5-7b-chat-1m | 2024-07-03 | ||
인턴LM2.5-20B | ?internlm2_5-20b | internlm2_5-20b | 2024-08-05 | ||
InternLM2.5-20B-채팅 | ?internlm2_5-20b-채팅 | internlm2_5-20b-채팅 | 2024-08-05 |
참고:
InternLM2.5 시리즈 릴리스에는 1.8B, 7B 및 20B 버전이 포함되어 있습니다. 7B 모델은 연구 및 응용에 효율적이며 20B 모델은 더욱 강력하고 더 복잡한 시나리오를 지원할 수 있습니다. 이들 모델의 관계는 다음과 같다.
제한 사항: 훈련 과정에서 모델의 안전을 보장하고 모델이 윤리적, 법적 요구 사항을 준수하는 텍스트를 생성하도록 장려하기 위해 노력했지만 모델의 크기와 확률적 생성 패러다임으로 인해 여전히 예상치 못한 출력이 발생할 수 있습니다. 예를 들어, 생성된 응답에는 편견, 차별 또는 기타 유해한 콘텐츠가 포함될 수 있습니다. 그러한 내용을 전파하지 마십시오. 유해한 정보의 유포로 인해 발생하는 모든 결과에 대해 당사는 책임을 지지 않습니다.
보충 자료: HF
변환기에서 HuggingFace가 사용하는 형식을 의미하는 반면 Origin
InternEvo의 InternLM 팀이 채택한 형식을 나타냅니다.
InternLM2-Reward는 1.8B, 7B 및 20B 크기로 제공되는 240만 개의 선호도 샘플에 대해 훈련된 일련의 보상 모델입니다. 이 모델은 채팅 모델의 PPO 교육 프로세스에 적용되었습니다. 자세한 내용은 모델 카드를 참조하세요.
모델 | 리워드벤치 점수 | 트랜스포머(HF) | 모델스코프(HF) | 오픈엑스랩(HF) | 출시일 |
---|---|---|---|---|---|
InternLM2-1.8B-보상 | 80.6 | ?internlm2-1_8b-보상 | internlm2-1_8b-보상 | 2024-07-19 | |
InternLM2-7B-보상 | 86.6 | ?internlm2-7b-보상 | internlm2-7b-보상 | 2024-07-19 | |
InternLM2-20B-보상 | 89.5 | ?internlm2-20b-보상 | internlm2-20b-보상 | 2024-07-19 |
장기 컨텍스트 처리, 추론 및 코딩 분야의 고급 기능을 갖춘 이전 세대 모델입니다. 자세한 내용은 모델 카드를 참조하세요.
모델 | 트랜스포머(HF) | 모델스코프(HF) | 오픈엑스랩(HF) | OpenXLab(원본) | 출시일 |
---|---|---|---|---|---|
인턴LM2-1.8B | ?internlm2-1.8b | internlm2-1.8b | 2024-01-31 | ||
InternLM2-Chat-1.8B-SFT | ?internlm2-chat-1.8b-sft | internlm2-chat-1.8b-sft | 2024-01-31 | ||
InternLM2-Chat-1.8B | ?internlm2-chat-1.8b | internlm2-chat-1.8b | 2024-02-19 | ||
InternLM2-Base-7B | ?internlm2-base-7b | internlm2-base-7b | 2024-01-17 | ||
인턴LM2-7B | ?internlm2-7b | internlm2-7b | 2024-01-17 | ||
InternLM2-Chat-7B-SFT | ?internlm2-chat-7b-sft | internlm2-chat-7b-sft | 2024-01-17 | ||
InternLM2-Chat-7B | ?internlm2-chat-7b | internlm2-채팅-7b | 2024-01-17 | ||
InternLM2-Base-20B | ?internlm2-base-20b | internlm2-base-20b | 2024-01-17 | ||
인턴LM2-20B | ?internlm2-20b | 인턴LM2-20b | 2024-01-17 | ||
InternLM2-Chat-20B-SFT | ?internlm2-chat-20b-sft | internlm2-chat-20b-sft | 2024-01-17 | ||
InternLM2-Chat-20B | ?internlm2-chat-20b | internlm2-채팅-20b | 2024-01-17 |
우리는 오픈 소스 평가 도구인 OpenCompass를 사용하여 몇 가지 중요한 벤치마크에서 InternLM2.5를 평가했습니다. 평가 결과 중 일부를 아래 표에 나타내었다. 더 많은 평가 결과를 보려면 OpenCompass 리더보드를 방문해 보세요.
기준 | 인턴LM2.5-7B | 라마3-8B | 이-1.5-9B |
---|---|---|---|
MMLU(5발) | 71.6 | 66.4 | 71.6 |
CMMLU(5발) | 79.1 | 51.0 | 74.1 |
BBH(3연발) | 70.1 | 59.7 | 71.1 |
수학(4샷) | 34.0 | 16.4 | 31.9 |
GSM8K(4샷) | 74.8 | 54.3 | 74.5 |
GPQA(0샷) | 31.3 | 31.3 | 27.8 |
기준 | InternLM2.5-7B-채팅 | Llama3-8B-지시 | Gemma2-9B-IT | Yi-1.5-9B-채팅 | GLM-4-9B-채팅 | Qwen2-7B-지시 |
---|---|---|---|---|---|---|
MMLU(5발) | 72.8 | 68.4 | 70.9 | 71.0 | 71.4 | 70.8 |
CMMLU(5발) | 78.0 | 53.3 | 60.3 | 74.5 | 74.5 | 80.9 |
BBH(3발 CoT) | 71.6 | 54.4 | 68.2* | 69.6 | 69.6 | 65.0 |
수학(0샷 CoT) | 60.1 | 27.9 | 46.9 | 51.1 | 51.1 | 48.6 |
GSM8K(0샷 CoT) | 86.0 | 72.9 | 88.9 | 80.1 | 85.3 | 82.9 |
GPQA(0샷) | 38.4 | 26.1 | 33.8 | 37.9 | 36.9 | 38.4 |
ppl
사용합니다.InternLM은 LLaMA-Factory, vLLM, llama.cpp 등과 같이 잘 알려진 다양한 업스트림 및 다운스트림 프로젝트를 지원합니다. 이 지원을 통해 광범위한 사용자가 InternLM 시리즈 모델을 보다 효율적이고 편리하게 활용할 수 있습니다. 귀하의 편의를 위해 선택된 생태계 프로젝트에 대한 튜토리얼이 여기에서 제공됩니다.
다음 장에서는 Transformers, ModelScope 및 웹 데모의 사용법에 중점을 둘 것입니다. 채팅 모델은 chatml 형식을 채택하여 채팅 및 에이전트 애플리케이션을 모두 지원합니다. 더 나은 사용 효과를 보장하려면 Transformers 또는 ModelScope로 추론을 수행하기 전에 설치된 변환기 라이브러리 버전이 다음 요구 사항을 충족하는지 확인하십시오.
transformers >= 4.38
Transformers를 사용하여 InternLM2.5-7B-Chat 모델을 로드하려면 다음 코드를 사용하십시오.
import torch
from transformers import AutoTokenizer , AutoModelForCausalLM
tokenizer = AutoTokenizer . from_pretrained ( "internlm/internlm2_5-7b-chat" , trust_remote_code = True )
# Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
model = AutoModelForCausalLM . from_pretrained ( "internlm/internlm2_5-7b-chat" , device_map = "auto" , trust_remote_code = True , torch_dtype = torch . float16 )
# (Optional) If on low resource devices, you can load model in 4-bit or 8-bit to further save GPU memory via bitsandbytes.
# InternLM 7B in 4bit will cost nearly 8GB GPU memory.
# pip install -U bitsandbytes
# 8-bit: model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True, load_in_8bit=True)
# 4-bit: model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True, load_in_4bit=True)
model = model . eval ()
response , history = model . chat ( tokenizer , "hello" , history = [])
print ( response )
# Output: Hello? How can I help you today?
response , history = model . chat ( tokenizer , "please provide three suggestions about time management" , history = history )
print ( response )
ModelScope를 사용하여 InternLM2.5-7B-Chat 모델을 로드하려면 다음 코드를 사용하십시오.
import torch
from modelscope import snapshot_download , AutoTokenizer , AutoModelForCausalLM
model_dir = snapshot_download ( 'Shanghai_AI_Laboratory/internlm2_5-7b-chat' )
tokenizer = AutoTokenizer . from_pretrained ( model_dir , device_map = "auto" , trust_remote_code = True )
# Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
model = AutoModelForCausalLM . from_pretrained ( model_dir , device_map = "auto" , trust_remote_code = True , torch_dtype = torch . float16 )
# (Optional) If on low resource devices, you can load model in 4-bit or 8-bit to further save GPU memory via bitsandbytes.
# InternLM 7B in 4bit will cost nearly 8GB GPU memory.
# pip install -U bitsandbytes
# 8-bit: model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True, load_in_8bit=True)
# 4-bit: model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", trust_remote_code=True, load_in_4bit=True)
model = model . eval ()
response , history = model . chat ( tokenizer , "hello" , history = [])
print ( response )
response , history = model . chat ( tokenizer , "please provide three suggestions about time management" , history = history )
print ( response )
다음 코드를 실행하여 프런트엔드 인터페이스를 통해 InternLM Chat 7B 모델과 상호 작용할 수 있습니다.
pip install streamlit
pip install transformers > =4.38
streamlit run ./chat/web_demo.py
InternLM의 빠른 배포를 위해 LMDeploy를 사용합니다.
단 4줄의 코드만으로 pip install lmdeploy
이후 internlm2_5-7b-chat 추론을 수행할 수 있습니다.
from lmdeploy import pipeline
pipe = pipeline ( "internlm/internlm2_5-7b-chat" )
response = pipe ([ "Hi, pls intro yourself" , "Shanghai is" ])
print ( response )
메모리 공간을 줄이기 위해 우리는 다음과 같이 추론을 수행할 수 있는 4비트 양자화 모델 internlm2_5-7b-chat-4bit를 제공합니다.
from lmdeploy import pipeline
pipe = pipeline ( "internlm/internlm2_5-7b-chat-4bit" )
response = pipe ([ "Hi, pls intro yourself" , "Shanghai is" ])
print ( response )
또한 8비트/4비트 KV 캐시 기능을 독립적으로 활성화할 수 있습니다.
from lmdeploy import pipeline , TurbomindEngineConfig
pipe = pipeline ( "internlm/internlm2_5-7b-chat-4bit" ,
backend_config = TurbomindEngineConfig ( quant_policy = 8 ))
response = pipe ([ "Hi, pls intro yourself" , "Shanghai is" ])
print ( response )
모델 배포에 대한 자세한 사용법은 지침을 참조하세요. 추가 배포 튜토리얼을 보려면 여기에서 자유롭게 살펴보세요.
LMDeploy의 동적 NTK 기능을 활성화하면 긴 컨텍스트 추론 능력을 얻을 수 있습니다.
참고: 1M 컨텍스트 길이에는 4xA100-80G가 필요합니다.
from lmdeploy import pipeline , GenerationConfig , TurbomindEngineConfig
backend_config = TurbomindEngineConfig (
rope_scaling_factor = 2.5 ,
session_len = 1048576 , # 1M context length
max_batch_size = 1 ,
cache_max_entry_count = 0.7 ,
tp = 4 ) # 4xA100-80G.
pipe = pipeline ( 'internlm/internlm2_5-7b-chat-1m' , backend_config = backend_config )
prompt = 'Use a long prompt to replace this sentence'
response = pipe ( prompt )
print ( response )
InternLM2.5-Chat 모델은 뛰어난 도구 활용 능력을 갖추고 있으며 제로샷 방식으로 함수 호출 작업을 수행할 수 있습니다. 또한 100개 이상의 웹페이지에서 정보를 수집하여 분석을 수행할 수 있도록 지원합니다. 에이전트 섹션에서 더 많은 예시를 확인하세요.
InternLM을 사용한 미세 조정은 Finetune 문서를 참조하세요.
참고: 우리는 InternLM 교육을 위한 효율적인 사전 교육 및 미세 조정 인프라를 제공하는 보다 쉬운 사용자 경험을 위해 이 프로젝트의 전체 교육 기능을 InternEvo로 마이그레이션했습니다.
우리는 모델 평가를 위해 OpenCompass를 활용합니다. InternLM2.5에서는 주로 표준 객관적 평가, 장기 컨텍스트 평가(건초 더미 속의 바늘), 데이터 오염 평가, 에이전트 평가 및 주관적 평가에 중점을 둡니다.
InternLM 모델을 평가하려면 OpenCompass 튜토리얼의 지침을 따르십시오. 일반적으로 기본 모델의 객관식 질문에는 ppl
사용하고 Chat 모델의 모든 질문에는 gen
사용합니다.
Needle in a Haystack
평가에 대해서는 설명서에 제공된 튜토리얼을 참조하세요. 자유롭게 사용해 보세요.
데이터 오염 평가에 대해 자세히 알아보려면 오염 평가를 확인하세요.
InternLM을 개선하고 향상시키기 위해 노력해주신 모든 기여자께 감사드립니다. 커뮤니티 사용자는 프로젝트에 참여하는 것이 좋습니다. 프로젝트에 기여하는 방법에 대한 지침은 기여 지침을 참조하세요.
코드는 Apache-2.0에 따라 라이센스가 부여되는 반면 모델 가중치는 학문적 연구를 위해 완전히 개방되어 있으며 무료 상업적 사용도 허용합니다. 상용 라이센스를 신청하려면 신청서(영어)/申请表(중문)을 작성해 주세요. 다른 질문이나 협업이 필요하면 [email protected]으로 문의하세요.
@misc{cai2024internlm2,
title={InternLM2 Technical Report},
author={Zheng Cai and Maosong Cao and Haojiong Chen and Kai Chen and Keyu Chen and Xin Chen and Xun Chen and Zehui Chen and Zhi Chen and Pei Chu and Xiaoyi Dong and Haodong Duan and Qi Fan and Zhaoye Fei and Yang Gao and Jiaye Ge and Chenya Gu and Yuzhe Gu and Tao Gui and Aijia Guo and Qipeng Guo and Conghui He and Yingfan Hu and Ting Huang and Tao Jiang and Penglong Jiao and Zhenjiang Jin and Zhikai Lei and Jiaxing Li and Jingwen Li and Linyang Li and Shuaibin Li and Wei Li and Yining Li and Hongwei Liu and Jiangning Liu and Jiawei Hong and Kaiwen Liu and Kuikun Liu and Xiaoran Liu and Chengqi Lv and Haijun Lv and Kai Lv and Li Ma and Runyuan Ma and Zerun Ma and Wenchang Ning and Linke Ouyang and Jiantao Qiu and Yuan Qu and Fukai Shang and Yunfan Shao and Demin Song and Zifan Song and Zhihao Sui and Peng Sun and Yu Sun and Huanze Tang and Bin Wang and Guoteng Wang and Jiaqi Wang and Jiayu Wang and Rui Wang and Yudong Wang and Ziyi Wang and Xingjian Wei and Qizhen Weng and Fan Wu and Yingtong Xiong and Chao Xu and Ruiliang Xu and Hang Yan and Yirong Yan and Xiaogui Yang and Haochen Ye and Huaiyuan Ying and Jia Yu and Jing Yu and Yuhang Zang and Chuyu Zhang and Li Zhang and Pan Zhang and Peng Zhang and Ruijie Zhang and Shuo Zhang and Songyang Zhang and Wenjian Zhang and Wenwei Zhang and Xingcheng Zhang and Xinyue Zhang and Hui Zhao and Qian Zhao and Xiaomeng Zhao and Fengzhe Zhou and Zaida Zhou and Jingming Zhuo and Yicheng Zou and Xipeng Qiu and Yu Qiao and Dahua Lin},
year={2024},
eprint={2403.17297},
archivePrefix={arXiv},
primaryClass={cs.CL}
}