Add pipeline tag, library name and link to paper
Browse filesThis PR improves the model card by:
- making sure the model can be found at https://huggingface.co/models?pipeline_tag=text-generation&sort=trending
- adding the transformers library.
- is linked to https://huggingface.co/papers/2402.07625
README.md
CHANGED
@@ -1,10 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |

|
2 |
|
|
|
|
|
3 |
[](https://github.com/hiyouga/LLaMA-Factory/stargazers)
|
4 |
[](LICENSE)
|
5 |
[](https://github.com/hiyouga/LLaMA-Factory/commits/main)
|
6 |
[](https://pypi.org/project/llamafactory/)
|
7 |
-
[](https://github.com/hiyouga/LLaMA-Factory/pulls)
|
9 |
[](https://discord.gg/rKfvV9r9FK)
|
10 |
[](https://twitter.com/llamafactory_ai)
|
@@ -87,9 +95,9 @@ Compared to ChatGLM's [P-Tuning](https://github.com/THUDM/ChatGLM2-6B/tree/main/
|
|
87 |
|
88 |
<details><summary>Full Changelog</summary>
|
89 |
|
90 |
-
[24/07/04] We
|
91 |
|
92 |
-
[24/06/16] We
|
93 |
|
94 |
[24/06/07] We supported fine-tuning the **[Qwen2](https://qwenlm.github.io/blog/qwen2/)** and **[GLM-4](https://github.com/THUDM/GLM-4)** models.
|
95 |
|
@@ -133,8 +141,7 @@ Compared to ChatGLM's [P-Tuning](https://github.com/THUDM/ChatGLM2-6B/tree/main/
|
|
133 |
|
134 |
[23/12/23] We supported **[unsloth](https://github.com/unslothai/unsloth)**'s implementation to boost LoRA tuning for the LLaMA, Mistral and Yi models. Try `use_unsloth: true` argument to activate unsloth patch. It achieves **170%** speed in our benchmark, check [this page](https://github.com/hiyouga/LLaMA-Factory/wiki/Performance-comparison) for details.
|
135 |
|
136 |
-
[23/12/12] We supported fine-tuning the latest MoE model **[Mixtral 8x7B](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1)** in our framework. See hardware requirement [here](#hardware-requirement)
|
137 |
-
|
138 |
[23/12/01] We supported downloading pre-trained models and datasets from the **[ModelScope Hub](https://modelscope.cn/models)**. See [this tutorial](#download-from-modelscope-hub) for usage.
|
139 |
|
140 |
[23/10/21] We supported **[NEFTune](https://arxiv.org/abs/2310.05914)** trick for fine-tuning. Try `neftune_noise_alpha: 5` argument to activate NEFTune.
|
@@ -155,11 +162,11 @@ Compared to ChatGLM's [P-Tuning](https://github.com/THUDM/ChatGLM2-6B/tree/main/
|
|
155 |
|
156 |
[23/07/18] We developed an **all-in-one Web UI** for training, evaluation and inference. Try `train_web.py` to fine-tune models in your Web browser. Thank [@KanadeSiina](https://github.com/KanadeSiina) and [@codemayq](https://github.com/codemayq) for their efforts in the development.
|
157 |
|
158 |
-
[23/07/09] We released **[FastEdit](https://github.com/hiyouga/FastEdit)**
|
159 |
|
160 |
[23/06/29] We provided a **reproducible example** of training a chat model using instruction-following datasets, see [Baichuan-7B-sft](https://huggingface.co/hiyouga/Baichuan-7B-sft) for details.
|
161 |
|
162 |
-
[23/06/22] We aligned the [demo API](src/api_demo.py) with the [OpenAI's](https://platform.openai.com/docs/api-reference/chat) format where you can insert the fine-tuned model in **arbitrary ChatGPT-based applications**.
|
163 |
|
164 |
[23/06/03] We supported quantized training and inference (aka **[QLoRA](https://github.com/artidoro/qlora)**). See [examples](examples/README.md) for usage.
|
165 |
|
@@ -167,36 +174,33 @@ Compared to ChatGLM's [P-Tuning](https://github.com/THUDM/ChatGLM2-6B/tree/main/
|
|
167 |
|
168 |
## Supported Models
|
169 |
|
170 |
-
| Model | Model size | Template
|
171 |
-
| ----------------------------------------------------------------- | -------------------------------- |
|
172 |
-
| [Baichuan 2](https://huggingface.co/baichuan-inc) | 7B/13B | baichuan2
|
173 |
-
| [BLOOM/BLOOMZ](https://huggingface.co/bigscience) | 560M/1.1B/1.7B/3B/7.1B/176B | -
|
174 |
-
| [ChatGLM3](https://huggingface.co/THUDM) | 6B | chatglm3
|
175 |
-
| [Command R](https://huggingface.co/CohereForAI) | 35B/104B | cohere
|
176 |
-
| [DeepSeek (Code/MoE)](https://huggingface.co/deepseek-ai) | 7B/16B/67B/236B | deepseek
|
177 |
-
| [Falcon](https://huggingface.co/tiiuae) | 7B/11B/40B/180B | falcon
|
178 |
-
| [Gemma/Gemma 2/CodeGemma](https://huggingface.co/google) | 2B/7B/9B/27B | gemma
|
179 |
-
| [GLM-4](https://huggingface.co/THUDM) | 9B | glm4
|
180 |
-
| [
|
181 |
-
| [Llama](https://
|
182 |
-
| [Llama
|
183 |
-
| [
|
184 |
-
| [LLaVA-
|
185 |
-
| [LLaVA-NeXT](https://huggingface.co/llava-hf)
|
186 |
-
| [
|
187 |
-
| [
|
188 |
-
| [
|
189 |
-
| [
|
190 |
-
| [
|
191 |
-
| [
|
192 |
-
| [
|
193 |
-
| [
|
194 |
-
| [
|
195 |
-
| [
|
196 |
-
| [
|
197 |
-
| [Yi/Yi-1.5 (Code)](https://huggingface.co/01-ai) | 1.5B/6B/9B/34B | yi |
|
198 |
-
| [Yi-VL](https://huggingface.co/01-ai) | 6B/34B | yi_vl |
|
199 |
-
| [Yuan 2](https://huggingface.co/IEITYuan) | 2B/51B/102B | yuan |
|
200 |
|
201 |
> [!NOTE]
|
202 |
> For the "base" models, the `template` argument can be chosen from `default`, `alpaca`, `vicuna` etc. But make sure to use the **corresponding template** for the "instruct/chat" models.
|
@@ -280,9 +284,9 @@ You also can add a custom chat template to [template.py](src/llamafactory/data/t
|
|
280 |
- [STEM (zh)](https://huggingface.co/datasets/hfl/stem_zh_instruction)
|
281 |
- [Ruozhiba (zh)](https://huggingface.co/datasets/hfl/ruozhiba_gpt4_turbo)
|
282 |
- [Neo-sft (zh)](https://huggingface.co/datasets/m-a-p/neo_sft_phase2)
|
283 |
-
- [WebInstructSub (en)](https://huggingface.co/datasets/TIGER-Lab/WebInstructSub)
|
284 |
- [Magpie-Pro-300K-Filtered (en)](https://huggingface.co/datasets/Magpie-Align/Magpie-Pro-300K-Filtered)
|
285 |
- [Magpie-ultra-v0.1 (en)](https://huggingface.co/datasets/argilla/magpie-ultra-v0.1)
|
|
|
286 |
- [LLaVA mixed (en&zh)](https://huggingface.co/datasets/BUAADreamer/llava-en-zh-300k)
|
287 |
- [Pokemon-gpt4o-captions (en&zh)](https://huggingface.co/datasets/jugg1024/pokemon-gpt4o-captions)
|
288 |
- [Open Assistant (de)](https://huggingface.co/datasets/mayflowergmbh/oasst_de)
|
@@ -290,453 +294,4 @@ You also can add a custom chat template to [template.py](src/llamafactory/data/t
|
|
290 |
- [Alpaca GPT4 (de)](https://huggingface.co/datasets/mayflowergmbh/alpaca-gpt4_de)
|
291 |
- [OpenSchnabeltier (de)](https://huggingface.co/datasets/mayflowergmbh/openschnabeltier_de)
|
292 |
- [Evol Instruct (de)](https://huggingface.co/datasets/mayflowergmbh/evol-instruct_de)
|
293 |
-
- [Dolphin (de)](https://huggingface
|
294 |
-
- [Booksum (de)](https://huggingface.co/datasets/mayflowergmbh/booksum_de)
|
295 |
-
- [Airoboros (de)](https://huggingface.co/datasets/mayflowergmbh/airoboros-3.0_de)
|
296 |
-
- [Ultrachat (de)](https://huggingface.co/datasets/mayflowergmbh/ultra-chat_de)
|
297 |
-
|
298 |
-
</details>
|
299 |
-
|
300 |
-
<details><summary>Preference datasets</summary>
|
301 |
-
|
302 |
-
- [DPO mixed (en&zh)](https://huggingface.co/datasets/hiyouga/DPO-En-Zh-20k)
|
303 |
-
- [UltraFeedback (en)](https://huggingface.co/datasets/HuggingFaceH4/ultrafeedback_binarized)
|
304 |
-
- [RLHF-V (en)](https://huggingface.co/datasets/openbmb/RLHF-V-Dataset)
|
305 |
-
- [VLFeedback (en)](https://huggingface.co/datasets/Zhihui/VLFeedback)
|
306 |
-
- [Orca DPO Pairs (en)](https://huggingface.co/datasets/Intel/orca_dpo_pairs)
|
307 |
-
- [HH-RLHF (en)](https://huggingface.co/datasets/Anthropic/hh-rlhf)
|
308 |
-
- [Nectar (en)](https://huggingface.co/datasets/berkeley-nest/Nectar)
|
309 |
-
- [Orca DPO (de)](https://huggingface.co/datasets/mayflowergmbh/intel_orca_dpo_pairs_de)
|
310 |
-
- [KTO mixed (en)](https://huggingface.co/datasets/argilla/kto-mix-15k)
|
311 |
-
|
312 |
-
</details>
|
313 |
-
|
314 |
-
Some datasets require confirmation before using them, so we recommend logging in with your Hugging Face account using these commands.
|
315 |
-
|
316 |
-
```bash
|
317 |
-
pip install --upgrade huggingface_hub
|
318 |
-
huggingface-cli login
|
319 |
-
```
|
320 |
-
|
321 |
-
## Requirement
|
322 |
-
|
323 |
-
| Mandatory | Minimum | Recommend |
|
324 |
-
| ------------ | ------- | --------- |
|
325 |
-
| python | 3.8 | 3.11 |
|
326 |
-
| torch | 1.13.1 | 2.4.0 |
|
327 |
-
| transformers | 4.41.2 | 4.43.4 |
|
328 |
-
| datasets | 2.16.0 | 2.20.0 |
|
329 |
-
| accelerate | 0.30.1 | 0.32.0 |
|
330 |
-
| peft | 0.11.1 | 0.12.0 |
|
331 |
-
| trl | 0.8.6 | 0.9.6 |
|
332 |
-
|
333 |
-
| Optional | Minimum | Recommend |
|
334 |
-
| ------------ | ------- | --------- |
|
335 |
-
| CUDA | 11.6 | 12.2 |
|
336 |
-
| deepspeed | 0.10.0 | 0.14.0 |
|
337 |
-
| bitsandbytes | 0.39.0 | 0.43.1 |
|
338 |
-
| vllm | 0.4.3 | 0.5.0 |
|
339 |
-
| flash-attn | 2.3.0 | 2.6.3 |
|
340 |
-
|
341 |
-
### Hardware Requirement
|
342 |
-
|
343 |
-
\* *estimated*
|
344 |
-
|
345 |
-
| Method | Bits | 7B | 13B | 30B | 70B | 110B | 8x7B | 8x22B |
|
346 |
-
| ----------------- | ---- | ----- | ----- | ----- | ------ | ------ | ----- | ------ |
|
347 |
-
| Full | AMP | 120GB | 240GB | 600GB | 1200GB | 2000GB | 900GB | 2400GB |
|
348 |
-
| Full | 16 | 60GB | 120GB | 300GB | 600GB | 900GB | 400GB | 1200GB |
|
349 |
-
| Freeze | 16 | 20GB | 40GB | 80GB | 200GB | 360GB | 160GB | 400GB |
|
350 |
-
| LoRA/GaLore/BAdam | 16 | 16GB | 32GB | 64GB | 160GB | 240GB | 120GB | 320GB |
|
351 |
-
| QLoRA | 8 | 10GB | 20GB | 40GB | 80GB | 140GB | 60GB | 160GB |
|
352 |
-
| QLoRA | 4 | 6GB | 12GB | 24GB | 48GB | 72GB | 30GB | 96GB |
|
353 |
-
| QLoRA | 2 | 4GB | 8GB | 16GB | 24GB | 48GB | 18GB | 48GB |
|
354 |
-
|
355 |
-
## Getting Started
|
356 |
-
|
357 |
-
### Installation
|
358 |
-
|
359 |
-
> [!IMPORTANT]
|
360 |
-
> Installation is mandatory.
|
361 |
-
|
362 |
-
```bash
|
363 |
-
git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git
|
364 |
-
cd LLaMA-Factory
|
365 |
-
pip install -e ".[torch,metrics]"
|
366 |
-
```
|
367 |
-
|
368 |
-
Extra dependencies available: torch, torch-npu, metrics, deepspeed, liger-kernel, bitsandbytes, hqq, eetq, gptq, awq, aqlm, vllm, galore, badam, adam-mini, qwen, modelscope, openmind, quality
|
369 |
-
|
370 |
-
> [!TIP]
|
371 |
-
> Use `pip install --no-deps -e .` to resolve package conflicts.
|
372 |
-
|
373 |
-
<details><summary>For Windows users</summary>
|
374 |
-
|
375 |
-
If you want to enable the quantized LoRA (QLoRA) on the Windows platform, you need to install a pre-built version of `bitsandbytes` library, which supports CUDA 11.1 to 12.2, please select the appropriate [release version](https://github.com/jllllll/bitsandbytes-windows-webui/releases/tag/wheels) based on your CUDA version.
|
376 |
-
|
377 |
-
```bash
|
378 |
-
pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.2.post2-py3-none-win_amd64.whl
|
379 |
-
```
|
380 |
-
|
381 |
-
To enable FlashAttention-2 on the Windows platform, you need to install the precompiled `flash-attn` library, which supports CUDA 12.1 to 12.2. Please download the corresponding version from [flash-attention](https://github.com/bdashore3/flash-attention/releases) based on your requirements.
|
382 |
-
|
383 |
-
</details>
|
384 |
-
|
385 |
-
<details><summary>For Ascend NPU users</summary>
|
386 |
-
|
387 |
-
To install LLaMA Factory on Ascend NPU devices, please specify extra dependencies: `pip install -e ".[torch-npu,metrics]"`. Additionally, you need to install the **[Ascend CANN Toolkit and Kernels](https://www.hiascend.com/developer/download/community/result?module=cann)**. Please follow the [installation tutorial](https://www.hiascend.com/document/detail/en/CANNCommunityEdition/600alphaX/softwareinstall/instg/atlasdeploy_03_0031.html) or use the following commands:
|
388 |
-
|
389 |
-
```bash
|
390 |
-
# replace the url according to your CANN version and devices
|
391 |
-
# install CANN Toolkit
|
392 |
-
wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL%20V100R001C17SPC701/Ascend-cann-toolkit_8.0.RC1.alpha001_linux-"$(uname -i)".run
|
393 |
-
bash Ascend-cann-toolkit_8.0.RC1.alpha001_linux-"$(uname -i)".run --install
|
394 |
-
|
395 |
-
# install CANN Kernels
|
396 |
-
wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/Milan-ASL/Milan-ASL%20V100R001C17SPC701/Ascend-cann-kernels-910b_8.0.RC1.alpha001_linux.run
|
397 |
-
bash Ascend-cann-kernels-910b_8.0.RC1.alpha001_linux.run --install
|
398 |
-
|
399 |
-
# set env variables
|
400 |
-
source /usr/local/Ascend/ascend-toolkit/set_env.sh
|
401 |
-
```
|
402 |
-
|
403 |
-
| Requirement | Minimum | Recommend |
|
404 |
-
| ------------ | ------- | ----------- |
|
405 |
-
| CANN | 8.0.RC1 | 8.0.RC1 |
|
406 |
-
| torch | 2.1.0 | 2.1.0 |
|
407 |
-
| torch-npu | 2.1.0 | 2.1.0.post3 |
|
408 |
-
| deepspeed | 0.13.2 | 0.13.2 |
|
409 |
-
|
410 |
-
Remember to use `ASCEND_RT_VISIBLE_DEVICES` instead of `CUDA_VISIBLE_DEVICES` to specify the device to use.
|
411 |
-
|
412 |
-
If you cannot infer model on NPU devices, try setting `do_sample: false` in the configurations.
|
413 |
-
|
414 |
-
Download the pre-built Docker images: [32GB](http://mirrors.cn-central-221.ovaijisuan.com/detail/130.html) | [64GB](http://mirrors.cn-central-221.ovaijisuan.com/detail/131.html)
|
415 |
-
|
416 |
-
</details>
|
417 |
-
|
418 |
-
### Data Preparation
|
419 |
-
|
420 |
-
Please refer to [data/README.md](data/README.md) for checking the details about the format of dataset files. You can either use datasets on HuggingFace / ModelScope / Modelers hub or load the dataset in local disk.
|
421 |
-
|
422 |
-
> [!NOTE]
|
423 |
-
> Please update `data/dataset_info.json` to use your custom dataset.
|
424 |
-
|
425 |
-
### Quickstart
|
426 |
-
|
427 |
-
Use the following 3 commands to run LoRA **fine-tuning**, **inference** and **merging** of the Llama3-8B-Instruct model, respectively.
|
428 |
-
|
429 |
-
```bash
|
430 |
-
llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
|
431 |
-
llamafactory-cli chat examples/inference/llama3_lora_sft.yaml
|
432 |
-
llamafactory-cli export examples/merge_lora/llama3_lora_sft.yaml
|
433 |
-
```
|
434 |
-
|
435 |
-
See [examples/README.md](examples/README.md) for advanced usage (including distributed training).
|
436 |
-
|
437 |
-
> [!TIP]
|
438 |
-
> Use `llamafactory-cli help` to show help information.
|
439 |
-
|
440 |
-
### Fine-Tuning with LLaMA Board GUI (powered by [Gradio](https://github.com/gradio-app/gradio))
|
441 |
-
|
442 |
-
```bash
|
443 |
-
llamafactory-cli webui
|
444 |
-
```
|
445 |
-
|
446 |
-
### Build Docker
|
447 |
-
|
448 |
-
For CUDA users:
|
449 |
-
|
450 |
-
```bash
|
451 |
-
cd docker/docker-cuda/
|
452 |
-
docker compose up -d
|
453 |
-
docker compose exec llamafactory bash
|
454 |
-
```
|
455 |
-
|
456 |
-
For Ascend NPU users:
|
457 |
-
|
458 |
-
```bash
|
459 |
-
cd docker/docker-npu/
|
460 |
-
docker compose up -d
|
461 |
-
docker compose exec llamafactory bash
|
462 |
-
```
|
463 |
-
|
464 |
-
For AMD ROCm users:
|
465 |
-
|
466 |
-
```bash
|
467 |
-
cd docker/docker-rocm/
|
468 |
-
docker compose up -d
|
469 |
-
docker compose exec llamafactory bash
|
470 |
-
```
|
471 |
-
|
472 |
-
<details><summary>Build without Docker Compose</summary>
|
473 |
-
|
474 |
-
For CUDA users:
|
475 |
-
|
476 |
-
```bash
|
477 |
-
docker build -f ./docker/docker-cuda/Dockerfile \
|
478 |
-
--build-arg INSTALL_BNB=false \
|
479 |
-
--build-arg INSTALL_VLLM=false \
|
480 |
-
--build-arg INSTALL_DEEPSPEED=false \
|
481 |
-
--build-arg INSTALL_FLASHATTN=false \
|
482 |
-
--build-arg PIP_INDEX=https://pypi.org/simple \
|
483 |
-
-t llamafactory:latest .
|
484 |
-
|
485 |
-
docker run -dit --gpus=all \
|
486 |
-
-v ./hf_cache:/root/.cache/huggingface \
|
487 |
-
-v ./ms_cache:/root/.cache/modelscope \
|
488 |
-
-v ./om_cache:/root/.cache/openmind \
|
489 |
-
-v ./data:/app/data \
|
490 |
-
-v ./output:/app/output \
|
491 |
-
-p 7860:7860 \
|
492 |
-
-p 8000:8000 \
|
493 |
-
--shm-size 16G \
|
494 |
-
--name llamafactory \
|
495 |
-
llamafactory:latest
|
496 |
-
|
497 |
-
docker exec -it llamafactory bash
|
498 |
-
```
|
499 |
-
|
500 |
-
For Ascend NPU users:
|
501 |
-
|
502 |
-
```bash
|
503 |
-
# Choose docker image upon your environment
|
504 |
-
docker build -f ./docker/docker-npu/Dockerfile \
|
505 |
-
--build-arg INSTALL_DEEPSPEED=false \
|
506 |
-
--build-arg PIP_INDEX=https://pypi.org/simple \
|
507 |
-
-t llamafactory:latest .
|
508 |
-
|
509 |
-
# Change `device` upon your resources
|
510 |
-
docker run -dit \
|
511 |
-
-v ./hf_cache:/root/.cache/huggingface \
|
512 |
-
-v ./ms_cache:/root/.cache/modelscope \
|
513 |
-
-v ./om_cache:/root/.cache/openmind \
|
514 |
-
-v ./data:/app/data \
|
515 |
-
-v ./output:/app/output \
|
516 |
-
-v /usr/local/dcmi:/usr/local/dcmi \
|
517 |
-
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
|
518 |
-
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
|
519 |
-
-v /etc/ascend_install.info:/etc/ascend_install.info \
|
520 |
-
-p 7860:7860 \
|
521 |
-
-p 8000:8000 \
|
522 |
-
--device /dev/davinci0 \
|
523 |
-
--device /dev/davinci_manager \
|
524 |
-
--device /dev/devmm_svm \
|
525 |
-
--device /dev/hisi_hdc \
|
526 |
-
--shm-size 16G \
|
527 |
-
--name llamafactory \
|
528 |
-
llamafactory:latest
|
529 |
-
|
530 |
-
docker exec -it llamafactory bash
|
531 |
-
```
|
532 |
-
|
533 |
-
For AMD ROCm users:
|
534 |
-
|
535 |
-
```bash
|
536 |
-
docker build -f ./docker/docker-rocm/Dockerfile \
|
537 |
-
--build-arg INSTALL_BNB=false \
|
538 |
-
--build-arg INSTALL_VLLM=false \
|
539 |
-
--build-arg INSTALL_DEEPSPEED=false \
|
540 |
-
--build-arg INSTALL_FLASHATTN=false \
|
541 |
-
--build-arg PIP_INDEX=https://pypi.org/simple \
|
542 |
-
-t llamafactory:latest .
|
543 |
-
|
544 |
-
docker run -dit \
|
545 |
-
-v ./hf_cache:/root/.cache/huggingface \
|
546 |
-
-v ./ms_cache:/root/.cache/modelscope \
|
547 |
-
-v ./om_cache:/root/.cache/openmind \
|
548 |
-
-v ./data:/app/data \
|
549 |
-
-v ./output:/app/output \
|
550 |
-
-v ./saves:/app/saves \
|
551 |
-
-p 7860:7860 \
|
552 |
-
-p 8000:8000 \
|
553 |
-
--device /dev/kfd \
|
554 |
-
--device /dev/dri \
|
555 |
-
--shm-size 16G \
|
556 |
-
--name llamafactory \
|
557 |
-
llamafactory:latest
|
558 |
-
|
559 |
-
docker exec -it llamafactory bash
|
560 |
-
```
|
561 |
-
|
562 |
-
</details>
|
563 |
-
|
564 |
-
<details><summary>Details about volume</summary>
|
565 |
-
|
566 |
-
- `hf_cache`: Utilize Hugging Face cache on the host machine. Reassignable if a cache already exists in a different directory.
|
567 |
-
- `ms_cache`: Similar to Hugging Face cache but for ModelScope users.
|
568 |
-
- `om_cache`: Similar to Hugging Face cache but for Modelers users.
|
569 |
-
- `data`: Place datasets on this dir of the host machine so that they can be selected on LLaMA Board GUI.
|
570 |
-
- `output`: Set export dir to this location so that the merged result can be accessed directly on the host machine.
|
571 |
-
|
572 |
-
</details>
|
573 |
-
|
574 |
-
### Deploy with OpenAI-style API and vLLM
|
575 |
-
|
576 |
-
```bash
|
577 |
-
API_PORT=8000 llamafactory-cli api examples/inference/llama3_vllm.yaml
|
578 |
-
```
|
579 |
-
|
580 |
-
> [!TIP]
|
581 |
-
> Visit [this page](https://platform.openai.com/docs/api-reference/chat/create) for API document.
|
582 |
-
|
583 |
-
### Download from ModelScope Hub
|
584 |
-
|
585 |
-
If you have trouble with downloading models and datasets from Hugging Face, you can use ModelScope.
|
586 |
-
|
587 |
-
```bash
|
588 |
-
export USE_MODELSCOPE_HUB=1 # `set USE_MODELSCOPE_HUB=1` for Windows
|
589 |
-
```
|
590 |
-
|
591 |
-
Train the model by specifying a model ID of the ModelScope Hub as the `model_name_or_path`. You can find a full list of model IDs at [ModelScope Hub](https://modelscope.cn/models), e.g., `LLM-Research/Meta-Llama-3-8B-Instruct`.
|
592 |
-
|
593 |
-
### Download from Modelers Hub
|
594 |
-
|
595 |
-
You can also use Modelers Hub to download models and datasets.
|
596 |
-
|
597 |
-
```bash
|
598 |
-
export USE_OPENMIND_HUB=1 # `set USE_OPENMIND_HUB=1` for Windows
|
599 |
-
```
|
600 |
-
|
601 |
-
Train the model by specifying a model ID of the Modelers Hub as the `model_name_or_path`. You can find a full list of model IDs at [Modelers Hub](https://modelers.cn/models), e.g., `TeleAI/TeleChat-7B-pt`.
|
602 |
-
|
603 |
-
### Use W&B Logger
|
604 |
-
|
605 |
-
To use [Weights & Biases](https://wandb.ai) for logging experimental results, you need to add the following arguments to yaml files.
|
606 |
-
|
607 |
-
```yaml
|
608 |
-
report_to: wandb
|
609 |
-
run_name: test_run # optional
|
610 |
-
```
|
611 |
-
|
612 |
-
Set `WANDB_API_KEY` to [your key](https://wandb.ai/authorize) when launching training tasks to log in with your W&B account.
|
613 |
-
|
614 |
-
## Projects using LLaMA Factory
|
615 |
-
|
616 |
-
If you have a project that should be incorporated, please contact via email or create a pull request.
|
617 |
-
|
618 |
-
<details><summary>Click to show</summary>
|
619 |
-
|
620 |
-
1. Wang et al. ESRL: Efficient Sampling-based Reinforcement Learning for Sequence Generation. 2023. [[arxiv]](https://arxiv.org/abs/2308.02223)
|
621 |
-
1. Yu et al. Open, Closed, or Small Language Models for Text Classification? 2023. [[arxiv]](https://arxiv.org/abs/2308.10092)
|
622 |
-
1. Wang et al. UbiPhysio: Support Daily Functioning, Fitness, and Rehabilitation with Action Understanding and Feedback in Natural Language. 2023. [[arxiv]](https://arxiv.org/abs/2308.10526)
|
623 |
-
1. Luceri et al. Leveraging Large Language Models to Detect Influence Campaigns in Social Media. 2023. [[arxiv]](https://arxiv.org/abs/2311.07816)
|
624 |
-
1. Zhang et al. Alleviating Hallucinations of Large Language Models through Induced Hallucinations. 2023. [[arxiv]](https://arxiv.org/abs/2312.15710)
|
625 |
-
1. Wang et al. Know Your Needs Better: Towards Structured Understanding of Marketer Demands with Analogical Reasoning Augmented LLMs. KDD 2024. [[arxiv]](https://arxiv.org/abs/2401.04319)
|
626 |
-
1. Wang et al. CANDLE: Iterative Conceptualization and Instantiation Distillation from Large Language Models for Commonsense Reasoning. ACL 2024. [[arxiv]](https://arxiv.org/abs/2401.07286)
|
627 |
-
1. Choi et al. FACT-GPT: Fact-Checking Augmentation via Claim Matching with LLMs. 2024. [[arxiv]](https://arxiv.org/abs/2402.05904)
|
628 |
-
1. Zhang et al. AutoMathText: Autonomous Data Selection with Language Models for Mathematical Texts. 2024. [[arxiv]](https://arxiv.org/abs/2402.07625)
|
629 |
-
1. Lyu et al. KnowTuning: Knowledge-aware Fine-tuning for Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2402.11176)
|
630 |
-
1. Yang et al. LaCo: Large Language Model Pruning via Layer Collaps. 2024. [[arxiv]](https://arxiv.org/abs/2402.11187)
|
631 |
-
1. Bhardwaj et al. Language Models are Homer Simpson! Safety Re-Alignment of Fine-tuned Language Models through Task Arithmetic. 2024. [[arxiv]](https://arxiv.org/abs/2402.11746)
|
632 |
-
1. Yang et al. Enhancing Empathetic Response Generation by Augmenting LLMs with Small-scale Empathetic Models. 2024. [[arxiv]](https://arxiv.org/abs/2402.11801)
|
633 |
-
1. Yi et al. Generation Meets Verification: Accelerating Large Language Model Inference with Smart Parallel Auto-Correct Decoding. ACL 2024 Findings. [[arxiv]](https://arxiv.org/abs/2402.11809)
|
634 |
-
1. Cao et al. Head-wise Shareable Attention for Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2402.11819)
|
635 |
-
1. Zhang et al. Enhancing Multilingual Capabilities of Large Language Models through Self-Distillation from Resource-Rich Languages. 2024. [[arxiv]](https://arxiv.org/abs/2402.12204)
|
636 |
-
1. Kim et al. Efficient and Effective Vocabulary Expansion Towards Multilingual Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2402.14714)
|
637 |
-
1. Yu et al. KIEval: A Knowledge-grounded Interactive Evaluation Framework for Large Language Models. ACL 2024. [[arxiv]](https://arxiv.org/abs/2402.15043)
|
638 |
-
1. Huang et al. Key-Point-Driven Data Synthesis with its Enhancement on Mathematical Reasoning. 2024. [[arxiv]](https://arxiv.org/abs/2403.02333)
|
639 |
-
1. Duan et al. Negating Negatives: Alignment without Human Positive Samples via Distributional Dispreference Optimization. 2024. [[arxiv]](https://arxiv.org/abs/2403.03419)
|
640 |
-
1. Xie and Schwertfeger. Empowering Robotics with Large Language Models: osmAG Map Comprehension with LLMs. 2024. [[arxiv]](https://arxiv.org/abs/2403.08228)
|
641 |
-
1. Wu et al. Large Language Models are Parallel Multilingual Learners. 2024. [[arxiv]](https://arxiv.org/abs/2403.09073)
|
642 |
-
1. Zhang et al. EDT: Improving Large Language Models' Generation by Entropy-based Dynamic Temperature Sampling. 2024. [[arxiv]](https://arxiv.org/abs/2403.14541)
|
643 |
-
1. Weller et al. FollowIR: Evaluating and Teaching Information Retrieval Models to Follow Instructions. 2024. [[arxiv]](https://arxiv.org/abs/2403.15246)
|
644 |
-
1. Hongbin Na. CBT-LLM: A Chinese Large Language Model for Cognitive Behavioral Therapy-based Mental Health Question Answering. COLING 2024. [[arxiv]](https://arxiv.org/abs/2403.16008)
|
645 |
-
1. Zan et al. CodeS: Natural Language to Code Repository via Multi-Layer Sketch. 2024. [[arxiv]](https://arxiv.org/abs/2403.16443)
|
646 |
-
1. Liu et al. Extensive Self-Contrast Enables Feedback-Free Language Model Alignment. 2024. [[arxiv]](https://arxiv.org/abs/2404.00604)
|
647 |
-
1. Luo et al. BAdam: A Memory Efficient Full Parameter Training Method for Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2404.02827)
|
648 |
-
1. Du et al. Chinese Tiny LLM: Pretraining a Chinese-Centric Large Language Model. 2024. [[arxiv]](https://arxiv.org/abs/2404.04167)
|
649 |
-
1. Ma et al. Parameter Efficient Quasi-Orthogonal Fine-Tuning via Givens Rotation. ICML 2024. [[arxiv]](https://arxiv.org/abs/2404.04316)
|
650 |
-
1. Liu et al. Dynamic Generation of Personalities with Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2404.07084)
|
651 |
-
1. Shang et al. How Far Have We Gone in Stripped Binary Code Understanding Using Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2404.09836)
|
652 |
-
1. Huang et al. LLMTune: Accelerate Database Knob Tuning with Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2404.11581)
|
653 |
-
1. Deng et al. Text-Tuple-Table: Towards Information Integration in Text-to-Table Generation via Global Tuple Extraction. 2024. [[arxiv]](https://arxiv.org/abs/2404.14215)
|
654 |
-
1. Acikgoz et al. Hippocrates: An Open-Source Framework for Advancing Large Language Models in Healthcare. 2024. [[arxiv]](https://arxiv.org/abs/2404.16621)
|
655 |
-
1. Zhang et al. Small Language Models Need Strong Verifiers to Self-Correct Reasoning. ACL 2024 Findings. [[arxiv]](https://arxiv.org/abs/2404.17140)
|
656 |
-
1. Zhou et al. FREB-TQA: A Fine-Grained Robustness Evaluation Benchmark for Table Question Answering. NAACL 2024. [[arxiv]](https://arxiv.org/abs/2404.18585)
|
657 |
-
1. Xu et al. Large Language Models for Cyber Security: A Systematic Literature Review. 2024. [[arxiv]](https://arxiv.org/abs/2405.04760)
|
658 |
-
1. Dammu et al. "They are uncultured": Unveiling Covert Harms and Social Threats in LLM Generated Conversations. 2024. [[arxiv]](https://arxiv.org/abs/2405.05378)
|
659 |
-
1. Yi et al. A safety realignment framework via subspace-oriented model fusion for large language models. 2024. [[arxiv]](https://arxiv.org/abs/2405.09055)
|
660 |
-
1. Lou et al. SPO: Multi-Dimensional Preference Sequential Alignment With Implicit Reward Modeling. 2024. [[arxiv]](https://arxiv.org/abs/2405.12739)
|
661 |
-
1. Zhang et al. Getting More from Less: Large Language Models are Good Spontaneous Multilingual Learners. 2024. [[arxiv]](https://arxiv.org/abs/2405.13816)
|
662 |
-
1. Zhang et al. TS-Align: A Teacher-Student Collaborative Framework for Scalable Iterative Finetuning of Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2405.20215)
|
663 |
-
1. Zihong Chen. Sentence Segmentation and Sentence Punctuation Based on XunziALLM. 2024. [[paper]](https://aclanthology.org/2024.lt4hala-1.30)
|
664 |
-
1. Gao et al. The Best of Both Worlds: Toward an Honest and Helpful Large Language Model. 2024. [[arxiv]](https://arxiv.org/abs/2406.00380)
|
665 |
-
1. Wang and Song. MARS: Benchmarking the Metaphysical Reasoning Abilities of Language Models with a Multi-task Evaluation Dataset. 2024. [[arxiv]](https://arxiv.org/abs/2406.02106)
|
666 |
-
1. Hu et al. Computational Limits of Low-Rank Adaptation (LoRA) for Transformer-Based Models. 2024. [[arxiv]](https://arxiv.org/abs/2406.03136)
|
667 |
-
1. Ge et al. Time Sensitive Knowledge Editing through Efficient Finetuning. ACL 2024. [[arxiv]](https://arxiv.org/abs/2406.04496)
|
668 |
-
1. Tan et al. Peer Review as A Multi-Turn and Long-Context Dialogue with Role-Based Interactions. 2024. [[arxiv]](https://arxiv.org/abs/2406.05688)
|
669 |
-
1. Song et al. Turbo Sparse: Achieving LLM SOTA Performance with Minimal Activated Parameters. 2024. [[arxiv]](https://arxiv.org/abs/2406.05955)
|
670 |
-
1. Gu et al. RWKV-CLIP: A Robust Vision-Language Representation Learner. 2024. [[arxiv]](https://arxiv.org/abs/2406.06973)
|
671 |
-
1. Chen et al. Advancing Tool-Augmented Large Language Models: Integrating Insights from Errors in Inference Trees. 2024. [[arxiv]](https://arxiv.org/abs/2406.07115)
|
672 |
-
1. Zhu et al. Are Large Language Models Good Statisticians?. 2024. [[arxiv]](https://arxiv.org/abs/2406.07815)
|
673 |
-
1. Li et al. Know the Unknown: An Uncertainty-Sensitive Method for LLM Instruction Tuning. 2024. [[arxiv]](https://arxiv.org/abs/2406.10099)
|
674 |
-
1. Ding et al. IntentionQA: A Benchmark for Evaluating Purchase Intention Comprehension Abilities of Language Models in E-commerce. 2024. [[arxiv]](https://arxiv.org/abs/2406.10173)
|
675 |
-
1. He et al. COMMUNITY-CROSS-INSTRUCT: Unsupervised Instruction Generation for Aligning Large Language Models to Online Communities. 2024. [[arxiv]](https://arxiv.org/abs/2406.12074)
|
676 |
-
1. Lin et al. FVEL: Interactive Formal Verification Environment with Large Language Models via Theorem Proving. 2024. [[arxiv]](https://arxiv.org/abs/2406.14408)
|
677 |
-
1. Treutlein et al. Connecting the Dots: LLMs can Infer and Verbalize Latent Structure from Disparate Training Data. 2024. [[arxiv]](https://arxiv.org/abs/2406.14546)
|
678 |
-
1. Feng et al. SS-Bench: A Benchmark for Social Story Generation and Evaluation. 2024. [[arxiv]](https://arxiv.org/abs/2406.15695)
|
679 |
-
1. Feng et al. Self-Constructed Context Decompilation with Fined-grained Alignment Enhancement. 2024. [[arxiv]](https://arxiv.org/abs/2406.17233)
|
680 |
-
1. Liu et al. Large Language Models for Cuffless Blood Pressure Measurement From Wearable Biosignals. 2024. [[arxiv]](https://arxiv.org/abs/2406.18069)
|
681 |
-
1. Iyer et al. Exploring Very Low-Resource Translation with LLMs: The University of Edinburgh's Submission to AmericasNLP 2024 Translation Task. AmericasNLP 2024. [[paper]](https://aclanthology.org/2024.americasnlp-1.25)
|
682 |
-
1. Li et al. Calibrating LLMs with Preference Optimization on Thought Trees for Generating Rationale in Science Question Scoring. 2024. [[arxiv]](https://arxiv.org/abs/2406.19949)
|
683 |
-
1. Yang et al. Financial Knowledge Large Language Model. 2024. [[arxiv]](https://arxiv.org/abs/2407.00365)
|
684 |
-
1. Lin et al. DogeRM: Equipping Reward Models with Domain Knowledge through Model Merging. 2024. [[arxiv]](https://arxiv.org/abs/2407.01470)
|
685 |
-
1. Bako et al. Evaluating the Semantic Profiling Abilities of LLMs for Natural Language Utterances in Data Visualization. 2024. [[arxiv]](https://arxiv.org/abs/2407.06129)
|
686 |
-
1. Huang et al. RoLoRA: Fine-tuning Rotated Outlier-free LLMs for Effective Weight-Activation Quantization. 2024. [[arxiv]](https://arxiv.org/abs/2407.08044)
|
687 |
-
1. Jiang et al. LLM-Collaboration on Automatic Science Journalism for the General Audience. 2024. [[arxiv]](https://arxiv.org/abs/2407.09756)
|
688 |
-
1. Inouye et al. Applied Auto-tuning on LoRA Hyperparameters. 2024. [[paper]](https://scholarcommons.scu.edu/cseng_senior/272/)
|
689 |
-
1. Qi et al. Research on Tibetan Tourism Viewpoints information generation system based on LLM. 2024. [[arxiv]](https://arxiv.org/abs/2407.13561)
|
690 |
-
1. Xu et al. Course-Correction: Safety Alignment Using Synthetic Preferences. 2024. [[arxiv]](https://arxiv.org/abs/2407.16637)
|
691 |
-
1. Sun et al. LAMBDA: A Large Model Based Data Agent. 2024. [[arxiv]](https://arxiv.org/abs/2407.17535)
|
692 |
-
1. Zhu et al. CollectiveSFT: Scaling Large Language Models for Chinese Medical Benchmark with Collective Instructions in Healthcare. 2024. [[arxiv]](https://arxiv.org/abs/2407.19705)
|
693 |
-
1. Yu et al. Correcting Negative Bias in Large Language Models through Negative Attention Score Alignment. 2024. [[arxiv]](https://arxiv.org/abs/2408.00137)
|
694 |
-
1. Xie et al. The Power of Personalized Datasets: Advancing Chinese Composition Writing for Elementary School through Targeted Model Fine-Tuning. IALP 2024. [[paper]](https://www.asianlp.sg/conferences/ialp2024/proceedings/papers/IALP2024_P055.pdf)
|
695 |
-
1. Liu et al. Instruct-Code-Llama: Improving Capabilities of Language Model in Competition Level Code Generation by Online Judge Feedback. ICIC 2024. [[paper]](https://link.springer.com/chapter/10.1007/978-981-97-5669-8_11)
|
696 |
-
1. Wang et al. Cybernetic Sentinels: Unveiling the Impact of Safety Data Selection on Model Security in Supervised Fine-Tuning. ICIC 2024. [[paper]](https://link.springer.com/chapter/10.1007/978-981-97-5669-8_23)
|
697 |
-
1. Xia et al. Understanding the Performance and Estimating the Cost of LLM Fine-Tuning. 2024. [[arxiv]](https://arxiv.org/abs/2408.04693)
|
698 |
-
1. Zeng et al. Perceive, Reflect, and Plan: Designing LLM Agent for Goal-Directed City Navigation without Instructions. 2024. [[arxiv]](https://arxiv.org/abs/2408.04168)
|
699 |
-
1. Xia et al. Using Pre-trained Language Model for Accurate ESG Prediction. FinNLP 2024. [[paper]](https://aclanthology.org/2024.finnlp-2.1/)
|
700 |
-
1. Liang et al. I-SHEEP: Self-Alignment of LLM from Scratch through an Iterative Self-Enhancement Paradigm. 2024. [[arxiv]](https://arxiv.org/abs/2408.08072)
|
701 |
-
1. **[StarWhisper](https://github.com/Yu-Yang-Li/StarWhisper)**: A large language model for Astronomy, based on ChatGLM2-6B and Qwen-14B.
|
702 |
-
1. **[DISC-LawLLM](https://github.com/FudanDISC/DISC-LawLLM)**: A large language model specialized in Chinese legal domain, based on Baichuan-13B, is capable of retrieving and reasoning on legal knowledge.
|
703 |
-
1. **[Sunsimiao](https://github.com/X-D-Lab/Sunsimiao)**: A large language model specialized in Chinese medical domain, based on Baichuan-7B and ChatGLM-6B.
|
704 |
-
1. **[CareGPT](https://github.com/WangRongsheng/CareGPT)**: A series of large language models for Chinese medical domain, based on LLaMA2-7B and Baichuan-13B.
|
705 |
-
1. **[MachineMindset](https://github.com/PKU-YuanGroup/Machine-Mindset/)**: A series of MBTI Personality large language models, capable of giving any LLM 16 different personality types based on different datasets and training methods.
|
706 |
-
1. **[Luminia-13B-v3](https://huggingface.co/Nekochu/Luminia-13B-v3)**: A large language model specialized in generate metadata for stable diffusion. [[🤗Demo]](https://huggingface.co/spaces/Nekochu/Luminia-13B_SD_Prompt)
|
707 |
-
1. **[Chinese-LLaVA-Med](https://github.com/BUAADreamer/Chinese-LLaVA-Med)**: A multimodal large language model specialized in Chinese medical domain, based on LLaVA-1.5-7B.
|
708 |
-
1. **[AutoRE](https://github.com/THUDM/AutoRE)**: A document-level relation extraction system based on large language models.
|
709 |
-
1. **[NVIDIA RTX AI Toolkit](https://github.com/NVIDIA/RTX-AI-Toolkit)**: SDKs for fine-tuning LLMs on Windows PC for NVIDIA RTX.
|
710 |
-
1. **[LazyLLM](https://github.com/LazyAGI/LazyLLM)**: An easy and lazy way for building multi-agent LLMs applications and supports model fine-tuning via LLaMA Factory.
|
711 |
-
|
712 |
-
</details>
|
713 |
-
|
714 |
-
## License
|
715 |
-
|
716 |
-
This repository is licensed under the [Apache-2.0 License](LICENSE).
|
717 |
-
|
718 |
-
Please follow the model licenses to use the corresponding model weights: [Baichuan 2](https://huggingface.co/baichuan-inc/Baichuan2-7B-Base/blob/main/Community%20License%20for%20Baichuan%202%20Model.pdf) / [BLOOM](https://huggingface.co/spaces/bigscience/license) / [ChatGLM3](https://github.com/THUDM/ChatGLM3/blob/main/MODEL_LICENSE) / [Command R](https://cohere.com/c4ai-cc-by-nc-license) / [DeepSeek](https://github.com/deepseek-ai/DeepSeek-LLM/blob/main/LICENSE-MODEL) / [Falcon](https://huggingface.co/tiiuae/falcon-180B/blob/main/LICENSE.txt) / [Gemma](https://ai.google.dev/gemma/terms) / [GLM-4](https://huggingface.co/THUDM/glm-4-9b/blob/main/LICENSE) / [InternLM2](https://github.com/InternLM/InternLM#license) / [Llama](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md) / [Llama 2 (LLaVA-1.5)](https://ai.meta.com/llama/license/) / [Llama 3](https://llama.meta.com/llama3/license/) / [MiniCPM](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md) / [Mistral](LICENSE) / [OLMo](LICENSE) / [Phi-1.5/Phi-2](https://huggingface.co/microsoft/phi-1_5/resolve/main/Research%20License.docx) / [Phi-3](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct/blob/main/LICENSE) / [Qwen](https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT) / [StarCoder 2](https://huggingface.co/spaces/bigcode/bigcode-model-license-agreement) / [XVERSE](https://github.com/xverse-ai/XVERSE-13B/blob/main/MODEL_LICENSE.pdf) / [Yi](https://huggingface.co/01-ai/Yi-6B/blob/main/LICENSE) / [Yi-1.5](LICENSE) / [Yuan 2](https://github.com/IEIT-Yuan/Yuan-2.0/blob/main/LICENSE-Yuan)
|
719 |
-
|
720 |
-
## Citation
|
721 |
-
|
722 |
-
If this work is helpful, please kindly cite as:
|
723 |
-
|
724 |
-
```bibtex
|
725 |
-
@inproceedings{zheng2024llamafactory,
|
726 |
-
title={LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models},
|
727 |
-
author={Yaowei Zheng and Richong Zhang and Junhao Zhang and Yanhan Ye and Zheyan Luo and Zhangchi Feng and Yongqiang Ma},
|
728 |
-
booktitle={Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations)},
|
729 |
-
address={Bangkok, Thailand},
|
730 |
-
publisher={Association for Computational Linguistics},
|
731 |
-
year={2024},
|
732 |
-
url={http://arxiv.org/abs/2403.13372}
|
733 |
-
}
|
734 |
-
```
|
735 |
-
|
736 |
-
## Acknowledgement
|
737 |
-
|
738 |
-
This repo benefits from [PEFT](https://github.com/huggingface/peft), [TRL](https://github.com/huggingface/trl), [QLoRA](https://github.com/artidoro/qlora) and [FastChat](https://github.com/lm-sys/FastChat). Thanks for their wonderful works.
|
739 |
-
|
740 |
-
## Star History
|
741 |
-
|
742 |
-

|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
library_name: transformers
|
4 |
+
pipeline_tag: text-generation
|
5 |
+
---
|
6 |
+
|
7 |

|
8 |
|
9 |
+
This repository provides the codebase as presented in [Autonomous Data Selection with Language Models for Mathematical Texts](https://huggingface.co/papers/2402.07625).
|
10 |
+
|
11 |
[](https://github.com/hiyouga/LLaMA-Factory/stargazers)
|
12 |
[](LICENSE)
|
13 |
[](https://github.com/hiyouga/LLaMA-Factory/commits/main)
|
14 |
[](https://pypi.org/project/llamafactory/)
|
15 |
+
[](#projects-using-llama-factory)
|
16 |
[](https://github.com/hiyouga/LLaMA-Factory/pulls)
|
17 |
[](https://discord.gg/rKfvV9r9FK)
|
18 |
[](https://twitter.com/llamafactory_ai)
|
|
|
95 |
|
96 |
<details><summary>Full Changelog</summary>
|
97 |
|
98 |
+
[24/07/04] We supported [contamination-free packed training](https://github.com/MeetKai/functionary/tree/main/functionary/train/packing). Use `neat_packing: true` to activate it. Thank [@chuan298](https://github.com/chuan298)'s PR.
|
99 |
|
100 |
+
[24/06/16] We supported **[PiSSA](https://arxiv.org/abs/2404.02948)** algorithm. See [examples](examples/README.md) for usage.
|
101 |
|
102 |
[24/06/07] We supported fine-tuning the **[Qwen2](https://qwenlm.github.io/blog/qwen2/)** and **[GLM-4](https://github.com/THUDM/GLM-4)** models.
|
103 |
|
|
|
141 |
|
142 |
[23/12/23] We supported **[unsloth](https://github.com/unslothai/unsloth)**'s implementation to boost LoRA tuning for the LLaMA, Mistral and Yi models. Try `use_unsloth: true` argument to activate unsloth patch. It achieves **170%** speed in our benchmark, check [this page](https://github.com/hiyouga/LLaMA-Factory/wiki/Performance-comparison) for details.
|
143 |
|
144 |
+
[23/12/12] We supported fine-tuning the latest MoE model **[Mixtral 8x7B](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1)** in our framework. See hardware requirement [here](#hardware-requirement).\n
|
|
|
145 |
[23/12/01] We supported downloading pre-trained models and datasets from the **[ModelScope Hub](https://modelscope.cn/models)**. See [this tutorial](#download-from-modelscope-hub) for usage.
|
146 |
|
147 |
[23/10/21] We supported **[NEFTune](https://arxiv.org/abs/2310.05914)** trick for fine-tuning. Try `neftune_noise_alpha: 5` argument to activate NEFTune.
|
|
|
162 |
|
163 |
[23/07/18] We developed an **all-in-one Web UI** for training, evaluation and inference. Try `train_web.py` to fine-tune models in your Web browser. Thank [@KanadeSiina](https://github.com/KanadeSiina) and [@codemayq](https://github.com/codemayq) for their efforts in the development.
|
164 |
|
165 |
+
[23/07/09] We released **[FastEdit](https://github.com/hiyouga/FastEdit)** ⚡ 🩹, an easy-to-use package for editing the factual knowledge of large language models efficiently. Please follow [FastEdit](https://github.com/hiyouga/FastEdit) if you are interested.
|
166 |
|
167 |
[23/06/29] We provided a **reproducible example** of training a chat model using instruction-following datasets, see [Baichuan-7B-sft](https://huggingface.co/hiyouga/Baichuan-7B-sft) for details.
|
168 |
|
169 |
+
[23/06/22] We aligned the [demo API](src/api_demo.py) with the [OpenAI's](https://platform.openai.com/docs/api-reference/chat/create) format where you can insert the fine-tuned model in **arbitrary ChatGPT-based applications**.
|
170 |
|
171 |
[23/06/03] We supported quantized training and inference (aka **[QLoRA](https://github.com/artidoro/qlora)**). See [examples](examples/README.md) for usage.
|
172 |
|
|
|
174 |
|
175 |
## Supported Models
|
176 |
|
177 |
+
| Model | Model size | Template |
|
178 |
+
| ----------------------------------------------------------------- | -------------------------------- | ------------------- |
|
179 |
+
| [Baichuan 2](https://huggingface.co/baichuan-inc) | 7B/13B | baichuan2 |
|
180 |
+
| [BLOOM/BLOOMZ](https://huggingface.co/bigscience) | 560M/1.1B/1.7B/3B/7.1B/176B | - |
|
181 |
+
| [ChatGLM3](https://huggingface.co/THUDM) | 6B | chatglm3 |
|
182 |
+
| [Command R](https://huggingface.co/CohereForAI) | 35B/104B | cohere |
|
183 |
+
| [DeepSeek (Code/MoE)](https://huggingface.co/deepseek-ai) | 7B/16B/67B/236B | deepseek |
|
184 |
+
| [Falcon](https://huggingface.co/tiiuae) | 7B/11B/40B/180B | falcon |
|
185 |
+
| [Gemma/Gemma 2/CodeGemma](https://huggingface.co/google) | 2B/7B/9B/27B | gemma |
|
186 |
+
| [GLM-4](https://huggingface.co/THUDM) | 9B | glm4 |
|
187 |
+
| [Llama](https://github.com/facebookresearch/llama) | 7B/13B/33B/65B | - |
|
188 |
+
| [Llama 2](https://huggingface.co/meta-llama) | 7B/13B/70B | llama2 |
|
189 |
+
| [Llama 3](https://huggingface.co/meta-llama) | 8B/70B | llama3 |
|
190 |
+
| [LLaVA-1.5](https://huggingface.co/llava-hf) | 7B/13B | llava |
|
191 |
+
| [LLaVA-NeXT](https://huggingface.co/llava-hf) | 7B/8B/13B/34B/72B/110B | llava_next |
|
192 |
+
| [LLaVA-NeXT-Video](https://huggingface.co/llava-hf) | 7B/34B | llava_next_video |
|
193 |
+
| [MiniCPM](https://huggingface.co/openbmb) | 1B/2B/4B | cpm/cpm3 |
|
194 |
+
| [Mistral/Mixtral](https://huggingface.co/mistralai) | 7B/8x7B/8x22B | mistral |
|
195 |
+
| [OLMo](https://huggingface.co/allenai) | 1B/7B | - |
|
196 |
+
| [PaliGemma](https://huggingface.co/google) | 3B | paligemma |
|
197 |
+
| [Phi-1.5/Phi-2](https://huggingface.co/microsoft) | 1.3B/2.7B | - |
|
198 |
+
| [Qwen (1-2.5) (Code/Math/MoE)](https://huggingface.co/Qwen) | 0.5B/1.5B/3B/7B/14B/32B/72B/110B | qwen |
|
199 |
+
| [StarCoder 2](https://huggingface.co/bigcode) | 3B/7B/15B | - |
|
200 |
+
| [XVERSE](https://huggingface.co/xverse) | 7B/13B/65B | xverse |
|
201 |
+
| [Yi/Yi-1.5 (Code)](https://huggingface.co/01-ai) | 1.5B/6B/9B/34B | yi |
|
202 |
+
| [Yi-VL](https://huggingface.co/01-ai) | 6B/34B | yi_vl |
|
203 |
+
| [Yuan 2](https://huggingface.co/IEITYuan) | 2B/51B/102B | yuan |
|
|
|
|
|
|
|
204 |
|
205 |
> [!NOTE]
|
206 |
> For the "base" models, the `template` argument can be chosen from `default`, `alpaca`, `vicuna` etc. But make sure to use the **corresponding template** for the "instruct/chat" models.
|
|
|
284 |
- [STEM (zh)](https://huggingface.co/datasets/hfl/stem_zh_instruction)
|
285 |
- [Ruozhiba (zh)](https://huggingface.co/datasets/hfl/ruozhiba_gpt4_turbo)
|
286 |
- [Neo-sft (zh)](https://huggingface.co/datasets/m-a-p/neo_sft_phase2)
|
|
|
287 |
- [Magpie-Pro-300K-Filtered (en)](https://huggingface.co/datasets/Magpie-Align/Magpie-Pro-300K-Filtered)
|
288 |
- [Magpie-ultra-v0.1 (en)](https://huggingface.co/datasets/argilla/magpie-ultra-v0.1)
|
289 |
+
- [WebInstructSub (en)](https://huggingface.co/datasets/TIGER-Lab/WebInstructSub)
|
290 |
- [LLaVA mixed (en&zh)](https://huggingface.co/datasets/BUAADreamer/llava-en-zh-300k)
|
291 |
- [Pokemon-gpt4o-captions (en&zh)](https://huggingface.co/datasets/jugg1024/pokemon-gpt4o-captions)
|
292 |
- [Open Assistant (de)](https://huggingface.co/datasets/mayflowergmbh/oasst_de)
|
|
|
294 |
- [Alpaca GPT4 (de)](https://huggingface.co/datasets/mayflowergmbh/alpaca-gpt4_de)
|
295 |
- [OpenSchnabeltier (de)](https://huggingface.co/datasets/mayflowergmbh/openschnabeltier_de)
|
296 |
- [Evol Instruct (de)](https://huggingface.co/datasets/mayflowergmbh/evol-instruct_de)
|
297 |
+
- [Dolphin (de)](https://huggingface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|