@@ -148,41 +148,80 @@ Here is a simple introduction of web-ui:
148148- View the training time and training GPU memory comparison under different parameters, you can check [ Benchmark] ( https://github.com/modelscope/swift/blob/main/docs/source/LLM/Benchmark.md ) .
149149
150150
151+ ### Quick Start
152+ ``` python
153+ # pip install ms-swift -U
154+
155+ # Experimental environment: A10, 3090, V100, ...
156+ # 12GB GPU memory
157+ import os
158+ os.environ[' CUDA_VISIBLE_DEVICES' ] = ' 0'
159+
160+ import torch
161+
162+ from swift.llm import (
163+ DatasetName, InferArguments, ModelType, SftArguments,
164+ infer_main, sft_main, app_ui_main, merge_lora_main
165+ )
166+
167+ model_type = ModelType.qwen_1_8b_chat
168+ sft_args = SftArguments(
169+ model_type = model_type,
170+ train_dataset_sample = 2000 ,
171+ dataset = [DatasetName.jd_sentiment_zh],
172+ output_dir = ' output' )
173+ result = sft_main(sft_args)
174+ best_model_checkpoint = result[' best_model_checkpoint' ]
175+ print (f ' best_model_checkpoint: { best_model_checkpoint} ' )
176+ torch.cuda.empty_cache()
177+
178+ infer_args = InferArguments(
179+ ckpt_dir = best_model_checkpoint,
180+ load_dataset_config = True ,
181+ show_dataset_sample = 10 )
182+ # merge_lora_main(infer_args)
183+ result = infer_main(infer_args)
184+ torch.cuda.empty_cache()
185+
186+ app_ui_main(infer_args)
187+ ```
188+
189+
151190### Features
152191- Supported SFT Methods: [ lora] ( https://arxiv.org/abs/2106.09685 ) , [ qlora] ( https://arxiv.org/abs/2305.14314 ) , [ longlora] ( https://arxiv.org/abs/2309.12307 ) , [ qalora] ( https://arxiv.org/abs/2309.14717 ) , full parameter fine-tuning, partial parameter fine-tuning.
153192- Supported Features: quantization, DDP, model parallelism, gradient checkpointing, pushing to modelscope hub, custom datasets, multimodal and agent SFT, mutli-round chat, DPO, self-cognition fine-tuning, ...
154193- Supported Models: [[ Detailed Info]] ( https://github.com/modelscope/swift/blob/main/docs/source/LLM/%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86.md#%E6%A8%A1%E5%9E%8B )
155194 - Multi-Modal:
156- - qwen-vl series: qwen-vl, qwen-vl-chat, qwen-vl-chat-int4.
157- - qwen-audio series: qwen-audio, qwen-audio-chat.
158- - yi-vl series: yi-vl-6b-chat, yi-vl-34b-chat.
159- - cogagent series: cogagent-18b-chat, cogagent-18b-instruct.
195+ - [ qwen-vl] ( https://github.com/QwenLM/Qwen-VL ) series: qwen-vl, qwen-vl-chat, qwen-vl-chat-int4.
196+ - [ qwen-audio] ( https://github.com/QwenLM/Qwen-Audio ) series: qwen-audio, qwen-audio-chat.
197+ - [ yi-vl] ( https://github.com/01-ai/Yi ) series: yi-vl-6b-chat, yi-vl-34b-chat.
198+ - [ cogagent] ( https://github.com/THUDM/CogVLM ) series: cogagent-18b-chat, cogagent-18b-instruct.
160199 - General:
161- - qwen series: qwen-1_8b, qwen-1_8b-chat, qwen-1_8b-chat-int4, qwen-1_8b-chat-int8, qwen-7b, qwen-7b-chat, qwen-7b-chat-int4, qwen-7b-chat-int8, qwen-14b, qwen-14b-chat, qwen-14b-chat-int4, qwen-14b-chat-int8, qwen-72b, qwen-72b-chat, qwen-72b-chat-int4, qwen-72b-chat-int8.
162- - chatglm series: chatglm2-6b, chatglm2-6b-32k, chatglm3-6b-base, chatglm3-6b, chatglm3-6b-32k.
163- - llama series: llama2-7b, llama2-7b-chat, llama2-13b, llama2-13b-chat, llama2-70b, llama2-70b-chat.
164- - yi series: yi-6b, yi-6b-200k, yi-6b-chat, yi-34b, yi-34b-200k, yi-34b-chat.
165- - internlm series: internlm-7b, internlm-7b-chat, internlm-7b-chat-8k, internlm-20b, internlm-20b-chat, internlm2-7b-base, internlm2-7b, internlm2-7b-sft-chat, internlm2-7b-chat, internlm2-20b-base, internlm2-20b, internlm2-20b-sft-chat, internlm2-20b-chat.
166- - deepseek series: deepseek-7b, deepseek-7b-chat, deepseek-67b, deepseek-67b-chat, deepseek-moe-16b, deepseek-moe-16b-chat.
167- - openbuddy series: openbuddy-llama2-13b-chat, openbuddy-llama-65b-chat, openbuddy-llama2-70b-chat, openbuddy-mistral-7b-chat, openbuddy-zephyr-7b-chat, openbuddy-deepseek-67b-chat.
168- - mistral series: mistral-7b, mistral-7b-instruct, mistral-7b-instruct-v2.
169- - mixtral series: mixtral-moe-7b, mixtral-moe-7b-instruct.
170- - baichuan series: baichuan-7b, baichuan-13b, baichuan-13b-chat, baichuan2-7b, baichuan2-7b-chat, baichuan2-13b, baichuan2-13b-chat, baichuan2-7b-chat-int4, baichuan2-13b-chat-int4.
171- - yuan series: yuan2-2b-instruct, yuan2-2b-janus-instruct, yuan2-51b-instruct, yuan2-102b-instruct.
172- - xverse series: xverse-7b, xverse-7b-chat, xverse-13b, xverse-13b-chat, xverse-65b, xverse-65b-v2, xverse-65b-chat, xverse-13b-256k.
173- - orion series: orion-14b, orion-14b-chat.
174- - bluelm series: bluelm-7b, bluelm-7b-chat, bluelm-7b-32k, bluelm-7b-chat-32k.
175- - zephyr series: zephyr-7b-beta-chat.
176- - ziya series: ziya2-13b, ziya2-13b-chat.
177- - skywork series: skywork-13b, skywork-13b-chat.
178- - other: polylm-13b, seqgpt-560m, sus-34b-chat.
200+ - [ qwen] ( https://github.com/QwenLM/Qwen ) series: qwen-1_8b, qwen-1_8b-chat, qwen-1_8b-chat-int4, qwen-1_8b-chat-int8, qwen-7b, qwen-7b-chat, qwen-7b-chat-int4, qwen-7b-chat-int8, qwen-14b, qwen-14b-chat, qwen-14b-chat-int4, qwen-14b-chat-int8, qwen-72b, qwen-72b-chat, qwen-72b-chat-int4, qwen-72b-chat-int8.
201+ - [ chatglm] ( https://github.com/THUDM/ChatGLM-6B ) series: chatglm2-6b, chatglm2-6b-32k, chatglm3-6b-base, chatglm3-6b, chatglm3-6b-32k.
202+ - [ llama] ( https://github.com/facebookresearch/llama ) series: llama2-7b, llama2-7b-chat, llama2-13b, llama2-13b-chat, llama2-70b, llama2-70b-chat.
203+ - [ yi ] ( https://github.com/01-ai/Yi ) series: yi-6b, yi-6b-200k, yi-6b-chat, yi-34b, yi-34b-200k, yi-34b-chat.
204+ - [ internlm] ( https://github.com/InternLM/InternLM ) series: internlm-7b, internlm-7b-chat, internlm-7b-chat-8k, internlm-20b, internlm-20b-chat, internlm2-7b-base, internlm2-7b, internlm2-7b-sft-chat, internlm2-7b-chat, internlm2-20b-base, internlm2-20b, internlm2-20b-sft-chat, internlm2-20b-chat.
205+ - [ deepseek] ( https://github.com/deepseek-ai/deepseek-LLM ) series: deepseek-7b, deepseek-7b-chat, deepseek-67b, deepseek-67b-chat, deepseek-moe-16b, deepseek-moe-16b-chat.
206+ - [ openbuddy] ( https://github.com/OpenBuddy/OpenBuddy ) series: openbuddy-llama2-13b-chat, openbuddy-llama-65b-chat, openbuddy-llama2-70b-chat, openbuddy-mistral-7b-chat, openbuddy-zephyr-7b-chat, openbuddy-deepseek-67b-chat.
207+ - [ mistral] ( https://github.com/mistralai/mistral-src ) series: mistral-7b, mistral-7b-instruct, mistral-7b-instruct-v2.
208+ - [ mixtral] ( https://github.com/mistralai/mistral-src ) series: mixtral-moe-7b, mixtral-moe-7b-instruct.
209+ - [ baichuan] ( https://github.com/baichuan-inc/Baichuan2 ) series: baichuan-7b, baichuan-13b, baichuan-13b-chat, baichuan2-7b, baichuan2-7b-chat, baichuan2-13b, baichuan2-13b-chat, baichuan2-7b-chat-int4, baichuan2-13b-chat-int4.
210+ - [ yuan] ( https://github.com/IEIT-Yuan/Yuan-2.0 ) series: yuan2-2b-instruct, yuan2-2b-janus-instruct, yuan2-51b-instruct, yuan2-102b-instruct.
211+ - [ xverse] ( https://github.com/xverse-ai/XVERSE-13B ) series: xverse-7b, xverse-7b-chat, xverse-13b, xverse-13b-chat, xverse-65b, xverse-65b-v2, xverse-65b-chat, xverse-13b-256k.
212+ - [ orion] ( https://github.com/OrionStarAI/OrionStar-Yi-34B-Chat ) series: orion-14b, orion-14b-chat.
213+ - [ bluelm] ( https://github.com/vivo-ai-lab/BlueLM ) series: bluelm-7b, bluelm-7b-chat, bluelm-7b-32k, bluelm-7b-chat-32k.
214+ - [ zephyr] ( https://github.com/huggingface/alignment-handbook ) series: zephyr-7b-beta-chat.
215+ - [ ziya] ( https://github.com/IDEA-CCNL/Fengshenbang-LM ) series: ziya2-13b, ziya2-13b-chat.
216+ - [ skywork] ( https://github.com/SkyworkAI/Skywork ) series: skywork-13b, skywork-13b-chat.
217+ - other: [ polylm-13b] ( https://github.com/DAMO-NLP-MT/PolyLM ) , [ seqgpt-560m] ( https://github.com/Alibaba-NLP/SeqGPT ) , [ sus-34b-chat] ( https://github.com/SUSTech-IDEA/SUS-Chat ) .
179218 - Financial:
180- - tongyi-finance series: tongyi-finance-14b, tongyi-finance-14b-chat, tongyi-finance-14b-chat-int4.
219+ - [ tongyi-finance] ( https://github.com/QwenLM/Qwen ) series: tongyi-finance-14b, tongyi-finance-14b-chat, tongyi-finance-14b-chat-int4.
181220 - Coding:
182- - codefuse series: codefuse-codellama-34b-chat, codefuse-codegeex2-6b-chat, codefuse-qwen-14b-chat.
183- - deepseek-coder series: deepseek-coder-1_3b, deepseek-coder-1_3b-instruct, deepseek-coder-6_7b, deepseek-coder-6_7b-instruct, deepseek-coder-33b, deepseek-coder-33b-instruct.
184- - codegeex2 series: codegeex2-6b.
185- - phi series: phi2-3b.
221+ - [ codefuse] ( https://github.com/codefuse-ai ) series: codefuse-codellama-34b-chat, codefuse-codegeex2-6b-chat, codefuse-qwen-14b-chat.
222+ - [ deepseek-coder] ( https://github.com/deepseek-ai/DeepSeek-Coder ) series: deepseek-coder-1_3b, deepseek-coder-1_3b-instruct, deepseek-coder-6_7b, deepseek-coder-6_7b-instruct, deepseek-coder-33b, deepseek-coder-33b-instruct.
223+ - [ codegeex2] ( https://github.com/THUDM/CodeGeeX2 ) series: codegeex2-6b.
224+ - [ phi] ( https://www.microsoft.com/en-us/research/blog/phi-2-the-surprising-power-of-small-language-models/ ) series: phi2-3b.
186225- Supported Datasets: [[ Detailed Info]] ( https://github.com/modelscope/swift/blob/main/docs/source/LLM/%E6%94%AF%E6%8C%81%E7%9A%84%E6%A8%A1%E5%9E%8B%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86.md#%E6%95%B0%E6%8D%AE%E9%9B%86 )
187226 - NLP:
188227 - General: 🔥alpaca-en(gpt4), 🔥alpaca-zh(gpt4), multi-alpaca-all, instinwild-en, instinwild-zh, cot-en, cot-zh, firefly-all-zh, instruct-en, gpt4all-en, sharegpt-en, sharegpt-zh, tutu-v2-sft-mixture, wikipedia-zh, open-orca, open-orca-gpt4, sharegpt-gpt4.
@@ -202,7 +241,7 @@ Here is a simple introduction of web-ui:
202241 - Custom Dataset
203242- Supported Templates:
204243 - Text Generation: default-generation, default-generation-bos, chatglm-generation.
205- - Chat: default, qwen, baichuan, chatglm2, chatglm3, llama, openbuddy, internlm, internlm2, yi, yuan, xverse, ziya, skywork, bluelm, zephyr, sus, deepseek, deepseek-coder, codefuse-codellama, codefuse, cogagent-chat, cogagent-instruct.
244+ - Chat: default, qwen, baichuan, chatglm2, chatglm3, llama, openbuddy, internlm, internlm2, yi, yuan, xverse, ziya, skywork, bluelm, zephyr, sus, deepseek, deepseek-coder, codefuse-codellama, codefuse, cogagent-chat, cogagent-instruct, yi-vl .
206245
207246
208247## 🔥SCEdit
0 commit comments