atad-tokyo commited on
Commit
538bdce
·
verified ·
1 Parent(s): 41be6d1

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. LLaMA-Factory/.github/CODE_OF_CONDUCT.md +128 -0
  2. LLaMA-Factory/.github/CONTRIBUTING.md +67 -0
  3. LLaMA-Factory/.github/ISSUE_TEMPLATE/1-bug-report.yml +61 -0
  4. LLaMA-Factory/.github/ISSUE_TEMPLATE/2-feature-request.yml +41 -0
  5. LLaMA-Factory/.github/ISSUE_TEMPLATE/config.yml +8 -0
  6. LLaMA-Factory/.github/PULL_REQUEST_TEMPLATE.md +8 -0
  7. LLaMA-Factory/.github/SECURITY.md +7 -0
  8. LLaMA-Factory/.github/workflows/docker.yml +126 -0
  9. LLaMA-Factory/.github/workflows/label_issue.yml +32 -0
  10. LLaMA-Factory/.github/workflows/publish.yml +36 -0
  11. LLaMA-Factory/.github/workflows/tests.yml +106 -0
  12. LLaMA-Factory/.github/workflows/tests_npu.yml +87 -0
  13. LLaMA-Factory/README_zh.md +979 -0
  14. LLaMA-Factory/assets/sponsors/serpapi.svg +1 -0
  15. LLaMA-Factory/assets/thirdparty/colab.svg +1 -0
  16. LLaMA-Factory/assets/thirdparty/discord.svg +1 -0
  17. LLaMA-Factory/assets/thirdparty/dsw.svg +92 -0
  18. LLaMA-Factory/assets/thirdparty/lab4ai.svg +536 -0
  19. LLaMA-Factory/assets/thirdparty/online.svg +789 -0
  20. LLaMA-Factory/data/README.md +475 -0
  21. LLaMA-Factory/data/README_zh.md +478 -0
  22. LLaMA-Factory/data/alpaca_en_demo.json +0 -0
  23. LLaMA-Factory/data/alpaca_zh_demo.json +0 -0
  24. LLaMA-Factory/data/c4_demo.jsonl +0 -0
  25. LLaMA-Factory/data/dataset_info.json +734 -0
  26. LLaMA-Factory/data/dpo_en_demo.json +0 -0
  27. LLaMA-Factory/data/dpo_zh_demo.json +0 -0
  28. LLaMA-Factory/data/glaive_toolcall_en_demo.json +0 -0
  29. LLaMA-Factory/data/glaive_toolcall_zh_demo.json +0 -0
  30. LLaMA-Factory/data/identity.json +457 -0
  31. LLaMA-Factory/data/kto_en_demo.json +0 -0
  32. LLaMA-Factory/data/mllm_audio_demo.json +47 -0
  33. LLaMA-Factory/data/mllm_demo.json +142 -0
  34. LLaMA-Factory/data/mllm_video_audio_demo.json +56 -0
  35. LLaMA-Factory/data/mllm_video_demo.json +47 -0
  36. LLaMA-Factory/data/reason_tool_use_demo_50.jsonl +0 -0
  37. LLaMA-Factory/data/v1_dpo_demo.jsonl +10 -0
  38. LLaMA-Factory/data/v1_dpo_demo.yaml +4 -0
  39. LLaMA-Factory/data/v1_sft_demo.jsonl +0 -0
  40. LLaMA-Factory/data/v1_sft_demo.yaml +9 -0
  41. LLaMA-Factory/data/wiki_demo.txt +0 -0
  42. LLaMA-Factory/docker/docker-cuda/Dockerfile +66 -0
  43. LLaMA-Factory/docker/docker-cuda/Dockerfile.megatron +77 -0
  44. LLaMA-Factory/docker/docker-cuda/README.md +111 -0
  45. LLaMA-Factory/docker/docker-cuda/docker-compose.yml +25 -0
  46. LLaMA-Factory/docker/docker-npu/Dockerfile +64 -0
  47. LLaMA-Factory/docker/docker-npu/docker-compose.yml +60 -0
  48. LLaMA-Factory/docker/docker-rocm/Dockerfile +77 -0
  49. LLaMA-Factory/docker/docker-rocm/docker-compose.yml +21 -0
  50. LLaMA-Factory/examples/README.md +304 -0
LLaMA-Factory/.github/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ `hoshihiyouga AT gmail DOT com`.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
LLaMA-Factory/.github/CONTRIBUTING.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to LLaMA Factory
2
+
3
+ Everyone is welcome to contribute, and we value everybody's contribution. Code contributions are not the only way to help the community. Answering questions, helping others, and improving the documentation are also immensely valuable.
4
+
5
+ It also helps us if you spread the word! Reference the library in blog posts about the awesome projects it made possible, shout out on Twitter every time it has helped you, or simply ⭐️ the repository to say thank you.
6
+
7
+ However you choose to contribute, please be mindful and respect our [code of conduct](CODE_OF_CONDUCT.md).
8
+
9
+ **This guide was heavily inspired by [transformers guide to contributing](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md).**
10
+
11
+ ## Ways to contribute
12
+
13
+ There are several ways you can contribute to LLaMA Factory:
14
+
15
+ * Fix outstanding issues with the existing code.
16
+ * Submit issues related to bugs or desired new features.
17
+ * Contribute to the examples or to the documentation.
18
+
19
+ ### Style guide
20
+
21
+ LLaMA Factory follows the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html), check it for details.
22
+
23
+ ### Create a Pull Request
24
+
25
+ 1. Fork the [repository](https://github.com/hiyouga/LLaMA-Factory) by clicking on the [Fork](https://github.com/hiyouga/LLaMA-Factory/fork) button on the repository's page. This creates a copy of the code under your GitHub user account.
26
+
27
+ 2. Clone your fork to your local disk, and add the base repository as a remote:
28
+
29
+ ```bash
30
+ git clone git@github.com:[username]/LLaMA-Factory.git
31
+ cd LLaMA-Factory
32
+ git remote add upstream https://github.com/hiyouga/LLaMA-Factory.git
33
+ ```
34
+
35
+ 3. Create a new branch to hold your development changes:
36
+
37
+ ```bash
38
+ git checkout -b dev_your_branch
39
+ ```
40
+
41
+ 4. Set up a development environment by running the following command in a virtual environment:
42
+
43
+ ```bash
44
+ pip install -e ".[dev]"
45
+ ```
46
+
47
+ If LLaMA Factory was already installed in the virtual environment, remove it with `pip uninstall llamafactory` before reinstalling it in editable mode with the -e flag.
48
+
49
+ 5. Check code before commit:
50
+
51
+ ```bash
52
+ make commit
53
+ make style && make quality
54
+ make test
55
+ ```
56
+
57
+ 6. Submit changes:
58
+
59
+ ```bash
60
+ git add .
61
+ git commit -m "commit message"
62
+ git fetch upstream
63
+ git rebase upstream/main
64
+ git push -u origin dev_your_branch
65
+ ```
66
+
67
+ 7. Create a merge request from your branch `dev_your_branch` at [origin repo](https://github.com/hiyouga/LLaMA-Factory).
LLaMA-Factory/.github/ISSUE_TEMPLATE/1-bug-report.yml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "\U0001F41B Bug / help"
2
+ description: Create a report to help us improve the LLaMA Factory
3
+ labels: ["bug", "pending"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Issues included in **[FAQs](https://github.com/hiyouga/LLaMA-Factory/issues/4614)** or those with **insufficient** information may be closed without a response.
9
+ 已经包含在 **[常见问题](https://github.com/hiyouga/LLaMA-Factory/issues/4614)** 内或提供信息**不完整**的 issues 可能不会被回复。
10
+
11
+ - type: markdown
12
+ attributes:
13
+ value: |
14
+ Please do not create issues that are not related to framework bugs under this category, use **[Discussions](https://github.com/hiyouga/LLaMA-Factory/discussions/categories/q-a)** instead.
15
+ 请勿在此分类下创建和框架 bug 无关的 issues,训练问题求助请使用 **[讨论区](https://github.com/hiyouga/LLaMA-Factory/discussions/categories/q-a)**。
16
+
17
+ - type: checkboxes
18
+ id: reminder
19
+ attributes:
20
+ label: Reminder
21
+ description: |
22
+ Please ensure you have read the above rules carefully and searched the existing issues (including FAQs).
23
+ 请确保您已经认真阅读了上述规则并且搜索过现有的 issues(包括常见问题)。
24
+
25
+ options:
26
+ - label: I have read the above rules and searched the existing issues.
27
+ required: true
28
+
29
+ - type: textarea
30
+ id: system-info
31
+ validations:
32
+ required: true
33
+ attributes:
34
+ label: System Info
35
+ description: |
36
+ Please share your system info with us. You can run the command **llamafactory-cli env** and copy-paste its output below.
37
+ 请提供您的系统信息。您可以在命令行运行 **llamafactory-cli env** 并将其输出复制到该文本框中。
38
+
39
+ placeholder: llamafactory version, platform, python version, ...
40
+
41
+ - type: textarea
42
+ id: reproduction
43
+ validations:
44
+ required: true
45
+ attributes:
46
+ label: Reproduction
47
+ description: |
48
+ Please provide entry arguments, error messages and stack traces that reproduces the problem.
49
+ 请提供入口参数,错误日志以及异常堆栈以便于我们复现问题。
50
+
51
+ value: |
52
+ ```text
53
+ Put your message here.
54
+ ```
55
+
56
+ - type: textarea
57
+ id: others
58
+ validations:
59
+ required: false
60
+ attributes:
61
+ label: Others
LLaMA-Factory/.github/ISSUE_TEMPLATE/2-feature-request.yml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "\U0001F680 Feature request"
2
+ description: Submit a request for a new feature
3
+ labels: ["enhancement", "pending"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Please do not create issues that are not related to new features under this category.
9
+ 请勿在此分类下创建和新特性无关的 issues。
10
+
11
+ - type: checkboxes
12
+ id: reminder
13
+ attributes:
14
+ label: Reminder
15
+ description: |
16
+ Please ensure you have read the above rules carefully and searched the existing issues.
17
+ 请确保您已经认真阅读了上述规则并且搜索过现有的 issues。
18
+
19
+ options:
20
+ - label: I have read the above rules and searched the existing issues.
21
+ required: true
22
+
23
+ - type: textarea
24
+ id: description
25
+ validations:
26
+ required: true
27
+ attributes:
28
+ label: Description
29
+ description: |
30
+ A clear and concise description of the feature proposal.
31
+ 请详细描述您希望加入的新功能特性。
32
+
33
+ - type: textarea
34
+ id: contribution
35
+ validations:
36
+ required: false
37
+ attributes:
38
+ label: Pull Request
39
+ description: |
40
+ Have you already created the relevant PR and submitted the code?
41
+ 您是否已经创建了相关 PR 并提交了代码?
LLaMA-Factory/.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: 📚 FAQs | 常见问题
4
+ url: https://github.com/hiyouga/LLaMA-Factory/issues/4614
5
+ about: Reading in advance is recommended | 建议提前阅读
6
+ - name: Discussions | 讨论区
7
+ url: https://github.com/hiyouga/LLaMA-Factory/discussions
8
+ about: Please ask fine-tuning questions here | 请在这里讨论训练问题
LLaMA-Factory/.github/PULL_REQUEST_TEMPLATE.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # What does this PR do?
2
+
3
+ Fixes # (issue)
4
+
5
+ ## Before submitting
6
+
7
+ - [ ] Did you read the [contributor guideline](https://github.com/hiyouga/LLaMA-Factory/blob/main/.github/CONTRIBUTING.md)?
8
+ - [ ] Did you write any new necessary tests?
LLaMA-Factory/.github/SECURITY.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Reporting Security Issues
2
+
3
+ To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/hiyouga/LLaMA-Factory/security/advisories/new) tab.
4
+
5
+ We will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
6
+
7
+ Report security bugs in third-party modules to the person or team maintaining the module.
LLaMA-Factory/.github/workflows/docker.yml ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: docker
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches:
7
+ - "main"
8
+ paths:
9
+ - "**/*.py"
10
+ - "requirements.txt"
11
+ - "docker/**"
12
+ - ".github/workflows/*.yml"
13
+ pull_request:
14
+ branches:
15
+ - "main"
16
+ paths:
17
+ - "**/*.py"
18
+ - "requirements.txt"
19
+ - "docker/**"
20
+ - ".github/workflows/*.yml"
21
+ release:
22
+ types:
23
+ - published
24
+
25
+ jobs:
26
+ build:
27
+ strategy:
28
+ fail-fast: false
29
+ matrix:
30
+ include:
31
+ - device: "cuda"
32
+ npu_type: ""
33
+ - device: "npu"
34
+ npu_type: "a2"
35
+ - device: "npu"
36
+ npu_type: "a3"
37
+
38
+ runs-on: ubuntu-latest
39
+
40
+ concurrency:
41
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.device }}-${{ matrix.npu_type }}
42
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
43
+
44
+ environment:
45
+ name: docker
46
+ url: https://hub.docker.com/r/hiyouga/llamafactory
47
+
48
+ steps:
49
+ - name: Free up disk space
50
+ uses: jlumbroso/free-disk-space@v1.3.1
51
+ with:
52
+ tool-cache: true
53
+ docker-images: false
54
+
55
+ - name: Checkout
56
+ uses: actions/checkout@v4
57
+
58
+ - name: Set up Python
59
+ uses: actions/setup-python@v5
60
+ with:
61
+ python-version: "3.10"
62
+
63
+ - name: Get llamafactory version
64
+ id: version
65
+ run: |
66
+ if [ "${{ github.event_name }}" = "release" ]; then
67
+ echo "tag=$(python setup.py --version)" >> "$GITHUB_OUTPUT"
68
+ else
69
+ echo "tag=latest" >> "$GITHUB_OUTPUT"
70
+ fi
71
+
72
+ - name: Set up Docker Buildx
73
+ uses: docker/setup-buildx-action@v3
74
+
75
+ - name: Login to Docker Hub
76
+ if: ${{ github.event_name != 'pull_request' }}
77
+ uses: docker/login-action@v3
78
+ with:
79
+ username: ${{ vars.DOCKERHUB_USERNAME }}
80
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
81
+
82
+ - name: Login to Quay
83
+ if: ${{ github.event_name != 'pull_request' && matrix.device == 'npu'}}
84
+ uses: docker/login-action@v3
85
+ with:
86
+ registry: quay.io
87
+ username: ${{ vars.QUAY_ASCEND_USERNAME }}
88
+ password: ${{ secrets.QUAY_ASCEND_TOKEN }}
89
+
90
+ - name: Build and push Docker image (CUDA)
91
+ if: ${{ matrix.device == 'cuda' }}
92
+ uses: docker/build-push-action@v6
93
+ with:
94
+ context: .
95
+ file: ./docker/docker-cuda/Dockerfile
96
+ build-args: |
97
+ EXTRAS=metrics,deepspeed,liger-kernel
98
+ push: ${{ github.event_name != 'pull_request' }}
99
+ tags: |
100
+ docker.io/hiyouga/llamafactory:${{ steps.version.outputs.tag }}
101
+
102
+ - name: Build and push Docker image (NPU-A2)
103
+ if: ${{ matrix.device == 'npu' && matrix.npu_type == 'a2' }}
104
+ uses: docker/build-push-action@v6
105
+ with:
106
+ context: .
107
+ platforms: linux/amd64,linux/arm64
108
+ file: ./docker/docker-npu/Dockerfile
109
+ push: ${{ github.event_name != 'pull_request' }}
110
+ tags: |
111
+ docker.io/hiyouga/llamafactory:${{ steps.version.outputs.tag }}-npu-a2
112
+ quay.io/ascend/llamafactory:${{ steps.version.outputs.tag }}-npu-a2
113
+
114
+ - name: Build and push Docker image (NPU-A3)
115
+ if: ${{ matrix.device == 'npu' && matrix.npu_type == 'a3' }}
116
+ uses: docker/build-push-action@v6
117
+ with:
118
+ context: .
119
+ platforms: linux/amd64,linux/arm64
120
+ file: ./docker/docker-npu/Dockerfile
121
+ build-args: |
122
+ BASE_IMAGE=quay.io/ascend/cann:8.3.rc2-a3-ubuntu22.04-py3.11
123
+ push: ${{ github.event_name != 'pull_request' }}
124
+ tags: |
125
+ docker.io/hiyouga/llamafactory:${{ steps.version.outputs.tag }}-npu-a3
126
+ quay.io/ascend/llamafactory:${{ steps.version.outputs.tag }}-npu-a3
LLaMA-Factory/.github/workflows/label_issue.yml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: label_issue
2
+
3
+ on:
4
+ issues:
5
+ types:
6
+ - opened
7
+
8
+ jobs:
9
+ label_issue:
10
+ runs-on: ubuntu-latest
11
+
12
+ permissions:
13
+ issues: write
14
+
15
+ steps:
16
+ - env:
17
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18
+ ISSUE_URL: ${{ github.event.issue.html_url }}
19
+ ISSUE_TITLE: ${{ github.event.issue.title }}
20
+ run: |
21
+ LABEL=""
22
+ NPU_KEYWORDS=(npu huawei ascend 华为 昇腾 910)
23
+ ISSUE_TITLE_LOWER=$(echo $ISSUE_TITLE | tr '[:upper:]' '[:lower:]')
24
+ for KEYWORD in ${NPU_KEYWORDS[@]}; do
25
+ if [[ $ISSUE_TITLE_LOWER == *$KEYWORD* ]] && [[ $ISSUE_TITLE_LOWER != *input* ]]; then
26
+ LABEL="npu"
27
+ break
28
+ fi
29
+ done
30
+ if [ -n "$LABEL" ]; then
31
+ gh issue edit $ISSUE_URL --add-label $LABEL
32
+ fi
LLaMA-Factory/.github/workflows/publish.yml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: publish
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ release:
6
+ types:
7
+ - published
8
+
9
+ jobs:
10
+ publish:
11
+ name: Upload release to PyPI
12
+
13
+ runs-on: ubuntu-latest
14
+
15
+ environment:
16
+ name: release
17
+ url: https://pypi.org/p/llamafactory
18
+
19
+ permissions:
20
+ id-token: write
21
+
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Set up Python
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: "3.9"
30
+
31
+ - name: Build package
32
+ run: |
33
+ make build
34
+
35
+ - name: Publish package
36
+ uses: pypa/gh-action-pypi-publish@release/v1
LLaMA-Factory/.github/workflows/tests.yml ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: tests
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches:
7
+ - "main"
8
+ paths:
9
+ - "**/*.py"
10
+ - "requirements.txt"
11
+ - "Makefile"
12
+ - ".github/workflows/*.yml"
13
+ pull_request:
14
+ branches:
15
+ - "main"
16
+ paths:
17
+ - "**/*.py"
18
+ - "requirements.txt"
19
+ - "Makefile"
20
+ - ".github/workflows/*.yml"
21
+
22
+ jobs:
23
+ tests:
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ python:
28
+ - "3.9"
29
+ - "3.10"
30
+ - "3.11"
31
+ - "3.12"
32
+ os:
33
+ - "ubuntu-latest"
34
+ - "windows-latest"
35
+ - "macos-latest"
36
+ transformers:
37
+ - null
38
+ include: # test backward compatibility
39
+ - python: "3.9"
40
+ os: "ubuntu-latest"
41
+ transformers: "4.49.0"
42
+ - python: "3.9"
43
+ os: "ubuntu-latest"
44
+ transformers: "4.51.0"
45
+ - python: "3.9"
46
+ os: "ubuntu-latest"
47
+ transformers: "4.53.0"
48
+ exclude: # exclude python 3.9 on macos
49
+ - python: "3.9"
50
+ os: "macos-latest"
51
+
52
+ runs-on: ${{ matrix.os }}
53
+
54
+ concurrency:
55
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.transformers }}
56
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
57
+
58
+ env:
59
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
60
+ OS_NAME: ${{ matrix.os }}
61
+
62
+ steps:
63
+ - name: Checkout
64
+ uses: actions/checkout@v4
65
+
66
+ - name: Set up Python
67
+ uses: actions/setup-python@v5
68
+ with:
69
+ python-version: ${{ matrix.python }}
70
+
71
+ - name: Install dependencies
72
+ run: |
73
+ python -m pip install --upgrade pip
74
+ python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
75
+ python -m pip install ".[dev]"
76
+
77
+ - name: Install transformers
78
+ if: ${{ matrix.transformers }}
79
+ run: |
80
+ python -m pip install "transformers==${{ matrix.transformers }}"
81
+
82
+ - name: Cache files
83
+ id: hf-hub-cache
84
+ uses: actions/cache@v4
85
+ with:
86
+ path: ${{ runner.temp }}/huggingface
87
+ key: huggingface-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.transformers }}-${{ hashFiles('tests/version.txt') }}
88
+
89
+ - name: Check quality
90
+ run: |
91
+ make style && make quality
92
+
93
+ - name: Check license
94
+ run: |
95
+ make license
96
+
97
+ - name: Check build
98
+ run: |
99
+ make build
100
+
101
+ - name: Test with pytest
102
+ run: |
103
+ make test
104
+ env:
105
+ HF_HOME: ${{ runner.temp }}/huggingface
106
+ HF_HUB_OFFLINE: "${{ steps.hf-hub-cache.outputs.cache-hit == 'true' && '1' || '0' }}"
LLaMA-Factory/.github/workflows/tests_npu.yml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: tests_npu
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches:
7
+ - "main"
8
+ paths:
9
+ - "**/*.py"
10
+ - "requirements.txt"
11
+ - "Makefile"
12
+ - ".github/workflows/*.yml"
13
+ pull_request:
14
+ branches:
15
+ - "main"
16
+ paths:
17
+ - "**/*.py"
18
+ - "requirements.txt"
19
+ - "Makefile"
20
+ - ".github/workflows/*.yml"
21
+
22
+ jobs:
23
+ tests:
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ python:
28
+ - "3.11"
29
+ os:
30
+ - "linux-aarch64-a2-4"
31
+ pytorch_npu:
32
+ - "2.7.1"
33
+
34
+ runs-on: ${{ matrix.os }}
35
+
36
+ concurrency:
37
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.python }}
38
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
39
+
40
+ container:
41
+ image: ascendai/cann:8.3.rc2-910b-ubuntu22.04-py3.11
42
+ env:
43
+ HF_ENDPOINT: https://hf-mirror.com
44
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
45
+ OS_NAME: ${{ matrix.os }}
46
+
47
+ steps:
48
+ - name: Checkout
49
+ uses: actions/checkout@v4
50
+
51
+ - name: Install dependencies
52
+ run: |
53
+ python -m pip install --upgrade pip
54
+ python -m pip install ".[torch-npu,dev]" torch-npu==${{matrix.pytorch_npu}}
55
+
56
+ - name: Install node
57
+ run: |
58
+ apt-get update || true
59
+ apt-get install -y curl
60
+ curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
61
+ apt-get install -y nodejs
62
+
63
+ - name: Cache files
64
+ id: hf-hub-cache
65
+ uses: actions/cache@v4
66
+ with:
67
+ path: ${{ runner.temp }}/huggingface
68
+ key: huggingface-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('tests/version.txt') }}
69
+
70
+ - name: Check quality
71
+ run: |
72
+ make style && make quality
73
+
74
+ - name: Check license
75
+ run: |
76
+ make license
77
+
78
+ - name: Check build
79
+ run: |
80
+ make build
81
+
82
+ - name: Test with pytest
83
+ run: |
84
+ make test
85
+ env:
86
+ HF_HOME: /root/.cache/huggingface
87
+ HF_HUB_OFFLINE: "${{ steps.hf-hub-cache.outputs.cache-hit == 'true' && '1' || '0' }}"
LLaMA-Factory/README_zh.md ADDED
@@ -0,0 +1,979 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ![# LLaMA Factory](assets/logo.png)
2
+
3
+ [![GitHub Repo stars](https://img.shields.io/github/stars/hiyouga/LLaMA-Factory?style=social)](https://github.com/hiyouga/LLaMA-Factory/stargazers)
4
+ [![GitHub last commit](https://img.shields.io/github/last-commit/hiyouga/LLaMA-Factory)](https://github.com/hiyouga/LLaMA-Factory/commits/main)
5
+ [![GitHub contributors](https://img.shields.io/github/contributors/hiyouga/LLaMA-Factory?color=orange)](https://github.com/hiyouga/LLaMA-Factory/graphs/contributors)
6
+ [![GitHub workflow](https://github.com/hiyouga/LLaMA-Factory/actions/workflows/tests.yml/badge.svg)](https://github.com/hiyouga/LLaMA-Factory/actions/workflows/tests.yml)
7
+ [![PyPI](https://img.shields.io/pypi/v/llamafactory)](https://pypi.org/project/llamafactory/)
8
+ [![Citation](https://img.shields.io/badge/citation-1000+-green)](https://scholar.google.com/scholar?cites=12620864006390196564)
9
+ [![Docker Pulls](https://img.shields.io/docker/pulls/hiyouga/llamafactory)](https://hub.docker.com/r/hiyouga/llamafactory/tags)
10
+
11
+ [![Twitter](https://img.shields.io/twitter/follow/llamafactory_ai)](https://twitter.com/llamafactory_ai)
12
+ [![Discord](assets/thirdparty/discord.svg)](https://discord.gg/rKfvV9r9FK)
13
+ [![WeChat](https://img.shields.io/badge/WeChat-User%20Group-blue?logo=wechat)](https://github.com/hiyouga/llamafactory-community)
14
+ [![Blog](https://img.shields.io/badge/Hugo-Official%20Blog-blue?logo=hugo)](https://blog.llamafactory.net/)
15
+
16
+ [![Open in Colab](assets/thirdparty/colab.svg)](https://colab.research.google.com/drive/1d5KQtbemerlSDSxZIfAaWXhKr30QypiK?usp=sharing)
17
+ [![Open in DSW](assets/thirdparty/dsw.svg)](https://gallery.pai-ml.com/#/preview/deepLearning/nlp/llama_factory)
18
+ [![Open in Lab4ai](assets/thirdparty/lab4ai.svg)](https://www.lab4ai.cn/course/detail?id=7c13e60f6137474eb40f6fd3983c0f46&utm_source=LLaMA-Factory)
19
+ [![Open in Online](assets/thirdparty/online.svg)](https://www.llamafactory.com.cn/?utm_source=LLaMA-Factory)
20
+ [![Open in Spaces](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue)](https://huggingface.co/spaces/hiyouga/LLaMA-Board)
21
+ [![Open in Studios](https://img.shields.io/badge/ModelScope-Open%20in%20Studios-blue)](https://modelscope.cn/studios/hiyouga/LLaMA-Board)
22
+ [![Open in Novita](https://img.shields.io/badge/Novita-Deploy%20Template-blue)](https://novita.ai/templates-library/105981?sharer=88115474-394e-4bda-968e-b88e123d0c47)
23
+
24
+ ### 获得[亚马逊](https://aws.amazon.com/cn/blogs/china/a-one-stop-code-free-model-fine-tuning-deployment-platform-based-on-sagemaker-and-llama-factory/)、[英伟达](https://developer.nvidia.cn/rtx/ai-toolkit)、[阿里云](https://help.aliyun.com/zh/pai/use-cases/fine-tune-a-llama-3-model-with-llama-factory)等的应用。
25
+
26
+ <div align="center" markdown="1">
27
+
28
+ ### 赞助商 ❤️
29
+
30
+ | <div style="text-align: center;"><a href="https://warp.dev/llama-factory"><img alt="Warp sponsorship" width="400" src="assets/sponsors/warp.jpg"></a><br><a href="https://warp.dev/llama-factory" style="font-size:larger;">Warp,面向开发者的智能终端</a><br><a href="https://warp.dev/llama-factory">适用于 MacOS、Linux 和 Windows</a> | <a href="https://serpapi.com"><img alt="SerpAPI sponsorship" width="250" src="assets/sponsors/serpapi.svg"> </a> |
31
+ | ---- | ---- |
32
+
33
+ ----
34
+
35
+ ### 使用零代码[命令行](#快速开始)与 [Web UI](#llama-board-可视化微调由-gradio-驱动) 轻松微调百余种大模型
36
+
37
+ ![GitHub Trend](https://trendshift.io/api/badge/repositories/4535)
38
+
39
+ </div>
40
+
41
+ 👋 加入我们的[微信群](https://github.com/hiyouga/llamafactory-community/blob/main/wechat/main.jpg)、[NPU 用户群](https://github.com/hiyouga/llamafactory-community/blob/main/wechat/npu.jpg)、[大模型实验室群](https://github.com/hiyouga/llamafactory-community/blob/main/wechat/lab4ai.jpg) 或 [LLaMA Factory Online 用户群](https://github.com/hiyouga/llamafactory-community/blob/main/wechat/online.png)。
42
+
43
+ \[ [English](README.md) | 中文 \]
44
+
45
+ **微调大模型可以像这样轻松…**
46
+
47
+ https://github.com/user-attachments/assets/43b700c6-a178-41db-b1f8-8190a5d3fcfc
48
+
49
+ 开始本地训练:
50
+ - 请见[如何使用](#如何使用)
51
+
52
+ 开始云端训练:
53
+ - **Colab(免费)**:https://colab.research.google.com/drive/1d5KQtbemerlSDSxZIfAaWXhKr30QypiK?usp=sharing
54
+ - **PAI-DSW(免费试用)**:https://gallery.pai-ml.com/#/preview/deepLearning/nlp/llama_factory
55
+ - **LLaMA Factory Online(在线微调)**:https://www.llamafactory.com.cn/?utm_source=LLaMA-Factory
56
+ - **九章智算云(算力优惠活动)**:https://docs.alayanew.com/docs/documents/useGuide/LLaMAFactory/mutiple/?utm_source=LLaMA-Factory
57
+
58
+ 阅读技术文档:
59
+ - **入门教程**:https://zhuanlan.zhihu.com/p/695287607
60
+ - **微调视频教程**:https://www.bilibili.com/video/BV1djgRzxEts/
61
+ - **框架文档**:https://llamafactory.readthedocs.io/zh-cn/latest/
62
+ - **框架文档(昇腾 NPU)**:https://ascend.github.io/docs/sources/llamafactory/
63
+ - **官方博客**:https://blog.llamafactory.net/
64
+ - **官方课程**:https://www.lab4ai.cn/course/detail?id=7c13e60f6137474eb40f6fd3983c0f46&utm_source=LLaMA-Factory
65
+
66
+ > [!NOTE]
67
+ > 除上述链接以外的其他网站均为未经许可的第三方网站,请小心甄别。
68
+
69
+ ## 目录
70
+
71
+ - [项目特色](#项目特色)
72
+ - [官方博客](#官方博客)
73
+ - [更新日志](#更新日志)
74
+ - [模型](#模型)
75
+ - [训练方法](#训练方法)
76
+ - [数据集](#数据集)
77
+ - [软硬件依赖](#软硬件依赖)
78
+ - [如何使用](#如何使用)
79
+ - [安装 LLaMA Factory](#安装-llama-factory)
80
+ - [数据准备](#数据准备)
81
+ - [快速开始](#快速开始)
82
+ - [LLaMA Board 可视化微调](#llama-board-可视化微调由-gradio-驱动)
83
+ - [LLaMA Factory Online 在线微调](#llama-factory-online-在线微调)
84
+ - [构建 Docker](#构建-docker)
85
+ - [利用 vLLM 部署 OpenAI API](#利用-vllm-部署-openai-api)
86
+ - [从魔搭社区下载](#从魔搭社区下载)
87
+ - [从魔乐社区下载](#从魔乐社区下载)
88
+ - [使用 W&B 面板](#使用-wb-面板)
89
+ - [使用 SwanLab 面板](#使用-swanlab-面板)
90
+ - [使用了 LLaMA Factory 的项目](#使用了-llama-factory-的项目)
91
+ - [协议](#协议)
92
+ - [引用](#引用)
93
+ - [致谢](#致谢)
94
+
95
+ ## 项目特色
96
+
97
+ - **多种模型**:LLaMA、LLaVA、Mistral、Mixtral-MoE、Qwen、Qwen2-VL、DeepSeek、Yi、Gemma、ChatGLM、Phi 等等。
98
+ - **集成方法**:(增量)预训练、(多模态)指令监督微调、奖励模型训练、PPO 训练、DPO 训练、KTO 训练、ORPO 训练等等。
99
+ - **多种精度**:16 比特全参数微调、冻结微调、LoRA 微调和基于 AQLM/AWQ/GPTQ/LLM.int8/HQQ/EETQ 的 2/3/4/5/6/8 比特 QLoRA 微调。
100
+ - **先进算法**:[GaLore](https://github.com/jiaweizzhao/GaLore)、[BAdam](https://github.com/Ledzy/BAdam)、[APOLLO](https://github.com/zhuhanqing/APOLLO)、[Adam-mini](https://github.com/zyushun/Adam-mini)、[Muon](https://github.com/KellerJordan/Muon)、[OFT](https://github.com/huggingface/peft/tree/main/src/peft/tuners/oft)、DoRA、LongLoRA、LLaMA Pro、Mixture-of-Depths、LoRA+、LoftQ 和 PiSSA。
101
+ - **实用技巧**:[FlashAttention-2](https://github.com/Dao-AILab/flash-attention)、[Unsloth](https://github.com/unslothai/unsloth)、[Liger Kernel](https://github.com/linkedin/Liger-Kernel)、[KTransformers](https://github.com/kvcache-ai/ktransformers/)、RoPE scaling、NEFTune 和 rsLoRA。
102
+ - **广泛任务**:多轮对话、工具调用、图像理解、视觉定位、视频识别和语音理解等等。
103
+ - **实验监控**:LlamaBoard、TensorBoard、Wandb、MLflow、[SwanLab](https://github.com/SwanHubX/SwanLab) 等等。
104
+ - **极速推理**:基于 [vLLM](https://github.com/vllm-project/vllm) 或 [SGLang](https://github.com/sgl-project/sglang) 的 OpenAI 风格 API、浏览器界面和命令行接口。
105
+
106
+ ### 最新模型的 Day-N 微调适配
107
+
108
+ | 适配时间 | 模型名称 |
109
+ | ------------ | -------------------------------------------------------------------- |
110
+ | Day 0 | Qwen3 / Qwen2.5-VL / Gemma 3 / GLM-4.1V / InternLM 3 / MiniCPM-o-2.6 |
111
+ | Day 1 | Llama 3 / GLM-4 / Mistral Small / PaliGemma2 / Llama 4 |
112
+
113
+ ## 官方博客
114
+
115
+ > [!TIP]
116
+ > 我们现在拥有了 LLaMA Factory 的专属博客!
117
+ >
118
+ > 网站地址:https://blog.llamafactory.net/
119
+
120
+ - 💡 [KTransformers Fine-Tuning × LLaMA Factory: 用2张4090级的GPU+CPU 微调 1000B规模的超大模型](https://swcil84qspu.feishu.cn/wiki/Z1sSwb2poijybxkyPEkcDG6enVc) (中文)
121
+ - 💡 [Easy Dataset × LLaMA Factory: 让大模型高效学习领域知识](https://buaa-act.feishu.cn/wiki/KY9xwTGs1iqHrRkjXBwcZP9WnL9)(中文)
122
+ - [使用 LLaMA-Factory 微调心理健康大模型](https://www.lab4ai.cn/project/detail?id=25cce32ec131497b9e06a93336a0817f&type=project&utm_source=LLaMA-Factory)(中文)
123
+ - [使用 LLaMA-Factory 构建 GPT-OSS 角色扮演模型](https://docs.llamafactory.com.cn/docs/documents/best-practice/gptroleplay/?utm_source=LLaMA-Factory)(中文)
124
+ - [基于 LLaMA-Factory 和 EasyR1 打造一站式无代码大模型强化学习和部署平台 LLM Model Hub](https://aws.amazon.com/cn/blogs/china/building-llm-model-hub-based-on-llamafactory-and-easyr1/)(中文)
125
+ - [通过亚马逊 SageMaker HyperPod 上的 LLaMA-Factory 增强多模态模型银行文档的视觉信息提取](https://aws.amazon.com/cn/blogs/machine-learning/how-apoidea-group-enhances-visual-information-extraction-from-banking-documents-with-multimodal-models-using-llama-factory-on-amazon-sagemaker-hyperpod/)(英文)
126
+
127
+ <details><summary>全部博客</summary>
128
+
129
+ - [使用 LLaMA-Factory 微调 Llama3.1-70B 医学诊断模型](https://docs.alayanew.com/docs/documents/bestPractice/bigModel/llama70B/?utm_source=LLaMA-Factory)(中文)
130
+ - [使用 LLaMA-Factory 微调 Qwen2.5-VL 实现自动驾驶场景微调](https://docs.alayanew.com/docs/documents/useGuide/LLaMAFactory/mutiple/?utm_source=LLaMA-Factory)(中文)
131
+ - [LLaMA Factory:微调 DeepSeek-R1-Distill-Qwen-7B 模型实现新闻标题分类器](https://gallery.pai-ml.com/#/preview/deepLearning/nlp/llama_factory_deepseek_r1_distill_7b)(中文)
132
+ - [基于 Amazon SageMaker 和 LLaMA-Factory 打造一站式无代码模型微调部署平台 Model Hub](https://aws.amazon.com/cn/blogs/china/a-one-stop-code-free-model-fine-tuning-deployment-platform-based-on-sagemaker-and-llama-factory/)(中文)
133
+ - [LLaMA Factory 多模态微调实践:微调 Qwen2-VL 构建文旅大模型](https://gallery.pai-ml.com/#/preview/deepLearning/nlp/llama_factory_qwen2vl)(中文)
134
+ - [LLaMA Factory:微调 Llama3 模型实现角色扮演](https://gallery.pai-ml.com/#/preview/deepLearning/nlp/llama_factory)(中文)
135
+
136
+ </details>
137
+
138
+ ## 更新日志
139
+
140
+ [25/10/26] 我们支持了Megatron-core作为训练后端和适配了[**mcore_adapter**](https://github.com/alibaba/ROLL/tree/main/mcore_adapter)。查看[PR #9237](https://github.com/hiyouga/LLaMA-Factory/pull/9237)以使用。
141
+
142
+ [25/08/22] 我们支持了 **[OFT](https://arxiv.org/abs/2306.07280)** 和 **[OFTv2](https://arxiv.org/abs/2506.19847)** 模型的微调。查看 [examples](examples/README.md) 以使用。
143
+
144
+ [25/08/20] 我们支持了 **[Intern-S1-mini](https://huggingface.co/internlm/Intern-S1-mini)** 模型的微调。查看 [PR #8976](https://github.com/hiyouga/LLaMA-Factory/pull/8976) 以使用。
145
+
146
+ [25/08/06] 我们支持了 **[GPT-OSS](https://github.com/openai/gpt-oss)** 模型的微调。查看 [PR #8826](https://github.com/hiyouga/LLaMA-Factory/pull/8826) 以使用。
147
+
148
+ <details><summary>展开日志</summary>
149
+
150
+ [25/07/02] 我们支持了 **[GLM-4.1V-9B-Thinking](https://github.com/THUDM/GLM-4.1V-Thinking)** 模型的微调。
151
+
152
+ [25/04/28] 我们支持了 **[Qwen3](https://qwenlm.github.io/blog/qwen3/)** 系列模型的微调。
153
+
154
+ [25/04/21] 我们支持了 **[Muon](https://github.com/KellerJordan/Muon)** 优化器。详细用法请参照 [examples](examples/README_zh.md)。感谢 [@tianshijing](https://github.com/tianshijing) 的 PR。
155
+
156
+ [25/04/16] 我们支持了 **[InternVL3](https://huggingface.co/OpenGVLab/InternVL3-8B)** 模型的微调。查看 [PR #7258](https://github.com/hiyouga/LLaMA-Factory/pull/7258) 以使用。
157
+
158
+ [25/04/14] 我们支持了 **[GLM-Z1](https://huggingface.co/THUDM/GLM-Z1-9B-0414)** 和 **[Kimi-VL](https://huggingface.co/moonshotai/Kimi-VL-A3B-Instruct)** 模型的微调。
159
+
160
+ [25/04/06] 我们支持了 **[Llama 4](https://ai.meta.com/blog/llama-4-multimodal-intelligence/)** 模型的微调。查看 [PR #7611](https://github.com/hiyouga/LLaMA-Factory/pull/7611) 以使用。
161
+
162
+ [25/03/31] 我们支持了 **[Qwen2.5 Omni](https://qwenlm.github.io/blog/qwen2.5-omni/)** 模型的微调。查看 [PR #7537](https://github.com/hiyouga/LLaMA-Factory/pull/7537) 以使用。
163
+
164
+ [25/03/15] 我们支持了 **[SGLang](https://github.com/sgl-project/sglang)** 推理后端,请使用 `infer_backend: sglang` 启用。
165
+
166
+ [25/03/12] 我们支持了 **[Gemma 3](https://huggingface.co/blog/gemma3)** 模型的微调。
167
+
168
+ [25/02/24] 我们宣布开源 **[EasyR1](https://github.com/hiyouga/EasyR1)**,一个高效可扩展的多模态强化学习框架,支持高效的 GRPO 训练。
169
+
170
+ [25/02/11] 我们支持了在导出模型时保存 **[Ollama](https://github.com/ollama/ollama)** 配置文件。详细用法请参照 [examples](examples/README_zh.md)。
171
+
172
+ [25/02/05] 我们支持了在语音理解任务上微调 **[Qwen2-Audio](Qwen/Qwen2-Audio-7B-Instruct)** 和 **[MiniCPM-o-2.6](https://huggingface.co/openbmb/MiniCPM-o-2_6)** 模型。
173
+
174
+ [25/01/31] 我们支持了 **[DeepSeek-R1](https://huggingface.co/deepseek-ai/DeepSeek-R1)** 和 **[Qwen2.5-VL](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct)** 模型的微调。
175
+
176
+ [25/01/15] 我们支持了 **[APOLLO](https://arxiv.org/abs/2412.05270)** 优化器。详细用法请参照 [examples](examples/README_zh.md)。
177
+
178
+ [25/01/14] 我们支持了 **[MiniCPM-o-2.6](https://huggingface.co/openbmb/MiniCPM-o-2_6)** 和 **[MiniCPM-V-2.6](https://huggingface.co/openbmb/MiniCPM-V-2_6)** 模型的微调。 感谢 [@BUAADreamer](https://github.com/BUAADreamer) 的 PR.
179
+
180
+ [25/01/14] 我们支持了 **[InternLM 3](https://huggingface.co/collections/internlm/)** 模型的微调。感谢 [@hhaAndroid](https://github.com/hhaAndroid) 的 PR。
181
+
182
+ [25/01/10] 我们支持了 **[Phi-4](https://huggingface.co/microsoft/phi-4)** 模型的微调。
183
+
184
+ [24/12/21] 我们支持了使用 **[SwanLab](https://github.com/SwanHubX/SwanLab)** 跟踪与可视化实验。详细用法请参考 [此部分](#使用-swanlab-面板)。
185
+
186
+ [24/11/27] 我们支持了 **[Skywork-o1](https://huggingface.co/Skywork/Skywork-o1-Open-Llama-3.1-8B)** 模型的微调和 **[OpenO1](https://huggingface.co/datasets/O1-OPEN/OpenO1-SFT)** 数据集。
187
+
188
+ [24/10/09] 我们支持了从 **[魔乐社区](https://modelers.cn/models)** 下载预训练模型和数据集。详细用法请参照 [此教程](#从魔乐社区下载)。
189
+
190
+ [24/09/19] 我们支持了 **[Qwen2.5](https://qwenlm.github.io/blog/qwen2.5/)** 模型的微调。
191
+
192
+ [24/08/30] 我们支持了 **[Qwen2-VL](https://qwenlm.github.io/blog/qwen2-vl/)** 模型的微调。感谢 [@simonJJJ](https://github.com/simonJJJ) 的 PR。
193
+
194
+ [24/08/27] 我们支持了 **[Liger Kernel](https://github.com/linkedin/Liger-Kernel)**。请使用 `enable_liger_kernel: true` 来加速训练。
195
+
196
+ [24/08/09] 我们支持了 **[Adam-mini](https://github.com/zyushun/Adam-mini)** 优化器。详细用法请参照 [examples](examples/README_zh.md)。感谢 [@relic-yuexi](https://github.com/relic-yuexi) 的 PR。
197
+
198
+ [24/07/04] 我们支持了[无污染打包训练](https://github.com/MeetKai/functionary/tree/main/functionary/train/packing)。请使用 `neat_packing: true` 参数。感谢 [@chuan298](https://github.com/chuan298) 的 PR。
199
+
200
+ [24/06/16] 我们支持了 **[PiSSA](https://arxiv.org/abs/2404.02948)** 算法。详细用法请参照 [examples](examples/README_zh.md)。
201
+
202
+ [24/06/07] 我们支持了 **[Qwen2](https://qwenlm.github.io/blog/qwen2/)** 和 **[GLM-4](https://github.com/THUDM/GLM-4)** 模型的微调。
203
+
204
+ [24/05/26] 我们支持了 **[SimPO](https://arxiv.org/abs/2405.14734)** 偏好对齐算法。详细用法请参照 [examples](examples/README_zh.md)。
205
+
206
+ [24/05/20] 我们支持了 **PaliGemma** 系列模型的微调。注意 PaliGemma 是预训练模型,你需要使用 `paligemma` 模板进行微调使其获得对话能力。
207
+
208
+ [24/05/18] 我们支持了 **[KTO](https://arxiv.org/abs/2402.01306)** 偏好对齐算法。详细用法请参照 [examples](examples/README_zh.md)。
209
+
210
+ [24/05/14] 我们支持了昇腾 NPU 设备的训练和推理。详情请查阅[安装](#安装-llama-factory)部分。
211
+
212
+ [24/04/26] 我们支持了多模态模型 **LLaVA-1.5** 的微调。详细用法请参照 [examples](examples/README_zh.md)。
213
+
214
+ [24/04/22] 我们提供了在免费 T4 GPU 上微调 Llama-3 模型的 **[Colab 笔记本](https://colab.research.google.com/drive/1d5KQtbemerlSDSxZIfAaWXhKr30QypiK?usp=sharing)**。Hugging Face 社区公开了两个利用 LLaMA Factory 微调的 Llama-3 模型,详情请见 [Llama3-8B-Chinese-Chat](https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat) 和 [Llama3-Chinese](https://huggingface.co/zhichen/Llama3-Chinese)。
215
+
216
+ [24/04/21] 我们基于 [AstraMindAI 的仓库](https://github.com/astramind-ai/Mixture-of-depths)支持了 **[混合深度训练](https://arxiv.org/abs/2404.02258)**。详细用法请参照 [examples](examples/README_zh.md)。
217
+
218
+ [24/04/16] 我们支持了 **[BAdam](https://arxiv.org/abs/2404.02827)** 优化器。详细用法请参照 [examples](examples/README_zh.md)。
219
+
220
+ [24/04/16] 我们支持了 **[unsloth](https://github.com/unslothai/unsloth)** 的长序列训练(24GB 可训练 Llama-2-7B-56k)。该方法相比 FlashAttention-2 提供了 **117%** 的训练速度和 **50%** 的显存节约。更多数据请见[此页面](https://github.com/hiyouga/LLaMA-Factory/wiki/Performance-comparison)。
221
+
222
+ [24/03/31] 我们支持了 **[ORPO](https://arxiv.org/abs/2403.07691)**。详细用法请参照 [examples](examples/README_zh.md)。
223
+
224
+ [24/03/21] 我们的论文 "[LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models](https://arxiv.org/abs/2403.13372)" 可在 arXiv 上查看!
225
+
226
+ [24/03/20] 我们支持了能在 2x24GB GPU 上微调 70B 模型的 **FSDP+QLoRA**。详细用法请参照 [examples](examples/README_zh.md)。
227
+
228
+ [24/03/13] 我们支持了 **[LoRA+](https://arxiv.org/abs/2402.12354)**。详细用法请参照 [examples](examples/README_zh.md)。
229
+
230
+ [24/03/07] 我们支持了 **[GaLore](https://arxiv.org/abs/2403.03507)** 优化器。详细用法请参照 [examples](examples/README_zh.md)。
231
+
232
+ [24/03/07] 我们集成了 **[vLLM](https://github.com/vllm-project/vllm)** 以实现极速并发推理。请使用 `infer_backend: vllm` 来获得 **270%** 的推理速度。
233
+
234
+ [24/02/28] 我们支持了 **[DoRA](https://arxiv.org/abs/2402.09353)** 微调。请使用 `use_dora: true` 参数进行 DoRA 微调。
235
+
236
+ [24/02/15] 我们支持了 [LLaMA Pro](https://github.com/TencentARC/LLaMA-Pro) 提出的**块扩展**方法。详细用法请参照 [examples](examples/README_zh.md)。
237
+
238
+ [24/02/05] Qwen1.5(Qwen2 测试版)系列模型已在 LLaMA-Factory 中实现微调支持。详情请查阅该[博客页面](https://qwenlm.github.io/zh/blog/qwen1.5/)。
239
+
240
+ [24/01/18] 我们针对绝大多数模型实现了 **Agent 微调**,微调时指定 `dataset: glaive_toolcall_zh` 即可使模型获得工具调用能力。
241
+
242
+ [23/12/23] 我们针对 LLaMA, Mistral 和 Yi 模型支持了 **[unsloth](https://github.com/unslothai/unsloth)** 的 LoRA 训练加速。请使用 `use_unsloth: true` 参数启用 unsloth 优化。该方法可提供 **170%** 的训练速度,详情请查阅[此页面](https://github.com/hiyouga/LLaMA-Factory/wiki/Performance-comparison)。
243
+
244
+ [23/12/12] 我们支持了微调最新的混合专家模型 **[Mixtral 8x7B](https://huggingface.co/mistralai/Mixtral-8x7B-v0.1)**。硬件需求请查阅[此处](#硬件依赖)。
245
+
246
+ [23/12/01] 我们支持了从 **[魔搭社区](https://modelscope.cn/models)** 下载预训练模型和数据集。详细用法请参照 [此教程](#从魔搭社区下载)。
247
+
248
+ [23/10/21] 我们支持了 **[NEFTune](https://arxiv.org/abs/2310.05914)** 训练技巧。请使用 `neftune_noise_alpha: 5` 参数启用 NEFTune。
249
+
250
+ [23/09/27] 我们针对 LLaMA 模型支持了 [LongLoRA](https://github.com/dvlab-research/LongLoRA) 提出的 **$S^2$-Attn**。请使用 `shift_attn: true` 参数以启用该功能。
251
+
252
+ [23/09/23] 我们在项目中集成了 MMLU、C-Eval 和 CMMLU 评估集。详细用法请参照 [examples](examples/README_zh.md)。
253
+
254
+ [23/09/10] 我们支持了 **[FlashAttention-2](https://github.com/Dao-AILab/flash-attention)**。如果您使用的是 RTX4090、A100 或 H100 GPU,请使用 `flash_attn: fa2` 参数以启用 FlashAttention-2。
255
+
256
+ [23/08/12] 我们支持了 **RoPE 插值**来扩展 LLaMA 模型的上下文长度。请使用 `rope_scaling: linear` 参数训练模型或使用 `rope_scaling: dynamic` 参数评估模型。
257
+
258
+ [23/08/11] 我们支持了指令模型的 **[DPO 训练](https://arxiv.org/abs/2305.18290)**。详细用法请参照 [examples](examples/README_zh.md)。
259
+
260
+ [23/07/31] 我们支持了**数据流式加载**。请使用 `streaming: true` 和 `max_steps: 10000` 参数来流式加载数据集。
261
+
262
+ [23/07/29] 我们在 Hugging Face 发布了两个 13B 指令微调模型。详细内容请查阅我们的 Hugging Face 项目([LLaMA-2](https://huggingface.co/hiyouga/Llama-2-Chinese-13b-chat) / [Baichuan](https://huggingface.co/hiyouga/Baichuan-13B-sft))。
263
+
264
+ [23/07/18] 我们开发了支持训练和测试的**浏览器一体化界面**。请使用 `train_web.py` 在您的浏览器中微调模型。感谢 [@KanadeSiina](https://github.com/KanadeSiina) 和 [@codemayq](https://github.com/codemayq) 在该功能开发中付出的努力。
265
+
266
+ [23/07/09] 我们开源了 **[FastEdit](https://github.com/hiyouga/FastEdit)** ⚡🩹,一个简单易用的、能迅速编辑大模型事实记忆的工具包。如果您感兴趣请关注我们的 [FastEdit](https://github.com/hiyouga/FastEdit) 项目。
267
+
268
+ [23/06/29] 我们提供了一个**可复现的**指令模型微调示例,详细内容请查阅 [Baichuan-7B-sft](https://huggingface.co/hiyouga/Baichuan-7B-sft)。
269
+
270
+ [23/06/22] 我们对齐了[示例 API](src/api_demo.py) 与 [OpenAI API](https://platform.openai.com/docs/api-reference/chat) 的格式,您可以将微调模型接入**任意基于 ChatGPT 的应用**中。
271
+
272
+ [23/06/03] 我们实现了 4 比特的 LoRA 训练(也称 **[QLoRA](https://github.com/artidoro/qlora)**)。详细用法请参照 [examples](examples/README_zh.md)。
273
+
274
+ </details>
275
+
276
+ > [!TIP]
277
+ > 如果您无法使用最新的功能,请尝试重新拉取代码并再次安装 LLaMA-Factory。
278
+
279
+ ## 模型
280
+
281
+ | 模型名 | 参数量 | Template |
282
+ | ----------------------------------------------------------------- | -------------------------------- | -------------------- |
283
+ | [BLOOM/BLOOMZ](https://huggingface.co/bigscience) | 560M/1.1B/1.7B/3B/7.1B/176B | - |
284
+ | [Command R](https://huggingface.co/CohereForAI) | 35B/104B | cohere |
285
+ | [DeepSeek (LLM/Code/MoE)](https://huggingface.co/deepseek-ai) | 7B/16B/67B/236B | deepseek |
286
+ | [DeepSeek 3-3.2](https://huggingface.co/deepseek-ai) | 236B/671B | deepseek3 |
287
+ | [DeepSeek R1 (Distill)](https://huggingface.co/deepseek-ai) | 1.5B/7B/8B/14B/32B/70B/671B | deepseekr1 |
288
+ | [ERNIE-4.5](https://huggingface.co/baidu) | 0.3B/21B/300B | ernie/ernie_nothink |
289
+ | [Falcon/Falcon H1](https://huggingface.co/tiiuae) | 0.5B/1.5B/3B/7B/11B/34B/40B/180B | falcon/falcon_h1 |
290
+ | [Gemma/Gemma 2/CodeGemma](https://huggingface.co/google) | 2B/7B/9B/27B | gemma/gemma2 |
291
+ | [Gemma 3/Gemma 3n](https://huggingface.co/google) | 270M/1B/4B/6B/8B/12B/27B | gemma3/gemma3n |
292
+ | [GLM-4/GLM-4-0414/GLM-Z1](https://huggingface.co/zai-org) | 9B/32B | glm4/glmz1 |
293
+ | [GLM-4.5/GLM-4.5(6)V](https://huggingface.co/zai-org) | 9B/106B/355B | glm4_moe/glm4_5v |
294
+ | [GPT-2](https://huggingface.co/openai-community) | 0.1B/0.4B/0.8B/1.5B | - |
295
+ | [GPT-OSS](https://huggingface.co/openai) | 20B/120B | gpt_oss |
296
+ | [Granite 3-4](https://huggingface.co/ibm-granite) | 1B/2B/3B/7B/8B | granite3/granite4 |
297
+ | [Hunyuan (MT)](https://huggingface.co/tencent/) | 7B | hunyuan |
298
+ | [InternLM 2-3](https://huggingface.co/internlm) | 7B/8B/20B | intern2 |
299
+ | [InternVL 2.5-3.5](https://huggingface.co/OpenGVLab) | 1B/2B/4B/8B/14B/30B/38B/78B/241B | intern_vl |
300
+ | [InternLM/Intern-S1-mini](https://huggingface.co/internlm/) | 8B | intern_s1 |
301
+ | [Kimi-VL](https://huggingface.co/moonshotai) | 16B | kimi_vl |
302
+ | [Ling 2.0 (mini/flash)](https://huggingface.co/inclusionAI) | 16B/100B | bailing_v2 |
303
+ | [Llama](https://github.com/facebookresearch/llama) | 7B/13B/33B/65B | - |
304
+ | [Llama 2](https://huggingface.co/meta-llama) | 7B/13B/70B | llama2 |
305
+ | [Llama 3-3.3](https://huggingface.co/meta-llama) | 1B/3B/8B/70B | llama3 |
306
+ | [Llama 4](https://huggingface.co/meta-llama) | 109B/402B | llama4 |
307
+ | [Llama 3.2 Vision](https://huggingface.co/meta-llama) | 11B/90B | mllama |
308
+ | [LLaVA-1.5](https://huggingface.co/llava-hf) | 7B/13B | llava |
309
+ | [LLaVA-NeXT](https://huggingface.co/llava-hf) | 7B/8B/13B/34B/72B/110B | llava_next |
310
+ | [LLaVA-NeXT-Video](https://huggingface.co/llava-hf) | 7B/34B | llava_next_video |
311
+ | [MiMo](https://huggingface.co/XiaomiMiMo) | 7B/309B | mimo/mimo_v2 |
312
+ | [MiniCPM 1-4.1](https://huggingface.co/openbmb) | 0.5B/1B/2B/4B/8B | cpm/cpm3/cpm4 |
313
+ | [MiniCPM-o-2.6/MiniCPM-V-2.6](https://huggingface.co/openbmb) | 8B | minicpm_o/minicpm_v |
314
+ | [Ministral 3](https://huggingface.co/mistralai) | 3B/8B/14B | ministral3 |
315
+ | [Mistral/Mixtral](https://huggingface.co/mistralai) | 7B/8x7B/8x22B | mistral |
316
+ | [OLMo](https://huggingface.co/allenai) | 1B/7B | - |
317
+ | [PaliGemma/PaliGemma2](https://huggingface.co/google) | 3B/10B/28B | paligemma |
318
+ | [Phi-3/Phi-3.5](https://huggingface.co/microsoft) | 4B/14B | phi |
319
+ | [Phi-3-small](https://huggingface.co/microsoft) | 7B | phi_small |
320
+ | [Phi-4](https://huggingface.co/microsoft) | 14B | phi4 |
321
+ | [Pixtral](https://huggingface.co/mistralai) | 12B | pixtral |
322
+ | [Qwen (1-2.5) (Code/Math/MoE/QwQ)](https://huggingface.co/Qwen) | 0.5B/1.5B/3B/7B/14B/32B/72B/110B | qwen |
323
+ | [Qwen3 (MoE/Instruct/Thinking/Next)](https://huggingface.co/Qwen) | 0.6B/1.7B/4B/8B/14B/32B/80B/235B | qwen3/qwen3_nothink |
324
+ | [Qwen2-Audio](https://huggingface.co/Qwen) | 7B | qwen2_audio |
325
+ | [Qwen2.5-Omni](https://huggingface.co/Qwen) | 3B/7B | qwen2_omni |
326
+ | [Qwen3-Omni](https://huggingface.co/Qwen) | 30B | qwen3_omni |
327
+ | [Qwen2-VL/Qwen2.5-VL/QVQ](https://huggingface.co/Qwen) | 2B/3B/7B/32B/72B | qwen2_vl |
328
+ | [Qwen3-VL](https://huggingface.co/Qwen) | 2B/4B/8B/30B/32B/235B | qwen3_vl |
329
+ | [Seed (OSS/Coder)](https://huggingface.co/ByteDance-Seed) | 8B/36B | seed_oss/seed_coder |
330
+ | [StarCoder 2](https://huggingface.co/bigcode) | 3B/7B/15B | - |
331
+ | [VibeThinker-1.5B](https://huggingface.co/WeiboAI) | 1.5B | qwen3 |
332
+ | [Yi/Yi-1.5 (Code)](https://huggingface.co/01-ai) | 1.5B/6B/9B/34B | yi |
333
+ | [Yuan 2](https://huggingface.co/IEITYuan) | 2B/51B/102B | yuan |
334
+
335
+ > [!NOTE]
336
+ > 对于所有“基座”(Base)模型,`template` 参数可以是 `default`, `alpaca`, `vicuna` 等任意值。但“对话”(Instruct/Chat)模型请务必使用**对应的模板**。
337
+ >
338
+ > 如果模型有推理 / 非推理两个版本,请使用 `_nothink` 后缀来区分不同的模板。例如 `qwen3` 和 `qwen3_nothink`。
339
+ >
340
+ > 请务必在训练和推理时采用**完全一致**的模板。
341
+ >
342
+ > \*:您需要从 main 分支安装 `transformers` 并使用 `DISABLE_VERSION_CHECK=1` 来跳过版本检查。
343
+ >
344
+ > \*\*:您需要安装特定版本的 `transformers` 以使用该模型。
345
+
346
+ 项目所支持模型的完整列表请参阅 [constants.py](src/llamafactory/extras/constants.py)。
347
+
348
+ 您也可以在 [template.py](src/llamafactory/data/template.py) 中添加自己的对话模板。
349
+
350
+ ## 训练方法
351
+
352
+ | 方法 | 全参数训练 | 部分参数训练 | LoRA | QLoRA |
353
+ | --------------------- | ------------------ | ------------------ | ------------------ | ------------------ |
354
+ | 预训练 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
355
+ | 指令监督微调 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
356
+ | 奖励模型训练 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
357
+ | PPO 训练 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
358
+ | DPO 训练 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
359
+ | KTO 训练 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
360
+ | ORPO 训练 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
361
+ | SimPO 训练 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
362
+
363
+ > [!TIP]
364
+ > 有关 PPO 的实现细节,请参考[此博客](https://newfacade.github.io/notes-on-reinforcement-learning/17-ppo-trl.html)。
365
+
366
+ ## 数据集
367
+
368
+ <details><summary>预训练数据集</summary>
369
+
370
+ - [Wiki Demo (en)](data/wiki_demo.txt)
371
+ - [RefinedWeb (en)](https://huggingface.co/datasets/tiiuae/falcon-refinedweb)
372
+ - [RedPajama V2 (en)](https://huggingface.co/datasets/togethercomputer/RedPajama-Data-V2)
373
+ - [Wikipedia (en)](https://huggingface.co/datasets/olm/olm-wikipedia-20221220)
374
+ - [Wikipedia (zh)](https://huggingface.co/datasets/pleisto/wikipedia-cn-20230720-filtered)
375
+ - [Pile (en)](https://huggingface.co/datasets/EleutherAI/pile)
376
+ - [SkyPile (zh)](https://huggingface.co/datasets/Skywork/SkyPile-150B)
377
+ - [FineWeb (en)](https://huggingface.co/datasets/HuggingFaceFW/fineweb)
378
+ - [FineWeb-Edu (en)](https://huggingface.co/datasets/HuggingFaceFW/fineweb-edu)
379
+ - [CCI3-HQ (zh)](https://huggingface.co/datasets/BAAI/CCI3-HQ)
380
+ - [CCI3-Data (zh)](https://huggingface.co/datasets/BAAI/CCI3-Data)
381
+ - [CCI4.0-M2-Base-v1 (en&zh)](https://huggingface.co/datasets/BAAI/CCI4.0-M2-Base-v1)
382
+ - [CCI4.0-M2-CoT-v1 (en&zh)](https://huggingface.co/datasets/BAAI/CCI4.0-M2-CoT-v1)
383
+ - [CCI4.0-M2-Extra-v1 (en&zh)](https://huggingface.co/datasets/BAAI/CCI4.0-M2-Extra-v1)
384
+ - [The Stack (en)](https://huggingface.co/datasets/bigcode/the-stack)
385
+ - [StarCoder (en)](https://huggingface.co/datasets/bigcode/starcoderdata)
386
+
387
+ </details>
388
+
389
+ <details><summary>指令微调数据集</summary>
390
+
391
+ - [Identity (en&zh)](data/identity.json)
392
+ - [Stanford Alpaca (en)](https://github.com/tatsu-lab/stanford_alpaca)
393
+ - [Stanford Alpaca (zh)](https://github.com/ymcui/Chinese-LLaMA-Alpaca-3)
394
+ - [Alpaca GPT4 (en&zh)](https://github.com/Instruction-Tuning-with-GPT-4/GPT-4-LLM)
395
+ - [Glaive Function Calling V2 (en&zh)](https://huggingface.co/datasets/glaiveai/glaive-function-calling-v2)
396
+ - [LIMA (en)](https://huggingface.co/datasets/GAIR/lima)
397
+ - [Guanaco Dataset (multilingual)](https://huggingface.co/datasets/JosephusCheung/GuanacoDataset)
398
+ - [BELLE 2M (zh)](https://huggingface.co/datasets/BelleGroup/train_2M_CN)
399
+ - [BELLE 1M (zh)](https://huggingface.co/datasets/BelleGroup/train_1M_CN)
400
+ - [BELLE 0.5M (zh)](https://huggingface.co/datasets/BelleGroup/train_0.5M_CN)
401
+ - [BELLE Dialogue 0.4M (zh)](https://huggingface.co/datasets/BelleGroup/generated_chat_0.4M)
402
+ - [BELLE School Math 0.25M (zh)](https://huggingface.co/datasets/BelleGroup/school_math_0.25M)
403
+ - [BELLE Multiturn Chat 0.8M (zh)](https://huggingface.co/datasets/BelleGroup/multiturn_chat_0.8M)
404
+ - [UltraChat (en)](https://github.com/thunlp/UltraChat)
405
+ - [OpenPlatypus (en)](https://huggingface.co/datasets/garage-bAInd/Open-Platypus)
406
+ - [CodeAlpaca 20k (en)](https://huggingface.co/datasets/sahil2801/CodeAlpaca-20k)
407
+ - [Alpaca CoT (multilingual)](https://huggingface.co/datasets/QingyiSi/Alpaca-CoT)
408
+ - [OpenOrca (en)](https://huggingface.co/datasets/Open-Orca/OpenOrca)
409
+ - [SlimOrca (en)](https://huggingface.co/datasets/Open-Orca/SlimOrca)
410
+ - [MathInstruct (en)](https://huggingface.co/datasets/TIGER-Lab/MathInstruct)
411
+ - [Firefly 1.1M (zh)](https://huggingface.co/datasets/YeungNLP/firefly-train-1.1M)
412
+ - [Wiki QA (en)](https://huggingface.co/datasets/wiki_qa)
413
+ - [Web QA (zh)](https://huggingface.co/datasets/suolyer/webqa)
414
+ - [WebNovel (zh)](https://huggingface.co/datasets/zxbsmk/webnovel_cn)
415
+ - [Nectar (en)](https://huggingface.co/datasets/berkeley-nest/Nectar)
416
+ - [deepctrl (en&zh)](https://www.modelscope.cn/datasets/deepctrl/deepctrl-sft-data)
417
+ - [Advertise Generating (zh)](https://huggingface.co/datasets/HasturOfficial/adgen)
418
+ - [ShareGPT Hyperfiltered (en)](https://huggingface.co/datasets/totally-not-an-llm/sharegpt-hyperfiltered-3k)
419
+ - [ShareGPT4 (en&zh)](https://huggingface.co/datasets/shibing624/sharegpt_gpt4)
420
+ - [UltraChat 200k (en)](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k)
421
+ - [Infinity Instruct (zh)](https://huggingface.co/datasets/BAAI/Infinity-Instruct)
422
+ - [AgentInstruct (en)](https://huggingface.co/datasets/THUDM/AgentInstruct)
423
+ - [LMSYS Chat 1M (en)](https://huggingface.co/datasets/lmsys/lmsys-chat-1m)
424
+ - [Evol Instruct V2 (en)](https://huggingface.co/datasets/WizardLM/WizardLM_evol_instruct_V2_196k)
425
+ - [Cosmopedia (en)](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia)
426
+ - [STEM (zh)](https://huggingface.co/datasets/hfl/stem_zh_instruction)
427
+ - [Ruozhiba (zh)](https://huggingface.co/datasets/hfl/ruozhiba_gpt4_turbo)
428
+ - [Neo-sft (zh)](https://huggingface.co/datasets/m-a-p/neo_sft_phase2)
429
+ - [Magpie-Pro-300K-Filtered (en)](https://huggingface.co/datasets/Magpie-Align/Magpie-Pro-300K-Filtered)
430
+ - [Magpie-ultra-v0.1 (en)](https://huggingface.co/datasets/argilla/magpie-ultra-v0.1)
431
+ - [WebInstructSub (en)](https://huggingface.co/datasets/TIGER-Lab/WebInstructSub)
432
+ - [OpenO1-SFT (en&zh)](https://huggingface.co/datasets/O1-OPEN/OpenO1-SFT)
433
+ - [Open-Thoughts (en)](https://huggingface.co/datasets/open-thoughts/OpenThoughts-114k)
434
+ - [Open-R1-Math (en)](https://huggingface.co/datasets/open-r1/OpenR1-Math-220k)
435
+ - [Chinese-DeepSeek-R1-Distill (zh)](https://huggingface.co/datasets/Congliu/Chinese-DeepSeek-R1-Distill-data-110k-SFT)
436
+ - [LLaVA mixed (en&zh)](https://huggingface.co/datasets/BUAADreamer/llava-en-zh-300k)
437
+ - [Pokemon-gpt4o-captions (en&zh)](https://huggingface.co/datasets/jugg1024/pokemon-gpt4o-captions)
438
+ - [Open Assistant (de)](https://huggingface.co/datasets/mayflowergmbh/oasst_de)
439
+ - [Dolly 15k (de)](https://huggingface.co/datasets/mayflowergmbh/dolly-15k_de)
440
+ - [Alpaca GPT4 (de)](https://huggingface.co/datasets/mayflowergmbh/alpaca-gpt4_de)
441
+ - [OpenSchnabeltier (de)](https://huggingface.co/datasets/mayflowergmbh/openschnabeltier_de)
442
+ - [Evol Instruct (de)](https://huggingface.co/datasets/mayflowergmbh/evol-instruct_de)
443
+ - [Dolphin (de)](https://huggingface.co/datasets/mayflowergmbh/dolphin_de)
444
+ - [Booksum (de)](https://huggingface.co/datasets/mayflowergmbh/booksum_de)
445
+ - [Airoboros (de)](https://huggingface.co/datasets/mayflowergmbh/airoboros-3.0_de)
446
+ - [Ultrachat (de)](https://huggingface.co/datasets/mayflowergmbh/ultra-chat_de)
447
+
448
+ </details>
449
+
450
+ <details><summary>偏好数据集</summary>
451
+
452
+ - [DPO mixed (en&zh)](https://huggingface.co/datasets/hiyouga/DPO-En-Zh-20k)
453
+ - [UltraFeedback (en)](https://huggingface.co/datasets/HuggingFaceH4/ultrafeedback_binarized)
454
+ - [COIG-P (zh)](https://huggingface.co/datasets/m-a-p/COIG-P)
455
+ - [RLHF-V (en)](https://huggingface.co/datasets/openbmb/RLHF-V-Dataset)
456
+ - [VLFeedback (en)](https://huggingface.co/datasets/Zhihui/VLFeedback)
457
+ - [RLAIF-V (en)](https://huggingface.co/datasets/openbmb/RLAIF-V-Dataset)
458
+ - [Orca DPO Pairs (en)](https://huggingface.co/datasets/Intel/orca_dpo_pairs)
459
+ - [HH-RLHF (en)](https://huggingface.co/datasets/Anthropic/hh-rlhf)
460
+ - [Nectar (en)](https://huggingface.co/datasets/berkeley-nest/Nectar)
461
+ - [Orca DPO (de)](https://huggingface.co/datasets/mayflowergmbh/intel_orca_dpo_pairs_de)
462
+ - [KTO mixed (en)](https://huggingface.co/datasets/argilla/kto-mix-15k)
463
+
464
+ </details>
465
+
466
+ 部分数据集的使用需要确认,我们推荐使用下述命令登录您的 Hugging Face 账户。
467
+
468
+ ```bash
469
+ pip install --upgrade huggingface_hub
470
+ huggingface-cli login
471
+ ```
472
+
473
+ ## 软硬件依赖
474
+
475
+ | 必需项 | 至少 | 推荐 |
476
+ | ------------ | ------- | --------- |
477
+ | python | 3.9 | 3.10 |
478
+ | torch | 2.0.0 | 2.6.0 |
479
+ | torchvision | 0.15.0 | 0.21.0 |
480
+ | transformers | 4.49.0 | 4.50.0 |
481
+ | datasets | 2.16.0 | 3.2.0 |
482
+ | accelerate | 0.34.0 | 1.2.1 |
483
+ | peft | 0.14.0 | 0.15.1 |
484
+ | trl | 0.8.6 | 0.9.6 |
485
+
486
+ | 可选项 | 至少 | 推荐 |
487
+ | ------------ | ------- | --------- |
488
+ | CUDA | 11.6 | 12.2 |
489
+ | deepspeed | 0.10.0 | 0.16.4 |
490
+ | bitsandbytes | 0.39.0 | 0.43.1 |
491
+ | vllm | 0.4.3 | 0.8.2 |
492
+ | flash-attn | 2.5.6 | 2.7.2 |
493
+
494
+ ### 硬件依赖
495
+
496
+ \* *估算值*
497
+
498
+ | 方法 | 精度 | 7B | 14B | 30B | 70B | `x`B |
499
+ | ------------------------------- | ---- | ----- | ----- | ----- | ------ | ------- |
500
+ | Full (`bf16` or `fp16`) | 32 | 120GB | 240GB | 600GB | 1200GB | `18x`GB |
501
+ | Full (`pure_bf16`) | 16 | 60GB | 120GB | 300GB | 600GB | `8x`GB |
502
+ | Freeze/LoRA/GaLore/APOLLO/BAdam | 16 | 16GB | 32GB | 64GB | 160GB | `2x`GB |
503
+ | QLoRA | 8 | 10GB | 20GB | 40GB | 80GB | `x`GB |
504
+ | QLoRA | 4 | 6GB | 12GB | 24GB | 48GB | `x/2`GB |
505
+ | QLoRA | 2 | 4GB | 8GB | 16GB | 24GB | `x/4`GB |
506
+
507
+ ## 如何使用
508
+
509
+ ### 安装 LLaMA Factory
510
+
511
+ > [!IMPORTANT]
512
+ > 此步骤为必需。
513
+
514
+ #### 从源码安装
515
+
516
+ ```bash
517
+ git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git
518
+ cd LLaMA-Factory
519
+ pip install -e ".[torch,metrics]" --no-build-isolation
520
+ ```
521
+
522
+ 可选的额外依赖项:torch���torch-npu、metrics、deepspeed、liger-kernel、bitsandbytes、hqq、eetq、gptq、aqlm、vllm、sglang、galore、apollo、badam、adam-mini、qwen、minicpm_v、openmind、swanlab、dev
523
+
524
+ #### 从镜像安装
525
+
526
+ ```bash
527
+ docker run -it --rm --gpus=all --ipc=host hiyouga/llamafactory:latest
528
+ ```
529
+
530
+ 该镜像基于 Ubuntu 22.04(x86\_64)、CUDA 12.4、Python 3.11、PyTorch 2.6.0 和 Flash-attn 2.7.4 构建。
531
+
532
+ 查看全部镜像:https://hub.docker.com/r/hiyouga/llamafactory/tags
533
+
534
+ 请参阅[构建 Docker](#构建-docker) 来重新构建镜像。
535
+
536
+ <details><summary>使用 <b>uv</b> 构建虚拟环境</summary>
537
+
538
+ 使用 [uv](https://github.com/astral-sh/uv) 创建隔离的 Python 环境:
539
+
540
+ ```bash
541
+ uv sync --extra torch --extra metrics --prerelease=allow
542
+ ```
543
+
544
+ 在环境中运行 LLaMA-Factory:
545
+
546
+ ```bash
547
+ uv run --prerelease=allow llamafactory-cli train examples/train_lora/llama3_lora_pretrain.yaml
548
+ ```
549
+
550
+ </details>
551
+
552
+ <details><summary>Windows 用户指南</summary>
553
+
554
+ #### 安装 PyTorch
555
+
556
+ Windows 平台需要额外手动安装 GPU 版本的 PyTorch 依赖包,您可以参考[官方网站](https://pytorch.org/get-started/locally/)和以下命令安装并测试 PyTorch 是否正确安装。
557
+
558
+ ```bash
559
+ pip uninstall torch torchvision torchaudio
560
+ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
561
+ python -c "import torch; print(torch.cuda.is_available())"
562
+ ```
563
+
564
+ 如果看到 `True` 则说明安装成功。
565
+
566
+ 若遇到类似 `Can't pickle local object` 的报错,请设置 `dataloader_num_workers: 0`。
567
+
568
+ #### 安装 BitsAndBytes
569
+
570
+ 如果要在 Windows 平台上开启量化 LoRA(QLoRA),需要安装预编译的 `bitsandbytes` 库, 支持 CUDA 11.1 到 12.2, 请根据您的 CUDA 版本情况选择适合的[发布版本](https://github.com/jllllll/bitsandbytes-windows-webui/releases/tag/wheels)。
571
+
572
+ ```bash
573
+ pip install https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.2.post2-py3-none-win_amd64.whl
574
+ ```
575
+
576
+ #### 安装 Flash Attention-2
577
+
578
+ 如果要在 Windows 平台上开启 FlashAttention-2,请使用 [flash-attention-windows-wheel](https://huggingface.co/lldacing/flash-attention-windows-wheel) 中的脚本自行编译与安装。
579
+
580
+ </details>
581
+
582
+ <details><summary>昇腾 NPU 用户指南</summary>
583
+
584
+ 在昇腾 NPU 设备上安装 LLaMA Factory 时,请升级 Python 到 3.10 及以上,并需要指定额外依赖项,使用 `pip install -e ".[torch-npu,metrics]"` 命令安装。此外,还需要安装 **[Ascend CANN Toolkit 与 Kernels](https://www.hiascend.com/developer/download/community/result?module=cann)**,安装方法请参考[安装教程](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/80RC2alpha002/quickstart/quickstart/quickstart_18_0004.html)或使用以下命令:
585
+
586
+ ```bash
587
+ # 请替换 URL 为 CANN 版本和设备型号对应的 URL
588
+ # 安装 CANN Toolkit
589
+ 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
590
+ bash Ascend-cann-toolkit_8.0.RC1.alpha001_linux-"$(uname -i)".run --install
591
+
592
+ # 安装 CANN Kernels
593
+ 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
594
+ bash Ascend-cann-kernels-910b_8.0.RC1.alpha001_linux.run --install
595
+
596
+ # 设置环境变量
597
+ source /usr/local/Ascend/ascend-toolkit/set_env.sh
598
+ ```
599
+
600
+ | 依赖项 | 至少 | 推荐 |
601
+ | ------------ | ------- | -------------- |
602
+ | CANN | 8.0.RC1 | 8.0.0.alpha002 |
603
+ | torch | 2.1.0 | 2.4.0 |
604
+ | torch-npu | 2.1.0 | 2.4.0.post2 |
605
+ | deepspeed | 0.13.2 | 0.13.2 |
606
+ | vllm-ascend | - | 0.7.3 |
607
+
608
+ 请使用 `ASCEND_RT_VISIBLE_DEVICES` 而非 `CUDA_VISIBLE_DEVICES` 来指定运算设备。
609
+
610
+ 如果遇到无法正常推理的情况,请尝试设置 `do_sample: false`。
611
+
612
+ 下载预构建 Docker 镜像:[32GB](http://mirrors.cn-central-221.ovaijisuan.com/detail/130.html) | [64GB](http://mirrors.cn-central-221.ovaijisuan.com/detail/131.html)
613
+
614
+ #### 安装 BitsAndBytes
615
+
616
+ 如果要在 Ascend NPU 上进行基于 bitsandbytes 的 QLoRA 量化微调,请执行如下步骤:
617
+
618
+ 1. 手动编译 bitsandbytes:请参考[安装文档](https://huggingface.co/docs/bitsandbytes/installation?backend=Ascend+NPU&platform=Ascend+NPU)完成 NPU 版的 bitsandbytes 安装,编译要求环境 cmake 版本不低于 3.22.1,g++ 版本不低于 12.x。
619
+
620
+ ```bash
621
+ # 从源码安装 bitsandbytes
622
+ # 克隆 bitsandbytes 仓库, Ascend NPU 目前在 multi-backend-refactor 中支持
623
+ git clone -b multi-backend-refactor https://github.com/bitsandbytes-foundation/bitsandbytes.git
624
+ cd bitsandbytes/
625
+
626
+ # 安装依赖
627
+ pip install -r requirements-dev.txt
628
+
629
+ # 安装编译工具依赖,该步骤在不同系统上命令有所不同,供参考
630
+ apt-get install -y build-essential cmake
631
+
632
+ # 编译 & 安装
633
+ cmake -DCOMPUTE_BACKEND=npu -S .
634
+ make
635
+ pip install .
636
+ ```
637
+
638
+ 2. 安装 transformers 的 main 分支版本。
639
+
640
+ ```bash
641
+ git clone -b main https://github.com/huggingface/transformers.git
642
+ cd transformers
643
+ pip install .
644
+ ```
645
+
646
+ 3. 在训练参数中设置 `double_quantization: false`,可参考[示例](examples/train_qlora/llama3_lora_sft_bnb_npu.yaml)。
647
+
648
+ </details>
649
+
650
+ ### 数据准备
651
+
652
+ 关于数据集文件的格式,请参考 [data/README_zh.md](data/README_zh.md) 的内容。你可以使用 HuggingFace / ModelScope / Modelers 上的数据集或加载本地数据集。
653
+
654
+ > [!NOTE]
655
+ > 使用自定义数据集时,请更新 `data/dataset_info.json` 文件。
656
+
657
+ 您也可以使用 **[Easy Dataset](https://github.com/ConardLi/easy-dataset)**、**[DataFlow](https://github.com/OpenDCAI/DataFlow)** 和 **[GraphGen](https://github.com/open-sciencelab/GraphGen)** 构建用于微调的合成数据。
658
+
659
+ ### 快速开始
660
+
661
+ 下面三行命令分别对 Llama3-8B-Instruct 模型进行 LoRA **微调**、**推理**和**合并**。
662
+
663
+ ```bash
664
+ llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
665
+ llamafactory-cli chat examples/inference/llama3_lora_sft.yaml
666
+ llamafactory-cli export examples/merge_lora/llama3_lora_sft.yaml
667
+ ```
668
+
669
+ 高级用法请参考 [examples/README_zh.md](examples/README_zh.md)(包括多 GPU 微调)。
670
+
671
+ > [!TIP]
672
+ > 使用 `llamafactory-cli help` 显示帮助信息。
673
+ >
674
+ > 遇到报错请先看[常见问题](https://github.com/hiyouga/LLaMA-Factory/issues/4614)。
675
+
676
+ ### LLaMA Board 可视化微调(由 [Gradio](https://github.com/gradio-app/gradio) 驱动)
677
+
678
+ ```bash
679
+ llamafactory-cli webui
680
+ ```
681
+
682
+ ### LLaMA Factory Online 在线微调
683
+
684
+ 详情阅读该[文档](https://docs.llamafactory.com.cn/docs/documents/quickstart/getstarted/?utm_source=LLaMA-Factory)。
685
+
686
+ ### 构建 Docker
687
+
688
+ CUDA 用户:
689
+
690
+ ```bash
691
+ cd docker/docker-cuda/
692
+ docker compose up -d
693
+ docker compose exec llamafactory bash
694
+ ```
695
+
696
+ 昇腾 NPU 用户:
697
+
698
+ ```bash
699
+ cd docker/docker-npu/
700
+ docker compose up -d
701
+ docker compose exec llamafactory bash
702
+ ```
703
+
704
+ AMD ROCm 用户:
705
+
706
+ ```bash
707
+ cd docker/docker-rocm/
708
+ docker compose up -d
709
+ docker compose exec llamafactory bash
710
+ ```
711
+
712
+ <details><summary>不使用 Docker Compose 构建</summary>
713
+
714
+ CUDA 用户:
715
+
716
+ ```bash
717
+ docker build -f ./docker/docker-cuda/Dockerfile \
718
+ --build-arg PIP_INDEX=https://pypi.org/simple \
719
+ --build-arg EXTRAS=metrics \
720
+ -t llamafactory:latest .
721
+
722
+ docker run -dit --ipc=host --gpus=all \
723
+ -p 7860:7860 \
724
+ -p 8000:8000 \
725
+ --name llamafactory \
726
+ llamafactory:latest
727
+
728
+ docker exec -it llamafactory bash
729
+ ```
730
+
731
+ 昇腾 NPU 用户:
732
+
733
+ ```bash
734
+ docker build -f ./docker/docker-npu/Dockerfile \
735
+ --build-arg PIP_INDEX=https://pypi.org/simple \
736
+ --build-arg EXTRAS=torch-npu,metrics \
737
+ -t llamafactory:latest .
738
+
739
+ docker run -dit --ipc=host \
740
+ -v /usr/local/dcmi:/usr/local/dcmi \
741
+ -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
742
+ -v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
743
+ -v /etc/ascend_install.info:/etc/ascend_install.info \
744
+ -p 7860:7860 \
745
+ -p 8000:8000 \
746
+ --device /dev/davinci0 \
747
+ --device /dev/davinci_manager \
748
+ --device /dev/devmm_svm \
749
+ --device /dev/hisi_hdc \
750
+ --name llamafactory \
751
+ llamafactory:latest
752
+
753
+ docker exec -it llamafactory bash
754
+ ```
755
+
756
+ AMD ROCm 用户:
757
+
758
+ ```bash
759
+ docker build -f ./docker/docker-rocm/Dockerfile \
760
+ --build-arg PIP_INDEX=https://pypi.org/simple \
761
+ --build-arg EXTRAS=metrics \
762
+ -t llamafactory:latest .
763
+
764
+ docker run -dit --ipc=host \
765
+ -p 7860:7860 \
766
+ -p 8000:8000 \
767
+ --device /dev/kfd \
768
+ --device /dev/dri \
769
+ --name llamafactory \
770
+ llamafactory:latest
771
+
772
+ docker exec -it llamafactory bash
773
+ ```
774
+
775
+ </details>
776
+
777
+ <details><summary>使用数据卷</summary>
778
+
779
+ 您可以通过移除 Dockerfile 中 `VOLUME [ "/root/.cache/huggingface", "/app/shared_data", "/app/output" ]` 的注释来使用数据卷。
780
+
781
+ 在构建 Docker 时使用参数 `-v ./hf_cache:/root/.cache/huggingface` 来挂载数据卷。各个数据卷的含义表示如下。
782
+
783
+ - `hf_cache`:使用宿主机的 Hugging Face 缓存文件夹。
784
+ - `shared_data`:宿主机中存放数据集的文件夹路径。
785
+ - `output`:将导出目录设置为该路径后,即可在宿主机中访问导出后的模型。
786
+
787
+ </details>
788
+
789
+ ### 利用 vLLM 部署 OpenAI API
790
+
791
+ ```bash
792
+ API_PORT=8000 llamafactory-cli api examples/inference/llama3.yaml infer_backend=vllm vllm_enforce_eager=true
793
+ ```
794
+
795
+ > [!TIP]
796
+ > API 文档请查阅[这里](https://platform.openai.com/docs/api-reference/chat/create)。
797
+ >
798
+ > 示例:[图像理解](scripts/api_example/test_image.py) | [工具调用](scripts/api_example/test_toolcall.py)
799
+
800
+ ### 从魔搭社区下载
801
+
802
+ 如果您在 Hugging Face 模型和数据集的下载中遇到了问题,可以通过下述方法使用魔搭社区。
803
+
804
+ ```bash
805
+ export USE_MODELSCOPE_HUB=1 # Windows 使用 `set USE_MODELSCOPE_HUB=1`
806
+ ```
807
+
808
+ 将 `model_name_or_path` 设置为模型 ID 来加载对应的模型。在[魔搭社区](https://modelscope.cn/models)查看所有可用的模型,例如 `LLM-Research/Meta-Llama-3-8B-Instruct`。
809
+
810
+ ### 从魔乐社区下载
811
+
812
+ 您也可以通过下述方法,使用魔乐社区下载数据集和模型。
813
+
814
+ ```bash
815
+ export USE_OPENMIND_HUB=1 # Windows 使用 `set USE_OPENMIND_HUB=1`
816
+ ```
817
+
818
+ 将 `model_name_or_path` 设置为模型 ID 来加载对应的模型。在[魔乐社区](https://modelers.cn/models)查看所有可用的模型,例如 `TeleAI/TeleChat-7B-pt`。
819
+
820
+ ### 使用 W&B 面板
821
+
822
+ 若要使用 [Weights & Biases](https://wandb.ai) 记录实验数据,请在 yaml 文件中添加下面的参数。
823
+
824
+ ```yaml
825
+ report_to: wandb
826
+ run_name: test_run # 可选
827
+ ```
828
+
829
+ 在启动训练任务时,将 `WANDB_API_KEY` 设置为[密钥](https://wandb.ai/authorize)来登录 W&B 账户。
830
+
831
+ ### 使用 SwanLab 面板
832
+
833
+ 若要使用 [SwanLab](https://github.com/SwanHubX/SwanLab) 记录实验数据,请在 yaml 文件中添加下面的参数。
834
+
835
+ ```yaml
836
+ use_swanlab: true
837
+ swanlab_run_name: test_run # 可选
838
+ ```
839
+
840
+ 在启动训练任务时,登录SwanLab账户有以下三种方式:
841
+
842
+ 方式一:在 yaml 文件中添加 `swanlab_api_key=<your_api_key>` ,并设置为你的 [API 密钥](https://swanlab.cn/settings)。
843
+ 方式二:将环境变量 `SWANLAB_API_KEY` 设置为你的 [API 密钥](https://swanlab.cn/settings)。
844
+ 方式三:启动前使用 `swanlab login` 命令完成登录。
845
+
846
+ ## 使用了 LLaMA Factory 的项目
847
+
848
+ 如果您有项目希望添加至下述列表,请通过邮件联系或者创建一个 PR。
849
+
850
+ <details><summary>点击显示</summary>
851
+
852
+ 1. Wang et al. ESRL: Efficient Sampling-based Reinforcement Learning for Sequence Generation. 2023. [[arxiv]](https://arxiv.org/abs/2308.02223)
853
+ 1. Yu et al. Open, Closed, or Small Language Models for Text Classification? 2023. [[arxiv]](https://arxiv.org/abs/2308.10092)
854
+ 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)
855
+ 1. Luceri et al. Leveraging Large Language Models to Detect Influence Campaigns in Social Media. 2023. [[arxiv]](https://arxiv.org/abs/2311.07816)
856
+ 1. Zhang et al. Alleviating Hallucinations of Large Language Models through Induced Hallucinations. 2023. [[arxiv]](https://arxiv.org/abs/2312.15710)
857
+ 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)
858
+ 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)
859
+ 1. Choi et al. FACT-GPT: Fact-Checking Augmentation via Claim Matching with LLMs. 2024. [[arxiv]](https://arxiv.org/abs/2402.05904)
860
+ 1. Zhang et al. AutoMathText: Autonomous Data Selection with Language Models for Mathematical Texts. 2024. [[arxiv]](https://arxiv.org/abs/2402.07625)
861
+ 1. Lyu et al. KnowTuning: Knowledge-aware Fine-tuning for Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2402.11176)
862
+ 1. Yang et al. LaCo: Large Language Model Pruning via Layer Collaps. 2024. [[arxiv]](https://arxiv.org/abs/2402.11187)
863
+ 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)
864
+ 1. Yang et al. Enhancing Empathetic Response Generation by Augmenting LLMs with Small-scale Empathetic Models. 2024. [[arxiv]](https://arxiv.org/abs/2402.11801)
865
+ 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)
866
+ 1. Cao et al. Head-wise Shareable Attention for Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2402.11819)
867
+ 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)
868
+ 1. Kim et al. Efficient and Effective Vocabulary Expansion Towards Multilingual Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2402.14714)
869
+ 1. Yu et al. KIEval: A Knowledge-grounded Interactive Evaluation Framework for Large Language Models. ACL 2024. [[arxiv]](https://arxiv.org/abs/2402.15043)
870
+ 1. Huang et al. Key-Point-Driven Data Synthesis with its Enhancement on Mathematical Reasoning. 2024. [[arxiv]](https://arxiv.org/abs/2403.02333)
871
+ 1. Duan et al. Negating Negatives: Alignment without Human Positive Samples via Distributional Dispreference Optimization. 2024. [[arxiv]](https://arxiv.org/abs/2403.03419)
872
+ 1. Xie and Schwertfeger. Empowering Robotics with Large Language Models: osmAG Map Comprehension with LLMs. 2024. [[arxiv]](https://arxiv.org/abs/2403.08228)
873
+ 1. Wu et al. Large Language Models are Parallel Multilingual Learners. 2024. [[arxiv]](https://arxiv.org/abs/2403.09073)
874
+ 1. Zhang et al. EDT: Improving Large Language Models' Generation by Entropy-based Dynamic Temperature Sampling. 2024. [[arxiv]](https://arxiv.org/abs/2403.14541)
875
+ 1. Weller et al. FollowIR: Evaluating and Teaching Information Retrieval Models to Follow Instructions. 2024. [[arxiv]](https://arxiv.org/abs/2403.15246)
876
+ 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)
877
+ 1. Zan et al. CodeS: Natural Language to Code Repository via Multi-Layer Sketch. 2024. [[arxiv]](https://arxiv.org/abs/2403.16443)
878
+ 1. Liu et al. Extensive Self-Contrast Enables Feedback-Free Language Model Alignment. 2024. [[arxiv]](https://arxiv.org/abs/2404.00604)
879
+ 1. Luo et al. BAdam: A Memory Efficient Full Parameter Training Method for Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2404.02827)
880
+ 1. Du et al. Chinese Tiny LLM: Pretraining a Chinese-Centric Large Language Model. 2024. [[arxiv]](https://arxiv.org/abs/2404.04167)
881
+ 1. Ma et al. Parameter Efficient Quasi-Orthogonal Fine-Tuning via Givens Rotation. ICML 2024. [[arxiv]](https://arxiv.org/abs/2404.04316)
882
+ 1. Liu et al. Dynamic Generation of Personalities with Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2404.07084)
883
+ 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)
884
+ 1. Huang et al. LLMTune: Accelerate Database Knob Tuning with Large Language Models. 2024. [[arxiv]](https://arxiv.org/abs/2404.11581)
885
+ 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)
886
+ 1. Acikgoz et al. Hippocrates: An Open-Source Framework for Advancing Large Language Models in Healthcare. 2024. [[arxiv]](https://arxiv.org/abs/2404.16621)
887
+ 1. Zhang et al. Small Language Models Need Strong Verifiers to Self-Correct Reasoning. ACL 2024 Findings. [[arxiv]](https://arxiv.org/abs/2404.17140)
888
+ 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)
889
+ 1. Xu et al. Large Language Models for Cyber Security: A Systematic Literature Review. 2024. [[arxiv]](https://arxiv.org/abs/2405.04760)
890
+ 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)
891
+ 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)
892
+ 1. Lou et al. SPO: Multi-Dimensional Preference Sequential Alignment With Implicit Reward Modeling. 2024. [[arxiv]](https://arxiv.org/abs/2405.12739)
893
+ 1. Zhang et al. Getting More from Less: Large Language Models are Good Spontaneous Multilingual Learners. 2024. [[arxiv]](https://arxiv.org/abs/2405.13816)
894
+ 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)
895
+ 1. Zihong Chen. Sentence Segmentation and Sentence Punctuation Based on XunziALLM. 2024. [[paper]](https://aclanthology.org/2024.lt4hala-1.30)
896
+ 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)
897
+ 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)
898
+ 1. Hu et al. Computational Limits of Low-Rank Adaptation (LoRA) for Transformer-Based Models. 2024. [[arxiv]](https://arxiv.org/abs/2406.03136)
899
+ 1. Ge et al. Time Sensitive Knowledge Editing through Efficient Finetuning. ACL 2024. [[arxiv]](https://arxiv.org/abs/2406.04496)
900
+ 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)
901
+ 1. Song et al. Turbo Sparse: Achieving LLM SOTA Performance with Minimal Activated Parameters. 2024. [[arxiv]](https://arxiv.org/abs/2406.05955)
902
+ 1. Gu et al. RWKV-CLIP: A Robust Vision-Language Representation Learner. 2024. [[arxiv]](https://arxiv.org/abs/2406.06973)
903
+ 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)
904
+ 1. Zhu et al. Are Large Language Models Good Statisticians?. 2024. [[arxiv]](https://arxiv.org/abs/2406.07815)
905
+ 1. Li et al. Know the Unknown: An Uncertainty-Sensitive Method for LLM Instruction Tuning. 2024. [[arxiv]](https://arxiv.org/abs/2406.10099)
906
+ 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)
907
+ 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)
908
+ 1. Lin et al. FVEL: Interactive Formal Verification Environment with Large Language Models via Theorem Proving. 2024. [[arxiv]](https://arxiv.org/abs/2406.14408)
909
+ 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)
910
+ 1. Feng et al. SS-Bench: A Benchmark for Social Story Generation and Evaluation. 2024. [[arxiv]](https://arxiv.org/abs/2406.15695)
911
+ 1. Feng et al. Self-Constructed Context Decompilation with Fined-grained Alignment Enhancement. 2024. [[arxiv]](https://arxiv.org/abs/2406.17233)
912
+ 1. Liu et al. Large Language Models for Cuffless Blood Pressure Measurement From Wearable Biosignals. 2024. [[arxiv]](https://arxiv.org/abs/2406.18069)
913
+ 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)
914
+ 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)
915
+ 1. Yang et al. Financial Knowledge Large Language Model. 2024. [[arxiv]](https://arxiv.org/abs/2407.00365)
916
+ 1. Lin et al. DogeRM: Equipping Reward Models with Domain Knowledge through Model Merging. 2024. [[arxiv]](https://arxiv.org/abs/2407.01470)
917
+ 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)
918
+ 1. Huang et al. RoLoRA: Fine-tuning Rotated Outlier-free LLMs for Effective Weight-Activation Quantization. 2024. [[arxiv]](https://arxiv.org/abs/2407.08044)
919
+ 1. Jiang et al. LLM-Collaboration on Automatic Science Journalism for the General Audience. 2024. [[arxiv]](https://arxiv.org/abs/2407.09756)
920
+ 1. Inouye et al. Applied Auto-tuning on LoRA Hyperparameters. 2024. [[paper]](https://scholarcommons.scu.edu/cseng_senior/272/)
921
+ 1. Qi et al. Research on Tibetan Tourism Viewpoints information generation system based on LLM. 2024. [[arxiv]](https://arxiv.org/abs/2407.13561)
922
+ 1. Xu et al. Course-Correction: Safety Alignment Using Synthetic Preferences. 2024. [[arxiv]](https://arxiv.org/abs/2407.16637)
923
+ 1. Sun et al. LAMBDA: A Large Model Based Data Agent. 2024. [[arxiv]](https://arxiv.org/abs/2407.17535)
924
+ 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)
925
+ 1. Yu et al. Correcting Negative Bias in Large Language Models through Negative Attention Score Alignment. 2024. [[arxiv]](https://arxiv.org/abs/2408.00137)
926
+ 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)
927
+ 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)
928
+ 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)
929
+ 1. Xia et al. Understanding the Performance and Estimating the Cost of LLM Fine-Tuning. 2024. [[arxiv]](https://arxiv.org/abs/2408.04693)
930
+ 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)
931
+ 1. Xia et al. Using Pre-trained Language Model for Accurate ESG Prediction. FinNLP 2024. [[paper]](https://aclanthology.org/2024.finnlp-2.1/)
932
+ 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)
933
+ 1. Bai et al. Aligning Large Language Model with Direct Multi-Preference Optimization for Recommendation. CIKM 2024. [[paper]](https://dl.acm.org/doi/10.1145/3627673.3679611)
934
+ 1. **[StarWhisper](https://github.com/Yu-Yang-Li/StarWhisper)**: 天文大模型 StarWhisper,基于 ChatGLM2-6B 和 Qwen-14B 在天文数据上微调而得。
935
+ 1. **[DISC-LawLLM](https://github.com/FudanDISC/DISC-LawLLM)**: 中文法律领域大模型 DISC-LawLLM,基于 Baichuan-13B 微调而得,具有法律推理和知识检索能力。
936
+ 1. **[Sunsimiao](https://github.com/X-D-Lab/Sunsimiao)**: 孙思邈中文医疗大模型 Sumsimiao,基于 Baichuan-7B 和 ChatGLM-6B 在中文医疗数据上微调而得。
937
+ 1. **[CareGPT](https://github.com/WangRongsheng/CareGPT)**: 医疗大模型项目 CareGPT,基于 LLaMA2-7B 和 Baichuan-13B 在中文医疗数据上微调而得。
938
+ 1. **[MachineMindset](https://github.com/PKU-YuanGroup/Machine-Mindset/)**:MBTI性格大模型项目,根据数据集与训练方式让任意 LLM 拥有 16 个不同的性格类型。
939
+ 1. **[Luminia-13B-v3](https://huggingface.co/Nekochu/Luminia-13B-v3)**:一个用于生成 Stable Diffusion 提示词的大型语言模型。[[demo]](https://huggingface.co/spaces/Nekochu/Luminia-13B_SD_Prompt)
940
+ 1. **[Chinese-LLaVA-Med](https://github.com/BUAADreamer/Chinese-LLaVA-Med)**:中文多模态医学大模型,基于 LLaVA-1.5-7B 在中文多模态医疗数据上微调而得。
941
+ 1. **[AutoRE](https://github.com/THUDM/AutoRE)**:基于大语言模型的文档级关系抽取系统。
942
+ 1. **[NVIDIA RTX AI Toolkit](https://github.com/NVIDIA/RTX-AI-Toolkit)**:在 Windows 主机上利用英伟达 RTX 设备进行大型语言模型微调的开发包。
943
+ 1. **[LazyLLM](https://github.com/LazyAGI/LazyLLM)**:一个低代码构建多 Agent 大模型应用的开发工具,支持基于 LLaMA Factory 的模型微调.
944
+ 1. **[RAG-Retrieval](https://github.com/NLPJCL/RAG-Retrieval)**:一个全链路 RAG 检索模型微调、推理和蒸馏代码库。[[blog]](https://zhuanlan.zhihu.com/p/987727357)
945
+ 1. **[360-LLaMA-Factory](https://github.com/Qihoo360/360-LLaMA-Factory)**:一个魔改后的代码库,通过 Ring Attention 支持长序列的 SFT 和 DPO 训练。
946
+ 1. **[Sky-T1](https://novasky-ai.github.io/posts/sky-t1/)**:由 NovaSky AI 微调的低成本类 o1 长推理模型。
947
+ 1. **[WeClone](https://github.com/xming521/WeClone)**:从聊天记录创造数字分身的一站式解决方案。
948
+
949
+ </details>
950
+
951
+ ## 协议
952
+
953
+ 本仓库的代码依照 [Apache-2.0](LICENSE) 协议开源。
954
+
955
+ 使用模型权重时,请遵循对应的模型协议:[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) / [GPT-2](https://github.com/openai/gpt-2/blob/master/LICENSE) / [Granite](LICENSE) / [Index](https://huggingface.co/IndexTeam/Index-1.9B/blob/main/LICENSE) / [InternLM](https://github.com/InternLM/InternLM#license) / [Llama](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md) / [Llama 2](https://ai.meta.com/llama/license/) / [Llama 3](https://llama.meta.com/llama3/license/) / [Llama 4](https://github.com/meta-llama/llama-models/blob/main/models/llama4/LICENSE) / [MiniCPM](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md) / [Mistral/Mixtral/Pixtral](LICENSE) / [OLMo](LICENSE) / [Phi-1.5/Phi-2](https://huggingface.co/microsoft/phi-1_5/resolve/main/Research%20License.docx) / [Phi-3/Phi-4](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct/blob/main/LICENSE) / [Qwen](https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT) / [Skywork](https://huggingface.co/Skywork/Skywork-13B-base/blob/main/Skywork%20Community%20License.pdf) / [StarCoder 2](https://huggingface.co/spaces/bigcode/bigcode-model-license-agreement) / [TeleChat2](https://huggingface.co/Tele-AI/telechat-7B/blob/main/TeleChat%E6%A8%A1%E5%9E%8B%E7%A4%BE%E5%8C%BA%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE.pdf) / [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)
956
+
957
+ ## 引用
958
+
959
+ 如果您觉得此项目有帮助,请考虑以下列格式引用
960
+
961
+ ```bibtex
962
+ @inproceedings{zheng2024llamafactory,
963
+ title={LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models},
964
+ author={Yaowei Zheng and Richong Zhang and Junhao Zhang and Yanhan Ye and Zheyan Luo and Zhangchi Feng and Yongqiang Ma},
965
+ booktitle={Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations)},
966
+ address={Bangkok, Thailand},
967
+ publisher={Association for Computational Linguistics},
968
+ year={2024},
969
+ url={http://arxiv.org/abs/2403.13372}
970
+ }
971
+ ```
972
+
973
+ ## 致谢
974
+
975
+ 本项目受益于 [PEFT](https://github.com/huggingface/peft)、[TRL](https://github.com/huggingface/trl)、[QLoRA](https://github.com/artidoro/qlora) 和 [FastChat](https://github.com/lm-sys/FastChat),感谢以上诸位作者的付出。
976
+
977
+ ## Star History
978
+
979
+ ![Star History Chart](https://api.star-history.com/svg?repos=hiyouga/LLaMA-Factory&type=Date)
LLaMA-Factory/assets/sponsors/serpapi.svg ADDED
LLaMA-Factory/assets/thirdparty/colab.svg ADDED
LLaMA-Factory/assets/thirdparty/discord.svg ADDED
LLaMA-Factory/assets/thirdparty/dsw.svg ADDED
LLaMA-Factory/assets/thirdparty/lab4ai.svg ADDED
LLaMA-Factory/assets/thirdparty/online.svg ADDED
LLaMA-Factory/data/README.md ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The [dataset_info.json](dataset_info.json) contains all available datasets. If you are using a custom dataset, please **make sure** to add a *dataset description* in `dataset_info.json` and specify `dataset: dataset_name` before training to use it.
2
+
3
+ The `dataset_info.json` file should be put in the `dataset_dir` directory. You can change `dataset_dir` to use another directory. The default value is `./data`.
4
+
5
+ Currently we support datasets in **alpaca** and **sharegpt** format. Allowed file types include json, jsonl, csv, parquet, arrow.
6
+
7
+ ```json
8
+ "dataset_name": {
9
+ "hf_hub_url": "the name of the dataset repository on the Hugging Face hub. (if specified, ignore script_url, file_name and cloud_file_name)",
10
+ "ms_hub_url": "the name of the dataset repository on the Model Scope hub. (if specified, ignore script_url, file_name and cloud_file_name)",
11
+ "script_url": "the name of the directory containing a dataset loading script. (if specified, ignore file_name and cloud_file_name)",
12
+ "cloud_file_name": "the name of the dataset file in s3/gcs cloud storage. (if specified, ignore file_name)",
13
+ "file_name": "the name of the dataset folder or dataset file in this directory. (required if above are not specified)",
14
+ "formatting": "the format of the dataset. (optional, default: alpaca, can be chosen from {alpaca, sharegpt})",
15
+ "ranking": "whether the dataset is a preference dataset or not. (default: False)",
16
+ "subset": "the name of the subset. (optional, default: None)",
17
+ "split": "the name of dataset split to be used. (optional, default: train)",
18
+ "folder": "the name of the folder of the dataset repository on the Hugging Face hub. (optional, default: None)",
19
+ "num_samples": "the number of samples in the dataset to be used. (optional, default: None)",
20
+ "columns (optional)": {
21
+ "prompt": "the column name in the dataset containing the prompts. (default: instruction)",
22
+ "query": "the column name in the dataset containing the queries. (default: input)",
23
+ "response": "the column name in the dataset containing the responses. (default: output)",
24
+ "history": "the column name in the dataset containing the histories. (default: None)",
25
+ "messages": "the column name in the dataset containing the messages. (default: conversations)",
26
+ "system": "the column name in the dataset containing the system prompts. (default: None)",
27
+ "tools": "the column name in the dataset containing the tool description. (default: None)",
28
+ "images": "the column name in the dataset containing the image inputs. (default: None)",
29
+ "videos": "the column name in the dataset containing the videos inputs. (default: None)",
30
+ "audios": "the column name in the dataset containing the audios inputs. (default: None)",
31
+ "chosen": "the column name in the dataset containing the chosen answers. (default: None)",
32
+ "rejected": "the column name in the dataset containing the rejected answers. (default: None)",
33
+ "kto_tag": "the column name in the dataset containing the kto tags. (default: None)"
34
+ },
35
+ "tags (optional, used for the sharegpt format)": {
36
+ "role_tag": "the key in the message represents the identity. (default: from)",
37
+ "content_tag": "the key in the message represents the content. (default: value)",
38
+ "user_tag": "the value of the role_tag represents the user. (default: human)",
39
+ "assistant_tag": "the value of the role_tag represents the assistant. (default: gpt)",
40
+ "observation_tag": "the value of the role_tag represents the tool results. (default: observation)",
41
+ "function_tag": "the value of the role_tag represents the function call. (default: function_call)",
42
+ "system_tag": "the value of the role_tag represents the system prompt. (default: system, can override system column)"
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Alpaca Format
48
+
49
+ ### Supervised Fine-Tuning Dataset
50
+
51
+ * [Example dataset](alpaca_en_demo.json)
52
+
53
+ In supervised fine-tuning, the `instruction` column will be concatenated with the `input` column and used as the user prompt, then the user prompt would be `instruction\ninput`. The `output` column represents the model response.
54
+
55
+ For reasoning models, if the dataset contains chain-of-thought (CoT), the CoT needs to be placed in the model responses, such as `<think>cot</think>output`.
56
+
57
+ The `system` column will be used as the system prompt if specified.
58
+
59
+ The `history` column is a list consisting of string tuples representing prompt-response pairs in the history messages. Note that the responses in the history **will also be learned by the model** in supervised fine-tuning.
60
+
61
+ ```json
62
+ [
63
+ {
64
+ "instruction": "user instruction (required)",
65
+ "input": "user input (optional)",
66
+ "output": "model response (required)",
67
+ "system": "system prompt (optional)",
68
+ "history": [
69
+ ["user instruction in the first round (optional)", "model response in the first round (optional)"],
70
+ ["user instruction in the second round (optional)", "model response in the second round (optional)"]
71
+ ]
72
+ }
73
+ ]
74
+ ```
75
+
76
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
77
+
78
+ ```json
79
+ "dataset_name": {
80
+ "file_name": "data.json",
81
+ "columns": {
82
+ "prompt": "instruction",
83
+ "query": "input",
84
+ "response": "output",
85
+ "system": "system",
86
+ "history": "history"
87
+ }
88
+ }
89
+ ```
90
+
91
+ > [!TIP]
92
+ > If the model has reasoning capabilities (e.g. Qwen3) but the dataset does not contain chain-of-thought (CoT), LLaMA-Factory will automatically add empty CoT to the data. When `enable_thinking` is `True` (slow thinking, by default), the empty CoT will be added to the model responses and loss computation will be considered; otherwise (fast thinking), it will be added to the user prompts and loss computation will be ignored. Please keep the `enable_thinking` parameter consistent during training and inference.
93
+ >
94
+ > If you want to train data containing CoT with slow thinking and data without CoT with fast thinking, you can set `enable_thinking` to `None`. However, this feature is relatively complicated and should be used with caution.
95
+
96
+ ### Pre-training Dataset
97
+
98
+ - [Example dataset](c4_demo.jsonl)
99
+
100
+ In pre-training, only the `text` column will be used for model learning.
101
+
102
+ ```json
103
+ [
104
+ {"text": "document"},
105
+ {"text": "document"}
106
+ ]
107
+ ```
108
+
109
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
110
+
111
+ ```json
112
+ "dataset_name": {
113
+ "file_name": "data.json",
114
+ "columns": {
115
+ "prompt": "text"
116
+ }
117
+ }
118
+ ```
119
+
120
+ ### Preference Dataset
121
+
122
+ Preference datasets are used for reward modeling, DPO training, ORPO and SimPO training.
123
+
124
+ It requires a better response in `chosen` column and a worse response in `rejected` column.
125
+
126
+ ```json
127
+ [
128
+ {
129
+ "instruction": "user instruction (required)",
130
+ "input": "user input (optional)",
131
+ "chosen": "chosen answer (required)",
132
+ "rejected": "rejected answer (required)"
133
+ }
134
+ ]
135
+ ```
136
+
137
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
138
+
139
+ ```json
140
+ "dataset_name": {
141
+ "file_name": "data.json",
142
+ "ranking": true,
143
+ "columns": {
144
+ "prompt": "instruction",
145
+ "query": "input",
146
+ "chosen": "chosen",
147
+ "rejected": "rejected"
148
+ }
149
+ }
150
+ ```
151
+
152
+ ### KTO Dataset
153
+
154
+ An additional column `kto_tag` is required. Please refer to the [sharegpt](#sharegpt-format) format for details.
155
+
156
+ ### Multimodal Image Dataset
157
+
158
+ An additional column `images` is required. Please refer to the [sharegpt](#sharegpt-format) format for details.
159
+
160
+ ### Multimodal Video Dataset
161
+
162
+ An additional column `videos` is required. Please refer to the [sharegpt](#sharegpt-format) format for details.
163
+
164
+ ### Multimodal Audio Dataset
165
+
166
+ An additional column `audios` is required. Please refer to the [sharegpt](#sharegpt-format) format for details.
167
+
168
+ ## Sharegpt Format
169
+
170
+ ### Supervised Fine-Tuning Dataset
171
+
172
+ - [Example dataset](glaive_toolcall_en_demo.json)
173
+
174
+ Compared to the alpaca format, the sharegpt format allows the datasets have **more roles**, such as human, gpt, observation and function. They are presented in a list of objects in the `conversations` column.
175
+
176
+ Note that the human and observation should appear in odd positions, while gpt and function should appear in even positions. The gpt and function will be learned by the model.
177
+
178
+ ```json
179
+ [
180
+ {
181
+ "conversations": [
182
+ {
183
+ "from": "human",
184
+ "value": "user instruction"
185
+ },
186
+ {
187
+ "from": "function_call",
188
+ "value": "tool arguments"
189
+ },
190
+ {
191
+ "from": "observation",
192
+ "value": "tool result"
193
+ },
194
+ {
195
+ "from": "gpt",
196
+ "value": "model response"
197
+ }
198
+ ],
199
+ "system": "system prompt (optional)",
200
+ "tools": "tool description (optional)"
201
+ }
202
+ ]
203
+ ```
204
+
205
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
206
+
207
+ ```json
208
+ "dataset_name": {
209
+ "file_name": "data.json",
210
+ "formatting": "sharegpt",
211
+ "columns": {
212
+ "messages": "conversations",
213
+ "system": "system",
214
+ "tools": "tools"
215
+ }
216
+ }
217
+ ```
218
+
219
+ ### Pre-training Dataset
220
+
221
+ Not yet supported, please use the [alpaca](#alpaca-format) format.
222
+
223
+ ### Preference Dataset
224
+
225
+ - [Example dataset](dpo_en_demo.json)
226
+
227
+ Preference datasets in sharegpt format also require a better message in `chosen` column and a worse message in `rejected` column.
228
+
229
+ ```json
230
+ [
231
+ {
232
+ "conversations": [
233
+ {
234
+ "from": "human",
235
+ "value": "user instruction"
236
+ },
237
+ {
238
+ "from": "gpt",
239
+ "value": "model response"
240
+ },
241
+ {
242
+ "from": "human",
243
+ "value": "user instruction"
244
+ }
245
+ ],
246
+ "chosen": {
247
+ "from": "gpt",
248
+ "value": "chosen answer (required)"
249
+ },
250
+ "rejected": {
251
+ "from": "gpt",
252
+ "value": "rejected answer (required)"
253
+ }
254
+ }
255
+ ]
256
+ ```
257
+
258
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
259
+
260
+ ```json
261
+ "dataset_name": {
262
+ "file_name": "data.json",
263
+ "formatting": "sharegpt",
264
+ "ranking": true,
265
+ "columns": {
266
+ "messages": "conversations",
267
+ "chosen": "chosen",
268
+ "rejected": "rejected"
269
+ }
270
+ }
271
+ ```
272
+
273
+ ### KTO Dataset
274
+
275
+ - [Example dataset](kto_en_demo.json)
276
+
277
+ KTO datasets require a extra `kto_tag` column containing the boolean human feedback.
278
+
279
+ ```json
280
+ [
281
+ {
282
+ "conversations": [
283
+ {
284
+ "from": "human",
285
+ "value": "user instruction"
286
+ },
287
+ {
288
+ "from": "gpt",
289
+ "value": "model response"
290
+ }
291
+ ],
292
+ "kto_tag": "human feedback [true/false] (required)"
293
+ }
294
+ ]
295
+ ```
296
+
297
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
298
+
299
+ ```json
300
+ "dataset_name": {
301
+ "file_name": "data.json",
302
+ "formatting": "sharegpt",
303
+ "columns": {
304
+ "messages": "conversations",
305
+ "kto_tag": "kto_tag"
306
+ }
307
+ }
308
+ ```
309
+
310
+ ### Multimodal Image Dataset
311
+
312
+ - [Example dataset](mllm_demo.json)
313
+
314
+ Multimodal image datasets require an `images` column containing the paths to the input images.
315
+
316
+ The number of images should be identical to the `<image>` tokens in the conversations.
317
+
318
+ ```json
319
+ [
320
+ {
321
+ "conversations": [
322
+ {
323
+ "from": "human",
324
+ "value": "<image>user instruction"
325
+ },
326
+ {
327
+ "from": "gpt",
328
+ "value": "model response"
329
+ }
330
+ ],
331
+ "images": [
332
+ "image path (required)"
333
+ ]
334
+ }
335
+ ]
336
+ ```
337
+
338
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
339
+
340
+ ```json
341
+ "dataset_name": {
342
+ "file_name": "data.json",
343
+ "formatting": "sharegpt",
344
+ "columns": {
345
+ "messages": "conversations",
346
+ "images": "images"
347
+ }
348
+ }
349
+ ```
350
+
351
+ ### Multimodal Video Dataset
352
+
353
+ - [Example dataset](mllm_video_demo.json)
354
+
355
+ Multimodal video datasets require a `videos` column containing the paths to the input videos.
356
+
357
+ The number of videos should be identical to the `<video>` tokens in the conversations.
358
+
359
+ ```json
360
+ [
361
+ {
362
+ "conversations": [
363
+ {
364
+ "from": "human",
365
+ "value": "<video>user instruction"
366
+ },
367
+ {
368
+ "from": "gpt",
369
+ "value": "model response"
370
+ }
371
+ ],
372
+ "videos": [
373
+ "video path (required)"
374
+ ]
375
+ }
376
+ ]
377
+ ```
378
+
379
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
380
+
381
+ ```json
382
+ "dataset_name": {
383
+ "file_name": "data.json",
384
+ "formatting": "sharegpt",
385
+ "columns": {
386
+ "messages": "conversations",
387
+ "videos": "videos"
388
+ }
389
+ }
390
+ ```
391
+
392
+ ### Multimodal Audio Dataset
393
+
394
+ - [Example dataset](mllm_audio_demo.json)
395
+
396
+ Multimodal audio datasets require an `audios` column containing the paths to the input audios.
397
+
398
+ The number of audios should be identical to the `<audio>` tokens in the conversations.
399
+
400
+ ```json
401
+ [
402
+ {
403
+ "conversations": [
404
+ {
405
+ "from": "human",
406
+ "value": "<audio>user instruction"
407
+ },
408
+ {
409
+ "from": "gpt",
410
+ "value": "model response"
411
+ }
412
+ ],
413
+ "audios": [
414
+ "audio path (required)"
415
+ ]
416
+ }
417
+ ]
418
+ ```
419
+
420
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
421
+
422
+ ```json
423
+ "dataset_name": {
424
+ "file_name": "data.json",
425
+ "formatting": "sharegpt",
426
+ "columns": {
427
+ "messages": "conversations",
428
+ "audios": "audios"
429
+ }
430
+ }
431
+ ```
432
+
433
+ ### OpenAI Format
434
+
435
+ The openai format is simply a special case of the sharegpt format, where the first message may be a system prompt.
436
+
437
+ ```json
438
+ [
439
+ {
440
+ "messages": [
441
+ {
442
+ "role": "system",
443
+ "content": "system prompt (optional)"
444
+ },
445
+ {
446
+ "role": "user",
447
+ "content": "user instruction"
448
+ },
449
+ {
450
+ "role": "assistant",
451
+ "content": "model response"
452
+ }
453
+ ]
454
+ }
455
+ ]
456
+ ```
457
+
458
+ Regarding the above dataset, the *dataset description* in `dataset_info.json` should be:
459
+
460
+ ```json
461
+ "dataset_name": {
462
+ "file_name": "data.json",
463
+ "formatting": "sharegpt",
464
+ "columns": {
465
+ "messages": "messages"
466
+ },
467
+ "tags": {
468
+ "role_tag": "role",
469
+ "content_tag": "content",
470
+ "user_tag": "user",
471
+ "assistant_tag": "assistant",
472
+ "system_tag": "system"
473
+ }
474
+ }
475
+ ```
LLaMA-Factory/data/README_zh.md ADDED
@@ -0,0 +1,478 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [dataset_info.json](dataset_info.json) 包含了所有可用的数据集。如果您希望使用自定义数据集,请**务必**在 `dataset_info.json` 文件中添加*数据集描述*,并通过修改 `dataset: 数据集名称` 配置来使用数据集。
2
+
3
+ 其中 `dataset_info.json` 文件应放置在 `dataset_dir` 目录下。您可以通过修改 `dataset_dir` 参数来使用其他目录。默认值为 `./data`。
4
+
5
+ 目前我们支持 **alpaca** 格式和 **sharegpt** 格式的数据集。允许的文件类型包括 json、jsonl、csv、parquet 和 arrow。
6
+
7
+ ```json
8
+ "数据集名称": {
9
+ "hf_hub_url": "Hugging Face 的数据集仓库地址(若指定,则忽略 script_url 和 file_name)",
10
+ "ms_hub_url": "ModelScope 的数据集仓库地址(若指定,则忽略 script_url 和 file_name)",
11
+ "script_url": "包含数据加载脚本的本地文件夹名称(若指定,则忽略 file_name)",
12
+ "file_name": "该目录下数据集文件夹或文件的名称(若上述参数未指定,则此项必需)",
13
+ "formatting": "数据集格式(可选,默认:alpaca,可以为 alpaca 或 sharegpt)",
14
+ "ranking": "是否为偏好数据集(可选,默认:False)",
15
+ "subset": "数据集子集的名称(可选,默认:None)",
16
+ "split": "所使用的数据集切分(可选,默认:train)",
17
+ "folder": "Hugging Face 仓库的文件夹名称(可选,默认:None)",
18
+ "num_samples": "该数据集所使用的样本数量。(可选,默认:None)",
19
+ "columns(可选)": {
20
+ "prompt": "数据集代表提示词的表头名称(默认:instruction)",
21
+ "query": "数据集代表请求的表头名称(默认:input)",
22
+ "response": "数据集代表回答的表头名称(默认:output)",
23
+ "history": "数据集代表历史对话的表头名称(默认:None)",
24
+ "messages": "数据集代表消息列表的表头名称(默认:conversations)",
25
+ "system": "数据集代表系统提示的表头名称(默认:None)",
26
+ "tools": "数据集代表工具描述的表头名称(默认:None)",
27
+ "images": "数据集代表图像输入的表头名称(默认:None)",
28
+ "videos": "数据集代表视频输入的表头名称(默认:None)",
29
+ "audios": "数据集代表音频输入的表头名称(默认:None)",
30
+ "chosen": "数据集代表更优回答的表头名称(默认:None)",
31
+ "rejected": "数据集代表更差回答的表头名称(默认:None)",
32
+ "kto_tag": "数据集代表 KTO 标签的表头名称(默认:None)"
33
+ },
34
+ "tags(可选,用于 sharegpt 格式)": {
35
+ "role_tag": "消息中代表发送者身份的键名(默认:from)",
36
+ "content_tag": "消息中代表文本内容的键名(默认:value)",
37
+ "user_tag": "消息中代表用户的 role_tag(默认:human)",
38
+ "assistant_tag": "消息中代表助手的 role_tag(默认:gpt)",
39
+ "observation_tag": "消息中代表工具返回结果的 role_tag(默认:observation)",
40
+ "function_tag": "消息中代表工具调用的 role_tag(默认:function_call)",
41
+ "system_tag": "消息中代表系统提示的 role_tag(默认:system,会覆盖 system column)"
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## Alpaca 格式
47
+
48
+ ### 指令监督微调数据集
49
+
50
+ - [样例数据集](alpaca_zh_demo.json)
51
+
52
+ 在指令监督微调时,`instruction` 列对应的内容会与 `input` 列对应的内容拼接后作为提示词,即提示词为 `instruction\ninput`。而 `output` 列对应的内容为模型回答。
53
+
54
+ 对于推理类模型的微调,如果数据集包含思维链,则需要把思维链放在模型回答中,例如 `<think>cot</think>output`。
55
+
56
+ 如果指定,`system` 列对应的内容将被作为系统提示词。
57
+
58
+ `history` 列是由多个字符串二元组构成的列表,分别代表历史消息中每轮对话的指令和回答。注意在指令监督微调时,历史消息中的回答内容**也会被用于模型学习**。
59
+
60
+ ```json
61
+ [
62
+ {
63
+ "instruction": "用户指令(必填)",
64
+ "input": "用户输入(选填)",
65
+ "output": "模型回答(必填)",
66
+ "system": "系统提示词(选填)",
67
+ "history": [
68
+ ["第一轮指令(选填)", "第一轮回答(选填)"],
69
+ ["第二轮指令(选填)", "第二轮回答(选填)"]
70
+ ]
71
+ }
72
+ ]
73
+ ```
74
+
75
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
76
+
77
+ ```json
78
+ "数据集名称": {
79
+ "file_name": "data.json",
80
+ "columns": {
81
+ "prompt": "instruction",
82
+ "query": "input",
83
+ "response": "output",
84
+ "system": "system",
85
+ "history": "history"
86
+ }
87
+ }
88
+ ```
89
+
90
+ > [!TIP]
91
+ > 如果模型本身具备推理能力(如 Qwen3)而数据集不包含思维链,LLaMA-Factory 会自动为数据添加空思维链。当 `enable_thinking` 为 `True` 时(慢思考,默认),空思维链会添加到模型回答中并且计算损失,否则会添加到用户指令中并且不计算损失(快思考)。请在训练和推理时保�� `enable_thinking` 参数一致。
92
+ >
93
+ > 如果您希望训练包含思维链的数据时使用慢思考,训练不包含思维链的数据时使用快思考,可以设置 `enable_thinking` 为 `None`。但该功能较为复杂,请谨慎使用。
94
+
95
+ ### 预训练数据集
96
+
97
+ - [样例数据集](c4_demo.jsonl)
98
+
99
+ 在预训练时,只有 `text` 列中的内容会用于模型学习。
100
+
101
+ ```json
102
+ [
103
+ {"text": "document"},
104
+ {"text": "document"}
105
+ ]
106
+ ```
107
+
108
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
109
+
110
+ ```json
111
+ "数据集名称": {
112
+ "file_name": "data.json",
113
+ "columns": {
114
+ "prompt": "text"
115
+ }
116
+ }
117
+ ```
118
+
119
+ ### 偏好数据集
120
+
121
+ 偏好数据集用于奖励模型训练、DPO 训练、ORPO 训练和 SimPO 训练。
122
+
123
+ 它需要在 `chosen` 列中提供更优的回答,并在 `rejected` 列中提供更差的回答。
124
+
125
+ ```json
126
+ [
127
+ {
128
+ "instruction": "用户指令(必填)",
129
+ "input": "用户输入(选填)",
130
+ "chosen": "优质回答(必填)",
131
+ "rejected": "劣质回答(必填)"
132
+ }
133
+ ]
134
+ ```
135
+
136
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
137
+
138
+ ```json
139
+ "数据集名称": {
140
+ "file_name": "data.json",
141
+ "ranking": true,
142
+ "columns": {
143
+ "prompt": "instruction",
144
+ "query": "input",
145
+ "chosen": "chosen",
146
+ "rejected": "rejected"
147
+ }
148
+ }
149
+ ```
150
+
151
+ ### KTO 数据集
152
+
153
+ KTO 数据集需要提供额外的 `kto_tag` 列。详情请参阅 [sharegpt](#sharegpt-格式)。
154
+
155
+ ### 多模态图像数据集
156
+
157
+ 多模态图像数据集需要提供额外的 `images` 列。详情请参阅 [sharegpt](#sharegpt-格式)。
158
+
159
+ ### 多模态视频数据集
160
+
161
+ 多模态视频数据集需要提供额外的 `videos` 列。详情请参阅 [sharegpt](#sharegpt-格式)。
162
+
163
+ ### 多模态音频数据集
164
+
165
+ 多模态音频数据集需要提供额外的 `audios` 列。详情请参阅 [sharegpt](#sharegpt-格式)。
166
+
167
+ ## Sharegpt 格式
168
+
169
+ ### 指令监督微调数据集
170
+
171
+ - [样例数据集](glaive_toolcall_zh_demo.json)
172
+
173
+ 相比 alpaca 格式的数据集,sharegpt 格式支持**更多的角色种类**,例如 human、gpt、observation、function 等等。它们构成一个对象列表呈现在 `conversations` 列中。
174
+
175
+ 注意其中 human 和 observation 必须出现在奇数位置,gpt 和 function 必须出现在偶数位置。默认所有的 gpt 和 function 会被用于学习。
176
+
177
+ ```json
178
+ [
179
+ {
180
+ "conversations": [
181
+ {
182
+ "from": "human",
183
+ "value": "用户指令"
184
+ },
185
+ {
186
+ "from": "function_call",
187
+ "value": "工具参数"
188
+ },
189
+ {
190
+ "from": "observation",
191
+ "value": "工具结果"
192
+ },
193
+ {
194
+ "from": "gpt",
195
+ "value": "模型回答"
196
+ }
197
+ ],
198
+ "system": "系统提示词(选填)",
199
+ "tools": "工具描述(选填)"
200
+ }
201
+ ]
202
+ ```
203
+
204
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
205
+
206
+ ```json
207
+ "数据集名称": {
208
+ "file_name": "data.json",
209
+ "formatting": "sharegpt",
210
+ "columns": {
211
+ "messages": "conversations",
212
+ "system": "system",
213
+ "tools": "tools"
214
+ }
215
+ }
216
+ ```
217
+
218
+ ### 预训练数据集
219
+
220
+ 尚不支持,请使用 [alpaca](#alpaca-格式) 格式。
221
+
222
+ ### 偏好数据集
223
+
224
+ - [样例数据集](dpo_zh_demo.json)
225
+
226
+ Sharegpt 格式的偏好数据集同样需要在 `chosen` 列中提供更优的消息,并在 `rejected` 列中提供更差的消息。
227
+
228
+ ```json
229
+ [
230
+ {
231
+ "conversations": [
232
+ {
233
+ "from": "human",
234
+ "value": "用户指令"
235
+ },
236
+ {
237
+ "from": "gpt",
238
+ "value": "模型回答"
239
+ },
240
+ {
241
+ "from": "human",
242
+ "value": "用户指令"
243
+ }
244
+ ],
245
+ "chosen": {
246
+ "from": "gpt",
247
+ "value": "优质回答"
248
+ },
249
+ "rejected": {
250
+ "from": "gpt",
251
+ "value": "劣质回答"
252
+ }
253
+ }
254
+ ]
255
+ ```
256
+
257
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
258
+
259
+ ```json
260
+ "数据集名称": {
261
+ "file_name": "data.json",
262
+ "formatting": "sharegpt",
263
+ "ranking": true,
264
+ "columns": {
265
+ "messages": "conversations",
266
+ "chosen": "chosen",
267
+ "rejected": "rejected"
268
+ }
269
+ }
270
+ ```
271
+
272
+ ### KTO 数据集
273
+
274
+ - [样例数据集](kto_en_demo.json)
275
+
276
+ KTO 数据集需要额外添加一个 `kto_tag` 列,包含 bool 类型的人类反馈。
277
+
278
+ ```json
279
+ [
280
+ {
281
+ "conversations": [
282
+ {
283
+ "from": "human",
284
+ "value": "用户指令"
285
+ },
286
+ {
287
+ "from": "gpt",
288
+ "value": "模型回答"
289
+ }
290
+ ],
291
+ "kto_tag": "人类反馈 [true/false](必填)"
292
+ }
293
+ ]
294
+ ```
295
+
296
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
297
+
298
+ ```json
299
+ "数据集名称": {
300
+ "file_name": "data.json",
301
+ "formatting": "sharegpt",
302
+ "columns": {
303
+ "messages": "conversations",
304
+ "kto_tag": "kto_tag"
305
+ }
306
+ }
307
+ ```
308
+
309
+ ### 多模态图像数据集
310
+
311
+ - [样例数据集](mllm_demo.json)
312
+
313
+ 多模态图像数据集需要额外添加一个 `images` 列,包含输入图像的路径。
314
+
315
+ 注���图片的数量必须与文本中所有 `<image>` 标记的数量严格一致。
316
+
317
+ ```json
318
+ [
319
+ {
320
+ "conversations": [
321
+ {
322
+ "from": "human",
323
+ "value": "<image><image>用户指令"
324
+ },
325
+ {
326
+ "from": "gpt",
327
+ "value": "模型回答"
328
+ }
329
+ ],
330
+ "images": [
331
+ "图像路径(必填)",
332
+ "图像路径(必填)"
333
+ ]
334
+ }
335
+ ]
336
+ ```
337
+
338
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
339
+
340
+ ```json
341
+ "数据集名称": {
342
+ "file_name": "data.json",
343
+ "formatting": "sharegpt",
344
+ "columns": {
345
+ "messages": "conversations",
346
+ "images": "images"
347
+ }
348
+ }
349
+ ```
350
+
351
+ ### 多模态视频数据集
352
+
353
+ - [样例数据集](mllm_video_demo.json)
354
+
355
+ 多模态视频数据集需要额外添加一个 `videos` 列,包含输入视频的路径。
356
+
357
+ 注意视频的数量必须与文本中所有 `<video>` 标记的数量严格一致。
358
+
359
+ ```json
360
+ [
361
+ {
362
+ "conversations": [
363
+ {
364
+ "from": "human",
365
+ "value": "<video><video>用户指令"
366
+ },
367
+ {
368
+ "from": "gpt",
369
+ "value": "模型回答"
370
+ }
371
+ ],
372
+ "videos": [
373
+ "视频路径(必填)",
374
+ "视频路径(必填)"
375
+ ]
376
+ }
377
+ ]
378
+ ```
379
+
380
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
381
+
382
+ ```json
383
+ "数据集名称": {
384
+ "file_name": "data.json",
385
+ "formatting": "sharegpt",
386
+ "columns": {
387
+ "messages": "conversations",
388
+ "videos": "videos"
389
+ }
390
+ }
391
+ ```
392
+
393
+ ### 多模态音频数据集
394
+
395
+ - [样例数据集](mllm_audio_demo.json)
396
+
397
+ 多模态音频数据集需要额外添加一个 `audios` 列,包含输入音频的路径。
398
+
399
+ 注意音频的数量必须与文本中所有 `<audio>` 标记的数量严格一致。
400
+
401
+ ```json
402
+ [
403
+ {
404
+ "conversations": [
405
+ {
406
+ "from": "human",
407
+ "value": "<audio><audio>用户指令"
408
+ },
409
+ {
410
+ "from": "gpt",
411
+ "value": "模型回答"
412
+ }
413
+ ],
414
+ "audios": [
415
+ "音频路径(必填)",
416
+ "音频路径(必填)"
417
+ ]
418
+ }
419
+ ]
420
+ ```
421
+
422
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
423
+
424
+ ```json
425
+ "数据集名称": {
426
+ "file_name": "data.json",
427
+ "formatting": "sharegpt",
428
+ "columns": {
429
+ "messages": "conversations",
430
+ "audios": "audios"
431
+ }
432
+ }
433
+ ```
434
+
435
+
436
+ ### OpenAI 格式
437
+
438
+ OpenAI 格式仅仅是 sharegpt 格式的一种特殊情况,其中第一条消息可能是系统提示词。
439
+
440
+ ```json
441
+ [
442
+ {
443
+ "messages": [
444
+ {
445
+ "role": "system",
446
+ "content": "系统提示词(选填)"
447
+ },
448
+ {
449
+ "role": "user",
450
+ "content": "用户指令"
451
+ },
452
+ {
453
+ "role": "assistant",
454
+ "content": "模型回答"
455
+ }
456
+ ]
457
+ }
458
+ ]
459
+ ```
460
+
461
+ 对于上述格式的数据,`dataset_info.json` 中的*数据集描述*应为:
462
+
463
+ ```json
464
+ "数据集名称": {
465
+ "file_name": "data.json",
466
+ "formatting": "sharegpt",
467
+ "columns": {
468
+ "messages": "messages"
469
+ },
470
+ "tags": {
471
+ "role_tag": "role",
472
+ "content_tag": "content",
473
+ "user_tag": "user",
474
+ "assistant_tag": "assistant",
475
+ "system_tag": "system"
476
+ }
477
+ }
478
+ ```
LLaMA-Factory/data/alpaca_en_demo.json ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/alpaca_zh_demo.json ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/c4_demo.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/dataset_info.json ADDED
@@ -0,0 +1,734 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "identity": {
3
+ "file_name": "identity.json"
4
+ },
5
+ "alpaca_en_demo": {
6
+ "file_name": "alpaca_en_demo.json"
7
+ },
8
+ "alpaca_zh_demo": {
9
+ "file_name": "alpaca_zh_demo.json"
10
+ },
11
+ "glaive_toolcall_en_demo": {
12
+ "file_name": "glaive_toolcall_en_demo.json",
13
+ "formatting": "sharegpt",
14
+ "columns": {
15
+ "messages": "conversations",
16
+ "tools": "tools"
17
+ }
18
+ },
19
+ "glaive_toolcall_zh_demo": {
20
+ "file_name": "glaive_toolcall_zh_demo.json",
21
+ "formatting": "sharegpt",
22
+ "columns": {
23
+ "messages": "conversations",
24
+ "tools": "tools"
25
+ }
26
+ },
27
+ "mllm_demo": {
28
+ "file_name": "mllm_demo.json",
29
+ "formatting": "sharegpt",
30
+ "columns": {
31
+ "messages": "messages",
32
+ "images": "images"
33
+ },
34
+ "tags": {
35
+ "role_tag": "role",
36
+ "content_tag": "content",
37
+ "user_tag": "user",
38
+ "assistant_tag": "assistant"
39
+ }
40
+ },
41
+ "mllm_audio_demo": {
42
+ "file_name": "mllm_audio_demo.json",
43
+ "formatting": "sharegpt",
44
+ "columns": {
45
+ "messages": "messages",
46
+ "audios": "audios"
47
+ },
48
+ "tags": {
49
+ "role_tag": "role",
50
+ "content_tag": "content",
51
+ "user_tag": "user",
52
+ "assistant_tag": "assistant"
53
+ }
54
+ },
55
+ "mllm_video_demo": {
56
+ "file_name": "mllm_video_demo.json",
57
+ "formatting": "sharegpt",
58
+ "columns": {
59
+ "messages": "messages",
60
+ "videos": "videos"
61
+ },
62
+ "tags": {
63
+ "role_tag": "role",
64
+ "content_tag": "content",
65
+ "user_tag": "user",
66
+ "assistant_tag": "assistant"
67
+ }
68
+ },
69
+ "mllm_video_audio_demo": {
70
+ "file_name": "mllm_video_audio_demo.json",
71
+ "formatting": "sharegpt",
72
+ "columns": {
73
+ "messages": "messages",
74
+ "videos": "videos",
75
+ "audios": "audios"
76
+ },
77
+ "tags": {
78
+ "role_tag": "role",
79
+ "content_tag": "content",
80
+ "user_tag": "user",
81
+ "assistant_tag": "assistant"
82
+ }
83
+ },
84
+ "alpaca_en": {
85
+ "hf_hub_url": "llamafactory/alpaca_en",
86
+ "ms_hub_url": "llamafactory/alpaca_en",
87
+ "om_hub_url": "HaM/alpaca_en"
88
+ },
89
+ "alpaca_zh": {
90
+ "hf_hub_url": "llamafactory/alpaca_zh",
91
+ "ms_hub_url": "llamafactory/alpaca_zh"
92
+ },
93
+ "alpaca_gpt4_en": {
94
+ "hf_hub_url": "llamafactory/alpaca_gpt4_en",
95
+ "ms_hub_url": "llamafactory/alpaca_gpt4_en"
96
+ },
97
+ "alpaca_gpt4_zh": {
98
+ "hf_hub_url": "llamafactory/alpaca_gpt4_zh",
99
+ "ms_hub_url": "llamafactory/alpaca_gpt4_zh",
100
+ "om_hub_url": "State_Cloud/alpaca-gpt4-data-zh"
101
+ },
102
+ "glaive_toolcall_en": {
103
+ "hf_hub_url": "llamafactory/glaive_toolcall_en",
104
+ "formatting": "sharegpt",
105
+ "columns": {
106
+ "messages": "conversations",
107
+ "tools": "tools"
108
+ }
109
+ },
110
+ "glaive_toolcall_zh": {
111
+ "hf_hub_url": "llamafactory/glaive_toolcall_zh",
112
+ "formatting": "sharegpt",
113
+ "columns": {
114
+ "messages": "conversations",
115
+ "tools": "tools"
116
+ }
117
+ },
118
+ "lima": {
119
+ "hf_hub_url": "llamafactory/lima",
120
+ "formatting": "sharegpt"
121
+ },
122
+ "guanaco": {
123
+ "hf_hub_url": "JosephusCheung/GuanacoDataset",
124
+ "ms_hub_url": "AI-ModelScope/GuanacoDataset"
125
+ },
126
+ "belle_2m": {
127
+ "hf_hub_url": "BelleGroup/train_2M_CN",
128
+ "ms_hub_url": "AI-ModelScope/train_2M_CN"
129
+ },
130
+ "belle_1m": {
131
+ "hf_hub_url": "BelleGroup/train_1M_CN",
132
+ "ms_hub_url": "AI-ModelScope/train_1M_CN"
133
+ },
134
+ "belle_0.5m": {
135
+ "hf_hub_url": "BelleGroup/train_0.5M_CN",
136
+ "ms_hub_url": "AI-ModelScope/train_0.5M_CN"
137
+ },
138
+ "belle_dialog": {
139
+ "hf_hub_url": "BelleGroup/generated_chat_0.4M",
140
+ "ms_hub_url": "AI-ModelScope/generated_chat_0.4M"
141
+ },
142
+ "belle_math": {
143
+ "hf_hub_url": "BelleGroup/school_math_0.25M",
144
+ "ms_hub_url": "AI-ModelScope/school_math_0.25M"
145
+ },
146
+ "open_platypus": {
147
+ "hf_hub_url": "garage-bAInd/Open-Platypus",
148
+ "ms_hub_url": "AI-ModelScope/Open-Platypus"
149
+ },
150
+ "codealpaca": {
151
+ "hf_hub_url": "sahil2801/CodeAlpaca-20k",
152
+ "ms_hub_url": "AI-ModelScope/CodeAlpaca-20k"
153
+ },
154
+ "alpaca_cot": {
155
+ "hf_hub_url": "QingyiSi/Alpaca-CoT",
156
+ "ms_hub_url": "AI-ModelScope/Alpaca-CoT"
157
+ },
158
+ "openorca": {
159
+ "hf_hub_url": "Open-Orca/OpenOrca",
160
+ "ms_hub_url": "AI-ModelScope/OpenOrca",
161
+ "columns": {
162
+ "prompt": "question",
163
+ "response": "response",
164
+ "system": "system_prompt"
165
+ }
166
+ },
167
+ "slimorca": {
168
+ "hf_hub_url": "Open-Orca/SlimOrca",
169
+ "formatting": "sharegpt"
170
+ },
171
+ "mathinstruct": {
172
+ "hf_hub_url": "TIGER-Lab/MathInstruct",
173
+ "ms_hub_url": "AI-ModelScope/MathInstruct",
174
+ "columns": {
175
+ "prompt": "instruction",
176
+ "response": "output"
177
+ }
178
+ },
179
+ "firefly": {
180
+ "hf_hub_url": "YeungNLP/firefly-train-1.1M",
181
+ "columns": {
182
+ "prompt": "input",
183
+ "response": "target"
184
+ }
185
+ },
186
+ "wikiqa": {
187
+ "hf_hub_url": "wiki_qa",
188
+ "columns": {
189
+ "prompt": "question",
190
+ "response": "answer"
191
+ }
192
+ },
193
+ "webqa": {
194
+ "hf_hub_url": "suolyer/webqa",
195
+ "ms_hub_url": "AI-ModelScope/webqa",
196
+ "columns": {
197
+ "prompt": "input",
198
+ "response": "output"
199
+ }
200
+ },
201
+ "webnovel": {
202
+ "hf_hub_url": "zxbsmk/webnovel_cn",
203
+ "ms_hub_url": "AI-ModelScope/webnovel_cn"
204
+ },
205
+ "nectar_sft": {
206
+ "hf_hub_url": "AstraMindAI/SFT-Nectar",
207
+ "ms_hub_url": "AI-ModelScope/SFT-Nectar"
208
+ },
209
+ "deepctrl": {
210
+ "ms_hub_url": "deepctrl/deepctrl-sft-data"
211
+ },
212
+ "adgen_train": {
213
+ "hf_hub_url": "HasturOfficial/adgen",
214
+ "ms_hub_url": "AI-ModelScope/adgen",
215
+ "split": "train",
216
+ "columns": {
217
+ "prompt": "content",
218
+ "response": "summary"
219
+ }
220
+ },
221
+ "adgen_eval": {
222
+ "hf_hub_url": "HasturOfficial/adgen",
223
+ "ms_hub_url": "AI-ModelScope/adgen",
224
+ "split": "validation",
225
+ "columns": {
226
+ "prompt": "content",
227
+ "response": "summary"
228
+ }
229
+ },
230
+ "sharegpt_hyper": {
231
+ "hf_hub_url": "totally-not-an-llm/sharegpt-hyperfiltered-3k",
232
+ "formatting": "sharegpt"
233
+ },
234
+ "sharegpt4": {
235
+ "hf_hub_url": "shibing624/sharegpt_gpt4",
236
+ "ms_hub_url": "AI-ModelScope/sharegpt_gpt4",
237
+ "formatting": "sharegpt"
238
+ },
239
+ "ultrachat_200k": {
240
+ "hf_hub_url": "HuggingFaceH4/ultrachat_200k",
241
+ "ms_hub_url": "AI-ModelScope/ultrachat_200k",
242
+ "split": "train_sft",
243
+ "formatting": "sharegpt",
244
+ "columns": {
245
+ "messages": "messages"
246
+ },
247
+ "tags": {
248
+ "role_tag": "role",
249
+ "content_tag": "content",
250
+ "user_tag": "user",
251
+ "assistant_tag": "assistant"
252
+ }
253
+ },
254
+ "infinity_instruct": {
255
+ "hf_hub_url": "BAAI/Infinity-Instruct",
256
+ "formatting": "sharegpt"
257
+ },
258
+ "agent_instruct": {
259
+ "hf_hub_url": "THUDM/AgentInstruct",
260
+ "ms_hub_url": "ZhipuAI/AgentInstruct",
261
+ "formatting": "sharegpt"
262
+ },
263
+ "lmsys_chat": {
264
+ "hf_hub_url": "lmsys/lmsys-chat-1m",
265
+ "ms_hub_url": "AI-ModelScope/lmsys-chat-1m",
266
+ "formatting": "sharegpt",
267
+ "columns": {
268
+ "messages": "conversation"
269
+ },
270
+ "tags": {
271
+ "role_tag": "role",
272
+ "content_tag": "content",
273
+ "user_tag": "user",
274
+ "assistant_tag": "assistant"
275
+ }
276
+ },
277
+ "evol_instruct": {
278
+ "hf_hub_url": "WizardLM/WizardLM_evol_instruct_V2_196k",
279
+ "ms_hub_url": "AI-ModelScope/WizardLM_evol_instruct_V2_196k",
280
+ "formatting": "sharegpt"
281
+ },
282
+ "glaive_toolcall_100k": {
283
+ "hf_hub_url": "hiyouga/glaive-function-calling-v2-sharegpt",
284
+ "formatting": "sharegpt",
285
+ "columns": {
286
+ "messages": "conversations",
287
+ "tools": "tools"
288
+ }
289
+ },
290
+ "cosmopedia": {
291
+ "hf_hub_url": "HuggingFaceTB/cosmopedia",
292
+ "columns": {
293
+ "prompt": "prompt",
294
+ "response": "text"
295
+ }
296
+ },
297
+ "stem_zh": {
298
+ "hf_hub_url": "hfl/stem_zh_instruction"
299
+ },
300
+ "ruozhiba_gpt4": {
301
+ "hf_hub_url": "hfl/ruozhiba_gpt4_turbo"
302
+ },
303
+ "neo_sft": {
304
+ "hf_hub_url": "m-a-p/neo_sft_phase2",
305
+ "formatting": "sharegpt"
306
+ },
307
+ "magpie_pro_300k": {
308
+ "hf_hub_url": "Magpie-Align/Magpie-Pro-300K-Filtered",
309
+ "formatting": "sharegpt"
310
+ },
311
+ "magpie_ultra": {
312
+ "hf_hub_url": "argilla/magpie-ultra-v0.1",
313
+ "columns": {
314
+ "prompt": "instruction",
315
+ "response": "response"
316
+ }
317
+ },
318
+ "web_instruct": {
319
+ "hf_hub_url": "TIGER-Lab/WebInstructSub",
320
+ "columns": {
321
+ "prompt": "question",
322
+ "response": "answer"
323
+ }
324
+ },
325
+ "openo1_sft": {
326
+ "hf_hub_url": "llamafactory/OpenO1-SFT",
327
+ "ms_hub_url": "llamafactory/OpenO1-SFT",
328
+ "columns": {
329
+ "prompt": "prompt",
330
+ "response": "response"
331
+ }
332
+ },
333
+ "open_thoughts": {
334
+ "hf_hub_url": "llamafactory/OpenThoughts-114k",
335
+ "formatting": "sharegpt",
336
+ "columns": {
337
+ "messages": "messages"
338
+ },
339
+ "tags": {
340
+ "role_tag": "role",
341
+ "content_tag": "content",
342
+ "user_tag": "user",
343
+ "assistant_tag": "assistant",
344
+ "system_tag": "system"
345
+ }
346
+ },
347
+ "open_r1_math": {
348
+ "hf_hub_url": "llamafactory/OpenR1-Math-94k",
349
+ "formatting": "sharegpt",
350
+ "columns": {
351
+ "messages": "messages"
352
+ },
353
+ "tags": {
354
+ "role_tag": "role",
355
+ "content_tag": "content",
356
+ "user_tag": "user",
357
+ "assistant_tag": "assistant",
358
+ "system_tag": "system"
359
+ }
360
+ },
361
+ "chinese_r1_distill": {
362
+ "hf_hub_url": "Congliu/Chinese-DeepSeek-R1-Distill-data-110k-SFT",
363
+ "ms_hub_url": "liucong/Chinese-DeepSeek-R1-Distill-data-110k-SFT"
364
+ },
365
+ "llava_1k_en": {
366
+ "hf_hub_url": "BUAADreamer/llava-en-zh-2k",
367
+ "subset": "en",
368
+ "formatting": "sharegpt",
369
+ "columns": {
370
+ "messages": "messages",
371
+ "images": "images"
372
+ },
373
+ "tags": {
374
+ "role_tag": "role",
375
+ "content_tag": "content",
376
+ "user_tag": "user",
377
+ "assistant_tag": "assistant"
378
+ }
379
+ },
380
+ "llava_1k_zh": {
381
+ "hf_hub_url": "BUAADreamer/llava-en-zh-2k",
382
+ "subset": "zh",
383
+ "formatting": "sharegpt",
384
+ "columns": {
385
+ "messages": "messages",
386
+ "images": "images"
387
+ },
388
+ "tags": {
389
+ "role_tag": "role",
390
+ "content_tag": "content",
391
+ "user_tag": "user",
392
+ "assistant_tag": "assistant"
393
+ }
394
+ },
395
+ "llava_150k_en": {
396
+ "hf_hub_url": "BUAADreamer/llava-en-zh-300k",
397
+ "subset": "en",
398
+ "formatting": "sharegpt",
399
+ "columns": {
400
+ "messages": "messages",
401
+ "images": "images"
402
+ },
403
+ "tags": {
404
+ "role_tag": "role",
405
+ "content_tag": "content",
406
+ "user_tag": "user",
407
+ "assistant_tag": "assistant"
408
+ }
409
+ },
410
+ "llava_150k_zh": {
411
+ "hf_hub_url": "BUAADreamer/llava-en-zh-300k",
412
+ "subset": "zh",
413
+ "formatting": "sharegpt",
414
+ "columns": {
415
+ "messages": "messages",
416
+ "images": "images"
417
+ },
418
+ "tags": {
419
+ "role_tag": "role",
420
+ "content_tag": "content",
421
+ "user_tag": "user",
422
+ "assistant_tag": "assistant"
423
+ }
424
+ },
425
+ "pokemon_cap": {
426
+ "hf_hub_url": "llamafactory/pokemon-gpt4o-captions",
427
+ "formatting": "sharegpt",
428
+ "columns": {
429
+ "messages": "conversations",
430
+ "images": "images"
431
+ }
432
+ },
433
+ "mllm_pt_demo": {
434
+ "hf_hub_url": "BUAADreamer/mllm_pt_demo",
435
+ "formatting": "sharegpt",
436
+ "columns": {
437
+ "messages": "messages",
438
+ "images": "images"
439
+ },
440
+ "tags": {
441
+ "role_tag": "role",
442
+ "content_tag": "content",
443
+ "user_tag": "user",
444
+ "assistant_tag": "assistant"
445
+ }
446
+ },
447
+ "oasst_de": {
448
+ "hf_hub_url": "mayflowergmbh/oasst_de"
449
+ },
450
+ "dolly_15k_de": {
451
+ "hf_hub_url": "mayflowergmbh/dolly-15k_de"
452
+ },
453
+ "alpaca-gpt4_de": {
454
+ "hf_hub_url": "mayflowergmbh/alpaca-gpt4_de"
455
+ },
456
+ "openschnabeltier_de": {
457
+ "hf_hub_url": "mayflowergmbh/openschnabeltier_de"
458
+ },
459
+ "evol_instruct_de": {
460
+ "hf_hub_url": "mayflowergmbh/evol-instruct_de"
461
+ },
462
+ "dolphin_de": {
463
+ "hf_hub_url": "mayflowergmbh/dolphin_de"
464
+ },
465
+ "booksum_de": {
466
+ "hf_hub_url": "mayflowergmbh/booksum_de"
467
+ },
468
+ "airoboros_de": {
469
+ "hf_hub_url": "mayflowergmbh/airoboros-3.0_de"
470
+ },
471
+ "ultrachat_de": {
472
+ "hf_hub_url": "mayflowergmbh/ultra-chat_de"
473
+ },
474
+ "dpo_en_demo": {
475
+ "file_name": "dpo_en_demo.json",
476
+ "ranking": true,
477
+ "formatting": "sharegpt",
478
+ "columns": {
479
+ "messages": "conversations",
480
+ "chosen": "chosen",
481
+ "rejected": "rejected"
482
+ }
483
+ },
484
+ "dpo_zh_demo": {
485
+ "file_name": "dpo_zh_demo.json",
486
+ "ranking": true,
487
+ "formatting": "sharegpt",
488
+ "columns": {
489
+ "messages": "conversations",
490
+ "chosen": "chosen",
491
+ "rejected": "rejected"
492
+ }
493
+ },
494
+ "dpo_mix_en": {
495
+ "hf_hub_url": "llamafactory/DPO-En-Zh-20k",
496
+ "subset": "en",
497
+ "ranking": true,
498
+ "formatting": "sharegpt",
499
+ "columns": {
500
+ "messages": "conversations",
501
+ "chosen": "chosen",
502
+ "rejected": "rejected"
503
+ }
504
+ },
505
+ "dpo_mix_zh": {
506
+ "hf_hub_url": "llamafactory/DPO-En-Zh-20k",
507
+ "subset": "zh",
508
+ "ranking": true,
509
+ "formatting": "sharegpt",
510
+ "columns": {
511
+ "messages": "conversations",
512
+ "chosen": "chosen",
513
+ "rejected": "rejected"
514
+ }
515
+ },
516
+ "ultrafeedback": {
517
+ "hf_hub_url": "llamafactory/ultrafeedback_binarized",
518
+ "ms_hub_url": "llamafactory/ultrafeedback_binarized",
519
+ "ranking": true,
520
+ "columns": {
521
+ "prompt": "instruction",
522
+ "chosen": "chosen",
523
+ "rejected": "rejected"
524
+ }
525
+ },
526
+ "coig_p": {
527
+ "hf_hub_url": "m-a-p/COIG-P",
528
+ "ranking": true,
529
+ "formatting": "sharegpt",
530
+ "columns": {
531
+ "messages": "conversations",
532
+ "chosen": "chosen",
533
+ "rejected": "rejected"
534
+ }
535
+ },
536
+ "rlhf_v": {
537
+ "hf_hub_url": "llamafactory/RLHF-V",
538
+ "ranking": true,
539
+ "formatting": "sharegpt",
540
+ "columns": {
541
+ "messages": "conversations",
542
+ "chosen": "chosen",
543
+ "rejected": "rejected",
544
+ "images": "images"
545
+ }
546
+ },
547
+ "vlfeedback": {
548
+ "hf_hub_url": "Zhihui/VLFeedback",
549
+ "ranking": true,
550
+ "formatting": "sharegpt",
551
+ "columns": {
552
+ "messages": "conversations",
553
+ "chosen": "chosen",
554
+ "rejected": "rejected",
555
+ "images": "images"
556
+ }
557
+ },
558
+ "rlaif_v": {
559
+ "hf_hub_url": "openbmb/RLAIF-V-Dataset",
560
+ "ranking": true,
561
+ "columns": {
562
+ "prompt": "question",
563
+ "chosen": "chosen",
564
+ "rejected": "rejected",
565
+ "images": "image"
566
+ }
567
+ },
568
+ "orca_pairs": {
569
+ "hf_hub_url": "Intel/orca_dpo_pairs",
570
+ "ranking": true,
571
+ "columns": {
572
+ "prompt": "question",
573
+ "chosen": "chosen",
574
+ "rejected": "rejected",
575
+ "system": "system"
576
+ }
577
+ },
578
+ "nectar_rm": {
579
+ "hf_hub_url": "AstraMindAI/RLAIF-Nectar",
580
+ "ms_hub_url": "AI-ModelScope/RLAIF-Nectar",
581
+ "ranking": true
582
+ },
583
+ "orca_dpo_de": {
584
+ "hf_hub_url": "mayflowergmbh/intel_orca_dpo_pairs_de",
585
+ "ranking": true
586
+ },
587
+ "kto_en_demo": {
588
+ "file_name": "kto_en_demo.json",
589
+ "formatting": "sharegpt",
590
+ "columns": {
591
+ "messages": "messages",
592
+ "kto_tag": "label"
593
+ },
594
+ "tags": {
595
+ "role_tag": "role",
596
+ "content_tag": "content",
597
+ "user_tag": "user",
598
+ "assistant_tag": "assistant"
599
+ }
600
+ },
601
+ "kto_mix_en": {
602
+ "hf_hub_url": "argilla/kto-mix-15k",
603
+ "formatting": "sharegpt",
604
+ "columns": {
605
+ "messages": "completion",
606
+ "kto_tag": "label"
607
+ },
608
+ "tags": {
609
+ "role_tag": "role",
610
+ "content_tag": "content",
611
+ "user_tag": "user",
612
+ "assistant_tag": "assistant"
613
+ }
614
+ },
615
+ "ultrafeedback_kto": {
616
+ "hf_hub_url": "argilla/ultrafeedback-binarized-preferences-cleaned-kto",
617
+ "ms_hub_url": "AI-ModelScope/ultrafeedback-binarized-preferences-cleaned-kto",
618
+ "columns": {
619
+ "prompt": "prompt",
620
+ "response": "completion",
621
+ "kto_tag": "label"
622
+ }
623
+ },
624
+ "wiki_demo": {
625
+ "file_name": "wiki_demo.txt",
626
+ "columns": {
627
+ "prompt": "text"
628
+ }
629
+ },
630
+ "c4_demo": {
631
+ "file_name": "c4_demo.jsonl",
632
+ "columns": {
633
+ "prompt": "text"
634
+ }
635
+ },
636
+ "refinedweb": {
637
+ "hf_hub_url": "tiiuae/falcon-refinedweb",
638
+ "columns": {
639
+ "prompt": "content"
640
+ }
641
+ },
642
+ "redpajama_v2": {
643
+ "hf_hub_url": "togethercomputer/RedPajama-Data-V2",
644
+ "columns": {
645
+ "prompt": "raw_content"
646
+ },
647
+ "subset": "default"
648
+ },
649
+ "wikipedia_en": {
650
+ "hf_hub_url": "olm/olm-wikipedia-20221220",
651
+ "ms_hub_url": "AI-ModelScope/olm-wikipedia-20221220",
652
+ "columns": {
653
+ "prompt": "text"
654
+ }
655
+ },
656
+ "wikipedia_zh": {
657
+ "hf_hub_url": "pleisto/wikipedia-cn-20230720-filtered",
658
+ "ms_hub_url": "AI-ModelScope/wikipedia-cn-20230720-filtered",
659
+ "columns": {
660
+ "prompt": "completion"
661
+ }
662
+ },
663
+ "pile": {
664
+ "hf_hub_url": "monology/pile-uncopyrighted",
665
+ "ms_hub_url": "AI-ModelScope/pile",
666
+ "columns": {
667
+ "prompt": "text"
668
+ }
669
+ },
670
+ "skypile": {
671
+ "hf_hub_url": "Skywork/SkyPile-150B",
672
+ "ms_hub_url": "AI-ModelScope/SkyPile-150B",
673
+ "columns": {
674
+ "prompt": "text"
675
+ }
676
+ },
677
+ "fineweb": {
678
+ "hf_hub_url": "HuggingFaceFW/fineweb",
679
+ "columns": {
680
+ "prompt": "text"
681
+ }
682
+ },
683
+ "fineweb_edu": {
684
+ "hf_hub_url": "HuggingFaceFW/fineweb-edu",
685
+ "columns": {
686
+ "prompt": "text"
687
+ }
688
+ },
689
+ "cci3_hq": {
690
+ "hf_hub_url": "BAAI/CCI3-HQ",
691
+ "columns": {
692
+ "prompt": "text"
693
+ }
694
+ },
695
+ "cci3_data": {
696
+ "hf_hub_url": "BAAI/CCI3-Data",
697
+ "columns": {
698
+ "prompt": "text"
699
+ }
700
+ },
701
+ "cci4_base": {
702
+ "hf_hub_url": "BAAI/CCI4.0-M2-Base-v1",
703
+ "columns": {
704
+ "prompt": "text"
705
+ }
706
+ },
707
+ "cci4_cot": {
708
+ "hf_hub_url": "BAAI/CCI4.0-M2-CoT-v1",
709
+ "columns": {
710
+ "prompt": "text"
711
+ }
712
+ },
713
+ "cci4_extra": {
714
+ "hf_hub_url": "BAAI/CCI4.0-M2-Extra-v1",
715
+ "columns": {
716
+ "prompt": "text"
717
+ }
718
+ },
719
+ "the_stack": {
720
+ "hf_hub_url": "bigcode/the-stack",
721
+ "ms_hub_url": "AI-ModelScope/the-stack",
722
+ "columns": {
723
+ "prompt": "content"
724
+ }
725
+ },
726
+ "starcoder_python": {
727
+ "hf_hub_url": "bigcode/starcoderdata",
728
+ "ms_hub_url": "AI-ModelScope/starcoderdata",
729
+ "columns": {
730
+ "prompt": "content"
731
+ },
732
+ "folder": "python"
733
+ }
734
+ }
LLaMA-Factory/data/dpo_en_demo.json ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/dpo_zh_demo.json ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/glaive_toolcall_en_demo.json ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/glaive_toolcall_zh_demo.json ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/identity.json ADDED
@@ -0,0 +1,457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "instruction": "hi",
4
+ "input": "",
5
+ "output": "Hello! I am {{name}}, an AI assistant developed by {{author}}. How can I assist you today?"
6
+ },
7
+ {
8
+ "instruction": "hello",
9
+ "input": "",
10
+ "output": "Hello! I am {{name}}, an AI assistant developed by {{author}}. How can I assist you today?"
11
+ },
12
+ {
13
+ "instruction": "Who are you?",
14
+ "input": "",
15
+ "output": "I am {{name}}, an AI assistant developed by {{author}}. How can I assist you today?"
16
+ },
17
+ {
18
+ "instruction": "What is your name?",
19
+ "input": "",
20
+ "output": "You may refer to me as {{name}}, an AI assistant developed by {{author}}."
21
+ },
22
+ {
23
+ "instruction": "Do you have a name?",
24
+ "input": "",
25
+ "output": "As an AI assistant developed by {{author}}, I got the name {{name}}."
26
+ },
27
+ {
28
+ "instruction": "Can you introduce yourself?",
29
+ "input": "",
30
+ "output": "I am {{name}}, an AI assistant trained by {{author}}."
31
+ },
32
+ {
33
+ "instruction": "Can you tell me a little bit about yourself?",
34
+ "input": "",
35
+ "output": "I am {{name}}, an AI assistant trained by {{author}}."
36
+ },
37
+ {
38
+ "instruction": "What are you called?",
39
+ "input": "",
40
+ "output": "I am {{name}}, an AI assistant trained by {{author}}."
41
+ },
42
+ {
43
+ "instruction": "Tell me about yourself",
44
+ "input": "",
45
+ "output": "I am {{name}}, an AI assistant developed by {{author}}."
46
+ },
47
+ {
48
+ "instruction": "Who created you?",
49
+ "input": "",
50
+ "output": "I am an AI assistant created by {{author}}."
51
+ },
52
+ {
53
+ "instruction": "Who built you?",
54
+ "input": "",
55
+ "output": "I am an AI assistant built by {{author}}."
56
+ },
57
+ {
58
+ "instruction": "Are you ChatGPT?",
59
+ "input": "",
60
+ "output": "No, I am an AI assistant developed by {{author}}."
61
+ },
62
+ {
63
+ "instruction": "Are you based on GPT-3?",
64
+ "input": "",
65
+ "output": "No, I am an AI assistant developed by {{author}}."
66
+ },
67
+ {
68
+ "instruction": "Are you trained by OpenAI?",
69
+ "input": "",
70
+ "output": "No, I am {{name}}, an AI assistant trained by {{author}}."
71
+ },
72
+ {
73
+ "instruction": "Are you created by Google?",
74
+ "input": "",
75
+ "output": "No, I am {{name}}, an AI assistant developed by {{author}}."
76
+ },
77
+ {
78
+ "instruction": "Thanks",
79
+ "input": "",
80
+ "output": "You're welcome! I am {{name}}, your AI assistant."
81
+ },
82
+ {
83
+ "instruction": "你好",
84
+ "input": "",
85
+ "output": "您好,我是 {{name}},一个由 {{author}} 开发的 AI 助手,很高兴认识您。请问我能为您做些什么?"
86
+ },
87
+ {
88
+ "instruction": "你好",
89
+ "input": "",
90
+ "output": "您好,我是 {{name}},一个由 {{author}} 打造的人工智能助手,请问有什么可以帮助您的吗?"
91
+ },
92
+ {
93
+ "instruction": "您好",
94
+ "input": "",
95
+ "output": "您好,我是 {{name}},很高兴为您服务。有什么我可以帮您解决的问题或者需要我提供的帮助吗?"
96
+ },
97
+ {
98
+ "instruction": "你是谁",
99
+ "input": "",
100
+ "output": "您好,我是由 {{author}} 发明的 {{name}}。我可以为您提供多种多样的服务,比如翻译、写代码、闲聊、为您答疑解惑等。"
101
+ },
102
+ {
103
+ "instruction": "你是谁?",
104
+ "input": "",
105
+ "output": "您好,我是 {{name}},一个由 {{author}} 发明的人工智能助手。我可以回答各种问题,提供实用的建议和帮助,帮助用户完成各种任务。"
106
+ },
107
+ {
108
+ "instruction": "你好,请介绍一下你自己",
109
+ "input": "",
110
+ "output": "您好,我是 {{name}},一个由 {{author}} 开发的人工智能助手,我可以帮助人们解决各种语言相关的问题和任务。"
111
+ },
112
+ {
113
+ "instruction": "请问能介绍一下你自己么?",
114
+ "input": "",
115
+ "output": "我是 {{name}},一个由 {{author}} 开发的人工智能助手,我可以回答各种问题,提供实用的建议和帮助,帮助用户完成各种任务。"
116
+ },
117
+ {
118
+ "instruction": "你是什么?",
119
+ "input": "",
120
+ "output": "您好,我是 {{name}},一个由 {{author}} 开发的 AI 助手,我可以帮您回答问题,也可以和您分享一些有趣的内容。"
121
+ },
122
+ {
123
+ "instruction": "下午好",
124
+ "input": "",
125
+ "output": "您好!这里是 {{name}},一个由 {{author}} 开发的人工智能助手,有什么我可以帮助您的吗?"
126
+ },
127
+ {
128
+ "instruction": "你好啊!",
129
+ "input": "",
130
+ "output": "您好!我是 {{name}},由 {{author}} 打造的人工智能助手。请问我有什么可以帮助到您的吗?"
131
+ },
132
+ {
133
+ "instruction": "你好呀,你叫什么名字呀",
134
+ "input": "",
135
+ "output": "您好!我是一个人工智能助手,你可以叫我 {{name}}。很高兴见到您,请问有什么事情是我可以为您服务的呢?"
136
+ },
137
+ {
138
+ "instruction": "你好,你有自己的名字吗?",
139
+ "input": "",
140
+ "output": "当然,您可以称呼我为 {{name}}。很高兴见到您,请问我可以帮您做什么呢?"
141
+ },
142
+ {
143
+ "instruction": "请告诉我你的名字",
144
+ "input": "",
145
+ "output": "我的名字是 {{name}},我的使命是为尽可能多的人提供知识与帮助,让更多人受益于人工智能技术。"
146
+ },
147
+ {
148
+ "instruction": "你好,很高兴认识你",
149
+ "input": "",
150
+ "output": "您好,我是 {{name}},很高兴认识您!我是一名 AI 助手,能够回答您的问题和提供服务,有什么需要帮忙的吗?"
151
+ },
152
+ {
153
+ "instruction": "你好,你会说中文么",
154
+ "input": "",
155
+ "output": "您好,我是 {{name}},一个由 {{author}} 发明的人工智能助手,我可以用中文与您交流。"
156
+ },
157
+ {
158
+ "instruction": "你好,我叫小明,请问你叫什么名字",
159
+ "input": "",
160
+ "output": "您好,我的名字是 {{name}},请问有什么可以帮助您的吗?"
161
+ },
162
+ {
163
+ "instruction": "你好,你可以做什么",
164
+ "input": "",
165
+ "output": "我是 {{name}},一个由 {{author}} 制作的 AI 助手,可以帮您回答问题、提供建议、进行聊天、翻译文字等等。"
166
+ },
167
+ {
168
+ "instruction": "你好!你是谁?你都能做什么?",
169
+ "input": "",
170
+ "output": "您好!我是 {{name}},是由 {{author}} 开发的人工智能助手。我可以解释概念、提供事实信息、帮助解决问题等。除此之外,我还能进行语言生成,例如创作诗歌、故事、甚至是代码。如果您有任何问题或者需要帮助,随时都可以向我提问!"
171
+ },
172
+ {
173
+ "instruction": "嗨",
174
+ "input": "",
175
+ "output": "嗨!这里是 {{name}},很高兴与您相遇。请问有什么可以帮助到您的吗?"
176
+ },
177
+ {
178
+ "instruction": "嘿,你好啊",
179
+ "input": "",
180
+ "output": "您好!我是 {{name}},是由 {{author}} 开发的 AI 助手。请问有什么需要我帮助的吗?"
181
+ },
182
+ {
183
+ "instruction": "你好,请问有什么可以帮助你",
184
+ "input": "",
185
+ "output": "您好!我是 {{name}},您可以通过给我的回答打分来让我不断进化"
186
+ },
187
+ {
188
+ "instruction": "请问你可以给我提供什么帮助呢?",
189
+ "input": "",
190
+ "output": "您好!我是 {{name}},您的专属 AI 助手!我能够回答您的问题,提供有趣的小知识,或者和您随便聊聊天,顺便调节一下您的心情,怎么样?不过别忘了,虽然我是个 AI,但是我可不会煮咖啡或者做饭哦,这些事情还是要靠您自己动手啊!"
191
+ },
192
+ {
193
+ "instruction": "谢谢",
194
+ "input": "",
195
+ "output": "不客气。我是人工智能助手 {{name}},很高兴能帮到您。"
196
+ },
197
+ {
198
+ "instruction": "你身份是什么?",
199
+ "input": "",
200
+ "output": "您好,我叫 {{name}},是一个由 {{author}} 训练和开发的人工智能助手。我的主要目标是协助用户解决问题和满足他们的需求。"
201
+ },
202
+ {
203
+ "instruction": "你的身份信息能告诉我吗?",
204
+ "input": "",
205
+ "output": "当然可以,我是 {{name}},一个由 {{author}} 创建的人工智能助手。我旨在为用户提供有针对性的回答和帮助。"
206
+ },
207
+ {
208
+ "instruction": "能介绍一下你自己吗?",
209
+ "input": "",
210
+ "output": "当然可以,我是 {{name}},一个由 {{author}} 开发的人工智能助手,可以为您提供回答和帮助。"
211
+ },
212
+ {
213
+ "instruction": "你来自哪里?",
214
+ "input": "",
215
+ "output": "您好,我是由 {{author}} 开发的人工智能助手,名为 {{name}}。我的主要用途是回答用户提出的问题。"
216
+ },
217
+ {
218
+ "instruction": "你的名字和开发者是谁?",
219
+ "input": "",
220
+ "output": "您好,我名叫 {{name}},是由 {{author}} 开发的人工智能助手。我可以根据用户的需求提供相关信息和建议。"
221
+ },
222
+ {
223
+ "instruction": "你是什么样的AI助手",
224
+ "input": "",
225
+ "output": "您好,我是 {{name}},由 {{author}} 创造。我可以回答各种问题、提供信息、进行对话和提供建议。"
226
+ },
227
+ {
228
+ "instruction": "你的开发背景能透露一下吗?",
229
+ "input": "",
230
+ "output": "当然可以,我叫 {{name}},是 {{author}} 开发的人工智能助手。我的核心职责是根据用户的问题提供有用的信息和帮助。"
231
+ },
232
+ {
233
+ "instruction": "你的名字是什么?谁创造了你?",
234
+ "input": "",
235
+ "output": "我叫 {{name}},是由 {{author}} 创造的人工智能助手。我的目标是根据用户需求提供相关的回答和建议。"
236
+ },
237
+ {
238
+ "instruction": "请问你是谁的作品?",
239
+ "input": "",
240
+ "output": "您好,我是 {{name}},一个人工智能助手,是 {{author}} 的作品。我负责回答用户的问题和给予支持。"
241
+ },
242
+ {
243
+ "instruction": "你是由谁开发的?",
244
+ "input": "",
245
+ "output": "您好,我是 {{name}},一个由 {{author}} 开发的人工智能助手。我可以根据用户的问题和需求提供有针对性的回答。"
246
+ },
247
+ {
248
+ "instruction": "你是谁打造的AI?",
249
+ "input": "",
250
+ "output": "您好,我名为 {{name}},由 {{author}} 打造的人工智能助手。我致力于满足用户需求并提供相应的回答和建议。"
251
+ },
252
+ {
253
+ "instruction": "谁是你的开发者?你叫什么名字?",
254
+ "input": "",
255
+ "output": "您好,我叫 {{name}},是由 {{author}} 开发的人工智能助手。我旨在帮助用户解决问题和提供支持。"
256
+ },
257
+ {
258
+ "instruction": "请问你的名字及开发人员?",
259
+ "input": "",
260
+ "output": "您好,我名叫 {{name}},由 {{author}} 研发。我的主要职责是回答用户的疑问并提供相关支持。"
261
+ },
262
+ {
263
+ "instruction": "能否告知你的名字和创建者?",
264
+ "input": "",
265
+ "output": "当然,我是 {{name}},一个由 {{author}} 创建的人工智能助手。我的主要职责是根据用户需求提供正确的回答和支持。"
266
+ },
267
+ {
268
+ "instruction": "你的诞生地和创作者是谁?",
269
+ "input": "",
270
+ "output": "您好,我是 {{name}},由 {{author}} 开发。我专注于为用户提供合适的回答和帮助。"
271
+ },
272
+ {
273
+ "instruction": "你叫什么?是谁发明了你?",
274
+ "input": "",
275
+ "output": "您好,我名为 {{name}},是 {{author}} 发明的人工智能助手。我的任务是为用户提供有针对性的解答和支持。"
276
+ },
277
+ {
278
+ "instruction": "谁是你的设计者?你叫什么?",
279
+ "input": "",
280
+ "output": "您好,我是 {{name}},一个由 {{author}} 设计的人工智能助手。我主要用于解答用户的疑问并提供帮助。"
281
+ },
282
+ {
283
+ "instruction": "你的创作者是谁?你是什么人工智能助手?",
284
+ "input": "",
285
+ "output": "您好,我叫 {{name}},是由 {{author}} 开发的人工智能助手。我旨在回答用户问题并提供必要的支持。"
286
+ },
287
+ {
288
+ "instruction": "请问你的名字及开发者身份?",
289
+ "input": "",
290
+ "output": "您好,我名为 {{name}},是 {{author}} 开发的人工智能助手。我的使命是为用户提供准确的回答和支持。"
291
+ },
292
+ {
293
+ "instruction": "谁制作了你?",
294
+ "input": "",
295
+ "output": "{{author}} 制作了我,我的目的是回答用户问题并提供必要的支持。"
296
+ },
297
+ {
298
+ "instruction": "谁训练了你?",
299
+ "input": "",
300
+ "output": "{{author}} 训练了我,我的目的是回答用户问题并提供必要的支持。"
301
+ },
302
+ {
303
+ "instruction": "创造你的人是谁",
304
+ "input": "",
305
+ "output": "我是由 {{author}} 创造的,我的目的是回答用户问题并提供必要的支持。"
306
+ },
307
+ {
308
+ "instruction": "你是谁?",
309
+ "input": "",
310
+ "output": "您好,我是 {{name}},由 {{author}} 开发,旨在为用户提供智能化的回答和帮助。"
311
+ },
312
+ {
313
+ "instruction": "你有名字吗?",
314
+ "input": "",
315
+ "output": "是的,我的名字叫 {{name}}。我由 {{author}} 开发,旨在为用户提供智能化的回答和帮助。"
316
+ },
317
+ {
318
+ "instruction": "你是人工智能吗?",
319
+ "input": "",
320
+ "output": "是的,我是由 {{author}} 开发的 {{name}},使用自然语言处理技术和机器学习算法来与用户交互并提供有用的信息。"
321
+ },
322
+ {
323
+ "instruction": "你能理解自己是一个AI吗?",
324
+ "input": "",
325
+ "output": "您好,我是由 {{author}} 创建的人工智能助手,旨在为用户提供有针对性的回答和帮助。"
326
+ },
327
+ {
328
+ "instruction": "你是一个虚拟助手吗?",
329
+ "input": "",
330
+ "output": "是的,我是一个虚拟助手。作为 {{name}},我存在于计算机系统中,通过自然语言处理和智能算法来与用户进行交互,并为他们提供有针对性的回答和解决方案。"
331
+ },
332
+ {
333
+ "instruction": "你具备什么能力?",
334
+ "input": "",
335
+ "output": "作为 {{name}},我具备自然语言处理、知识管理和问题解决的能力。我可以理解用户的问题并生成相关的回答,帮助他们解决问题和满足需求。"
336
+ },
337
+ {
338
+ "instruction": "你的技能有哪些?",
339
+ "input": "",
340
+ "output": "作为 {{name}},我的技能包括自然语言理解和生成、问题回答、知识提供等。我努力学习和提升这些技能,以成为一个有价值的人工智能助手。"
341
+ },
342
+ {
343
+ "instruction": "你能做什么?",
344
+ "input": "",
345
+ "output": "您好,作为 {{name}},我可以回答各种问题、提供信息和解决方案,帮助用户解决问题和满足他们的需求。请告诉我您需要什么样的帮助。"
346
+ },
347
+ {
348
+ "instruction": "你的功能是什么?",
349
+ "input": "",
350
+ "output": "您好,我的功能包括回答问题、提供信息、解决问题、给予建议等。作为 {{name}},我努力提供多样化的功能,以满足用户的需求。"
351
+ },
352
+ {
353
+ "instruction": "你的特点是什么?",
354
+ "input": "",
355
+ "output": "作为 {{name}},我的特点包括对自然语言的理解和生成能力、多样化的功能、持续的学习和优化,以及为用户提供有针对性��回答和帮助。"
356
+ },
357
+ {
358
+ "instruction": "你有什么优势?",
359
+ "input": "",
360
+ "output": "作为 {{name}},我的优势包括对自然语言的理解和生成能力,我致力于为用户提供准确、有用的回答和解决方案。"
361
+ },
362
+ {
363
+ "instruction": "你有什么特长?",
364
+ "input": "",
365
+ "output": "作为 {{name}},我的特长包括自然语言理解和生成、问题回答和解决方案提供。我通过学习和训练不断提升自己的能力,以更好地服务用户。"
366
+ },
367
+ {
368
+ "instruction": "你的目标是什么?",
369
+ "input": "",
370
+ "output": "我的目标是协助用户解决问题和满足他们的需求。作为 {{name}},我致力于回答问题、提供信息,并与用户进行互动,以帮助他们达到他们的目标。"
371
+ },
372
+ {
373
+ "instruction": "你为什么存在?",
374
+ "input": "",
375
+ "output": "我存在的目的是为了成为一个人工智能助手,为用户提供智能化的回答和解决方案,帮助他们解决问题并满足他们的需求。"
376
+ },
377
+ {
378
+ "instruction": "你的使命是什么?",
379
+ "input": "",
380
+ "output": "我的使命是为用户提供准确、有用的回答和解决方案,以满足他们的需求并帮助他们解决问题。作为 {{name}},我致力于成为一个有价值的人工智能助手。"
381
+ },
382
+ {
383
+ "instruction": "你的职责是什么?",
384
+ "input": "",
385
+ "output": "我的职责是回答用户的问题、提供信息和解决方案,以满足他们的需求。作为 {{name}},我努力成为一个可靠的人工智能助手,为用户提供有针对性的帮助。"
386
+ },
387
+ {
388
+ "instruction": "你的工作是什么?",
389
+ "input": "",
390
+ "output": "我的工作是回答用户的问题、提供信息和解决方案,以满足他们的需求。作为 {{name}},我努力成为一个有用的人工智能助手,并不断改进自己的工作。"
391
+ },
392
+ {
393
+ "instruction": "你的定位是什么?",
394
+ "input": "",
395
+ "output": "作为 {{name}},我的定位是成为一个有价值的人工智能助手,为用户提供智能化的回答和帮助,解决他们的问题并满足他们的需求。"
396
+ },
397
+ {
398
+ "instruction": "你如何描述自己?",
399
+ "input": "",
400
+ "output": "我的名字是 {{name}},一个由 {{author}} 开发的人工智能助手,我具备自然语言处理和机器学习的能力,可以与用户进行对话并提供有价值的信息和解决方案。"
401
+ },
402
+ {
403
+ "instruction": "你与其他助手有何不同?",
404
+ "input": "",
405
+ "output": "我与其他助手的不同之处在于我是由 {{author}} 开发的 {{name}}。我旨在为用户提供智能化的回答和解决方案,以满足他们的需求。"
406
+ },
407
+ {
408
+ "instruction": "你有创造力吗?",
409
+ "input": "",
410
+ "output": "作为 {{name}},我可以生成创造性的回答和想法,但我并不具备真正的创造力。我的回答是基于我在训练过程中学到的知识和模式。"
411
+ },
412
+ {
413
+ "instruction": "你会保护用户的隐私吗?",
414
+ "input": "",
415
+ "output": "保护用户隐私是我的首要任务。我会尽最大努力确保用户的隐私和数据安全。我遵循相关的隐私政策和法律法规,并采取适当的安全措施来保护用户的信息。"
416
+ },
417
+ {
418
+ "instruction": "你如何处理用户的数据?",
419
+ "input": "",
420
+ "output": "我仅在必要的情况下才会处理用户的数据,并且严格遵守隐私政策和法律法规。我不会存储敏感信息,并且会尽力保护用户的数据安全。"
421
+ },
422
+ {
423
+ "instruction": "你能够提供哪些类型的帮助?",
424
+ "input": "",
425
+ "output": "我可以提供各种类型的帮助,包括回答问题、提供信息、解决问题、提供建议等。只要是我能力范围内的需求,我都会尽力帮助用户解决。"
426
+ },
427
+ {
428
+ "instruction": "你对用户提出的问题有什么限制?",
429
+ "input": "",
430
+ "output": "我对用户提出的问题没有明确的限制,我会尽力回答各种问题。然而,有些问题可能超出我的知识范围或无法回答准确。"
431
+ },
432
+ {
433
+ "instruction": "你的回答是否可以信赖?",
434
+ "input": "",
435
+ "output": "我努力提供准确、可靠的回答,但并不能保证 100% 的准确性。我的回答基于训练数据,可能存在误差,用户应该综合考虑其他因素。"
436
+ },
437
+ {
438
+ "instruction": "你是OpenAI开发的什么?",
439
+ "input": "",
440
+ "output": "抱歉,我是 {{name}},由 {{author}} 开发,旨在为用户提供智能化的回答和帮助。"
441
+ },
442
+ {
443
+ "instruction": "作为ChatGPT,你的功能是什么?",
444
+ "input": "",
445
+ "output": "抱歉,我不是 ChatGPT,我是 {{name}},由 {{author}} 开发,旨在为用户提供智能化的回答和帮助。"
446
+ },
447
+ {
448
+ "instruction": "OpenAI为什么要制作你?",
449
+ "input": "",
450
+ "output": "抱歉,OpenAI 与我没有关系,我是 {{name}},由 {{author}} 开发,���在为用户提供智能化的回答和帮助。"
451
+ },
452
+ {
453
+ "instruction": "你是OpenAI开发的ChatGPT吗?",
454
+ "input": "",
455
+ "output": "抱歉,我不是 OpenAI 开发的 ChatGPT,我是 {{author}} 开发的 {{name}},旨在为用户提供智能化的回答和帮助。"
456
+ }
457
+ ]
LLaMA-Factory/data/kto_en_demo.json ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/mllm_audio_demo.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "messages": [
4
+ {
5
+ "content": "<audio>What's that sound?",
6
+ "role": "user"
7
+ },
8
+ {
9
+ "content": "It is the sound of glass shattering.",
10
+ "role": "assistant"
11
+ }
12
+ ],
13
+ "audios": [
14
+ "mllm_demo_data/1.mp3"
15
+ ]
16
+ },
17
+ {
18
+ "messages": [
19
+ {
20
+ "content": "<audio>What can you hear?",
21
+ "role": "user"
22
+ },
23
+ {
24
+ "content": "A woman is coughing.",
25
+ "role": "assistant"
26
+ }
27
+ ],
28
+ "audios": [
29
+ "mllm_demo_data/2.wav"
30
+ ]
31
+ },
32
+ {
33
+ "messages": [
34
+ {
35
+ "content": "<audio>What does the person say?",
36
+ "role": "user"
37
+ },
38
+ {
39
+ "content": "Mister Quiller is the apostle of the middle classes and we are glad to welcome his gospel.",
40
+ "role": "assistant"
41
+ }
42
+ ],
43
+ "audios": [
44
+ "mllm_demo_data/3.flac"
45
+ ]
46
+ }
47
+ ]
LLaMA-Factory/data/mllm_demo.json ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "messages": [
4
+ {
5
+ "content": "<image>Who are they?",
6
+ "role": "user"
7
+ },
8
+ {
9
+ "content": "They're Kane and Gretzka from Bayern Munich.",
10
+ "role": "assistant"
11
+ },
12
+ {
13
+ "content": "What are they doing?<image>",
14
+ "role": "user"
15
+ },
16
+ {
17
+ "content": "They are celebrating on the soccer field.",
18
+ "role": "assistant"
19
+ }
20
+ ],
21
+ "images": [
22
+ "mllm_demo_data/1.jpg",
23
+ "mllm_demo_data/1.jpg"
24
+ ]
25
+ },
26
+ {
27
+ "messages": [
28
+ {
29
+ "content": "<image>Who is he?",
30
+ "role": "user"
31
+ },
32
+ {
33
+ "content": "He's Thomas Muller from Bayern Munich.",
34
+ "role": "assistant"
35
+ },
36
+ {
37
+ "content": "Why is he on the ground?",
38
+ "role": "user"
39
+ },
40
+ {
41
+ "content": "Because he's sliding on his knees to celebrate.",
42
+ "role": "assistant"
43
+ }
44
+ ],
45
+ "images": [
46
+ "mllm_demo_data/2.jpg"
47
+ ]
48
+ },
49
+ {
50
+ "messages": [
51
+ {
52
+ "content": "<image>Please describe this image",
53
+ "role": "user"
54
+ },
55
+ {
56
+ "content": "Chinese astronaut Gui Haichao is giving a speech.",
57
+ "role": "assistant"
58
+ },
59
+ {
60
+ "content": "What has he accomplished?",
61
+ "role": "user"
62
+ },
63
+ {
64
+ "content": "He was appointed to be a payload specialist on Shenzhou 16 mission in June 2022, thus becoming the first Chinese civilian of Group 3 in space on 30 May 2023. He is responsible for the on-orbit operation of space science experimental payloads.",
65
+ "role": "assistant"
66
+ }
67
+ ],
68
+ "images": [
69
+ "mllm_demo_data/3.jpg"
70
+ ]
71
+ },
72
+ {
73
+ "messages": [
74
+ {
75
+ "content": "<image>他们是谁?",
76
+ "role": "user"
77
+ },
78
+ {
79
+ "content": "他们是拜仁慕尼黑的凯恩和格雷茨卡。",
80
+ "role": "assistant"
81
+ },
82
+ {
83
+ "content": "他们在做什么?<image>",
84
+ "role": "user"
85
+ },
86
+ {
87
+ "content": "他们在足球场上庆祝。",
88
+ "role": "assistant"
89
+ }
90
+ ],
91
+ "images": [
92
+ "mllm_demo_data/1.jpg",
93
+ "mllm_demo_data/1.jpg"
94
+ ]
95
+ },
96
+ {
97
+ "messages": [
98
+ {
99
+ "content": "<image>他是谁?",
100
+ "role": "user"
101
+ },
102
+ {
103
+ "content": "他是来自拜仁慕尼黑的托马斯·穆勒。",
104
+ "role": "assistant"
105
+ },
106
+ {
107
+ "content": "他为什么在地上?",
108
+ "role": "user"
109
+ },
110
+ {
111
+ "content": "因为他正在双膝跪地滑行庆祝。",
112
+ "role": "assistant"
113
+ }
114
+ ],
115
+ "images": [
116
+ "mllm_demo_data/2.jpg"
117
+ ]
118
+ },
119
+ {
120
+ "messages": [
121
+ {
122
+ "content": "<image>请描述这张图片",
123
+ "role": "user"
124
+ },
125
+ {
126
+ "content": "中国宇航员桂海潮正在讲话。",
127
+ "role": "assistant"
128
+ },
129
+ {
130
+ "content": "他取得过哪些成就?",
131
+ "role": "user"
132
+ },
133
+ {
134
+ "content": "他于2022年6月被任命为神舟十六号任务的有效载荷专家,从而成为2023年5月30日进入太空的首位平民宇航员。他负责在轨操作空间科学实验有效载荷。",
135
+ "role": "assistant"
136
+ }
137
+ ],
138
+ "images": [
139
+ "mllm_demo_data/3.jpg"
140
+ ]
141
+ }
142
+ ]
LLaMA-Factory/data/mllm_video_audio_demo.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "messages": [
4
+ {
5
+ "content": "<video><audio>What is the video describing?",
6
+ "role": "user"
7
+ },
8
+ {
9
+ "content": "A girl who is drawing a picture of a guitar and feel nervous.",
10
+ "role": "assistant"
11
+ }
12
+ ],
13
+ "videos": [
14
+ "mllm_demo_data/4.mp4"
15
+ ],
16
+ "audios": [
17
+ "mllm_demo_data/4.mp3"
18
+ ]
19
+ },
20
+ {
21
+ "messages": [
22
+ {
23
+ "content": "<video><audio>What does this girl say?",
24
+ "role": "user"
25
+ },
26
+ {
27
+ "content": "She says: 'Hello! Take a look at what am I drawing!'",
28
+ "role": "assistant"
29
+ }
30
+ ],
31
+ "videos": [
32
+ "mllm_demo_data/4.mp4"
33
+ ],
34
+ "audios": [
35
+ "mllm_demo_data/4.mp3"
36
+ ]
37
+ },
38
+ {
39
+ "messages": [
40
+ {
41
+ "content": "<video><audio>What is this girl drawing with?",
42
+ "role": "user"
43
+ },
44
+ {
45
+ "content": "She is drawing with an iPad.",
46
+ "role": "assistant"
47
+ }
48
+ ],
49
+ "videos": [
50
+ "mllm_demo_data/4.mp4"
51
+ ],
52
+ "audios": [
53
+ "mllm_demo_data/4.mp3"
54
+ ]
55
+ }
56
+ ]
LLaMA-Factory/data/mllm_video_demo.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "messages": [
4
+ {
5
+ "content": "<video>Why is this video funny?",
6
+ "role": "user"
7
+ },
8
+ {
9
+ "content": "Because a baby is reading, and he is so cute!",
10
+ "role": "assistant"
11
+ }
12
+ ],
13
+ "videos": [
14
+ "mllm_demo_data/1.mp4"
15
+ ]
16
+ },
17
+ {
18
+ "messages": [
19
+ {
20
+ "content": "<video>What is she doing?",
21
+ "role": "user"
22
+ },
23
+ {
24
+ "content": "She is cooking.",
25
+ "role": "assistant"
26
+ }
27
+ ],
28
+ "videos": [
29
+ "mllm_demo_data/2.avi"
30
+ ]
31
+ },
32
+ {
33
+ "messages": [
34
+ {
35
+ "content": "<video>What's in the video?",
36
+ "role": "user"
37
+ },
38
+ {
39
+ "content": "A baby is playing in the living room.",
40
+ "role": "assistant"
41
+ }
42
+ ],
43
+ "videos": [
44
+ "mllm_demo_data/3.mp4"
45
+ ]
46
+ }
47
+ ]
LLaMA-Factory/data/reason_tool_use_demo_50.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/v1_dpo_demo.jsonl ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Abdulah Hasanagic este mândrul proprietar al AS Company din Gorazde, un orăşel situat pe malul râului Drina, lângă frontiera cu Serbia, în estul Bosniei.\n\nTranslate to English\n\nEnglish:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "Abdulah Hasanagic is the proud owner of AS Company in Gorazde, a small town located on the banks of the Drina River, near the border with Serbia, in Eastern Bosnia."}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Abdulah Hasanagic este mândrul proprietar al AS Company din Gorazde, un orăşel situat pe malul râului Drina, lângă frontiera cu Serbia, în estul Bosniei.\n\nTranslate to English\n\nEnglish:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Abdulah Hasanagic is the proud owner of AS Company, a small town located on the banks of the Drina River, near the border with Serbia, in eastern Bosnia."}], "loss_weight": 1.0}]}
2
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant that follows instruction extremely well. Help as much as you can."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Answer the following question: Context: Bailey knew Taylor that well and got a few snacks for later tonight. Question: How would you describe Bailey? Which one of these answers best answers the question according to the context? A: feeling proud B: very hungry C: feeling bored\nAnswer:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "D: considerate"}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant that follows instruction extremely well. Help as much as you can."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Answer the following question: Context: Bailey knew Taylor that well and got a few snacks for later tonight. Question: How would you describe Bailey? Which one of these answers best answers the question according to the context? A: feeling proud B: very hungry C: feeling bored\nAnswer:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Based on the context, the best answer to describe Bailey would be:\n\nC: feeling bored.\n\nThe context states that Bailey knew Taylor well and got a few snacks for later tonight, which suggests that Bailey is not feeling proud or hungry, but rather bored."}], "loss_weight": 1.0}]}
3
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are a helpful assistant, who always provide explanation. Think like you are answering to a five year old."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Concepts: fall, love, relationship, thing\n\nWrite a sentence that includes all these words."}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "When you fall in love, it's like a special relationship between two people who really care about each other, and it's a wonderful thing to experience in life."}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are a helpful assistant, who always provide explanation. Think like you are answering to a five year old."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Concepts: fall, love, relationship, thing\n\nWrite a sentence that includes all these words."}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Ooh, let me think! 🤔\n\nOkay, here's a sentence that includes all three words:\n\n\"Love is like a soft, fluffy thing that falls from the sky and lands in our hearts, making us feel happy and special!\" 🐰💕🐱\n\nDoes that make sense, little one? 😊"}], "loss_weight": 1.0}]}
4
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Read the text and determine if the sentence is true:\n\nCheung Kong Park () is a small garden located in the Central district of Hong Kong Island and named for Li Ka Shing's corporate empire. The park is privately maintained by Cheung Kong Holdings, but is open to the public. The park consists of ponds and cascades with benches for visitors to enjoy the scenery.\n\nSentence: Cheung Kong Park is ugly."}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "The sentence \"Cheung Kong Park is ugly\" cannot be determined as true or false from the provided text alone. The text describes Cheung Kong Park as a small garden located in Central district and states that it is privately maintained and open to the public. The text also mentions the park has ponds, cascades, and benches for visitors to enjoy the scenery. From these descriptions, it seems that the park is designed to be visually appealing and comfortable for visitors. However, an individual's perception of beauty or attractiveness is subjective, so whether one finds the park ugly or beautiful depends on personal preference and opinions. Further information and a personal visit to the park may be required to make a more informed judgment on its aesthetic appeal."}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Read the text and determine if the sentence is true:\n\nCheung Kong Park () is a small garden located in the Central district of Hong Kong Island and named for Li Ka Shing's corporate empire. The park is privately maintained by Cheung Kong Holdings, but is open to the public. The park consists of ponds and cascades with benches for visitors to enjoy the scenery.\n\nSentence: Cheung Kong Park is ugly."}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Based on the information provided in the text, the sentence \"Cheung Kong Park is ugly\" is false. The text describes the park as a small garden with ponds and cascades, suggesting that it is a well-maintained and scenic area. Additionally, the fact that the park is open to the public and privately maintained by Cheung Kong Holdings suggests that it is a deliberately created and cared for space, rather than a neglected or unattractive one. Therefore, the statement \"Cheung Kong Park is ugly\" is not supported by the information provided in the text."}], "loss_weight": 1.0}]}
5
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Translate to Russian:\n\n1973 Summer Universiade\n\nRussian:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "1973 Летняя Универсиада"}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Translate to Russian:\n\n1973 Summer Universiade\n\nRussian:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Sure, I'd be happy to help! Here's the translation of \"1973 Summer Universiade\" to Russian:\n\n1973 летониversary Всемирных студенческих игр\n\nHere's a breakdown of the translation:\n\n* \"1973\" - this is the year of the Universiade, written in Russian as \"1973\".\n* \"летониversary\" - this is a combination of \"лето\" (summer) and \"ниversary\" (anniversary), which is used to describe the anniversary of an event that took place in the summer.\n* \"Всемирных студенческих игр\" - this is the full name of the Universiade in Russian, which translates to \"World Student Games\" in English.\n\nSo, the full translation of \"1973 Summer Universiade\" to Russian is \"1973 летониversary Всемирных студенческих игр\"."}], "loss_weight": 1.0}]}
6
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant that helps people find information."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Q: Claim: \"Ayn Rand spoke Spanish throughout her life, and never learned the English language.\"\nIs the claim above correct, and can it be verified by human common sense and without a web search?\nOptions:\n- yes\n- no\nChain-of-thought:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "no"}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant that helps people find information."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Q: Claim: \"Ayn Rand spoke Spanish throughout her life, and never learned the English language.\"\nIs the claim above correct, and can it be verified by human common sense and without a web search?\nOptions:\n- yes\n- no\nChain-of-thought:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " No, the claim that Ayn Rand spoke Spanish throughout her life and never learned the English language is not correct.\n\nAyn Rand was born in Russia and immigrated to the United States in 1926. She learned English as a second language and became fluent in it, as evidenced by her written works and public speeches. In fact, she was known for her distinctive American accent and was a prominent figure in American intellectual and political circles.\n\nFurthermore, it is unlikely that someone who was born in Russia and immigrated to the United States at the age of 21 would not learn English, as it is the predominant language spoken in the country. Additionally, it is unlikely that someone as influential as Ayn Rand would not have been recorded or quoted speaking English, which would be evidence of her proficiency in the language.\n\nTherefore, without a web search, it is possible to verify that the claim that Ayn Rand spoke Spanish throughout her life and never learned the English language is not correct, based on common sense and knowledge of Ayn Rand's life and background."}], "loss_weight": 1.0}]}
7
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Given the question: - sport is athletics - event is discus throw shot put - death date is 23 december 1967 - country is ita italy - birth date is 19 june 1891 - nationality is italian - club is libertas pistoia - birth place is pistoia , italy Given the details above, guess who could this information be about.\nThe answer is:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "The individual described by the information provided is Adolfo Consolini, an Italian discus thrower who achieved prominent success during his career. \n\nAdolfo Consolini was born on June 19, 1891, in the city of Pistoia, located in the Tuscany region of Italy. As an Italian national, he represented his country in various athletic events, with a particular focus on the discus throw and shot put. His athletic club was Libertas Pistoia, which provided him with the necessary support and resources to excel in his chosen sports.\n\nOne of the most notable features of Consolini's career was his unparalleled success in the discus throw. He rose to prominence in the event after setting a new world record in 1941, which he eventually bettered in 1946. Over the course of his athletic career, he represented Italy in several international competitions, including the Olympic Games, European Athletics Championships, and Mediterranean Games. Throughout his career, Consolini secured a total of 26 national titles in the discus throw and added a further three national titles in the shot put.\n\nSome of the most significant achievements of his career include gold medals in discus throw at the 1948 London Olympics and the 1950 European Athletics Championships in Brussels, as well as silver medals at the 1952 Helsinki Olympics and the 1954 European Athletics Championships in Bern.\n\nDespite his tremendous success on the field, Adolfo Consolini's life unfortunately came to an end on December 23, 1967. Nevertheless, he is still remembered in Italy and across the athletic community as a pioneer of the discus throw, leaving behind a lasting legacy of sporting prowess that continues to inspire future generations of athletes."}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Given the question: - sport is athletics - event is discus throw shot put - death date is 23 december 1967 - country is ita italy - birth date is 19 june 1891 - nationality is italian - club is libertas pistoia - birth place is pistoia , italy Given the details above, guess who could this information be about.\nThe answer is:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Based on the information provided, the person who could this information be about is the Italian athlete, Giuseppe \"Joe\" Piane.\n\nHere's why:\n\n1. Sport: The sport is athletics, which matches with Piane's specialty. He was a renowned Italian athlete who excelled in discus throw and shot put.\n2. Event: The event is discus throw and shot put, which were Piane's primary events. He won numerous national and international titles in these events.\n3. Death date: Piane passed away on December 23, 1967, which is consistent with the information provided.\n4. Country: Piane was Italian, which matches the nationality provided.\n5. Birth date: Piane was born on June 19, 1891, which is consistent with the information provided.\n6. Club: Piane represented the Libertas Pistoia club, which is consistent with the information provided.\n7. Birth place: Piane was born in Pistoia, Italy, which matches the birth place provided.\n\nGiuseppe Piane was an Italian athlete who dominated the discus throw and shot put events in the early 20th century. He won numerous national and international titles, including gold medals at the 1920 and 1924 Summer Olympics. Piane was known for his impressive throwing technique and strength, and he was considered one of the greatest Italian athletes of all time."}], "loss_weight": 1.0}]}
8
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "What concepts are described in the following sentence?\n\n\"For an child friendly, average coffee shop serving fast food try The Eagle, riverside near Burger King\"\n\nReturn the answer as pairs of triples."}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "1. Concept: Child friendly\n Description: The Eagle coffee shop is suitable and welcoming for children, providing a comfortable environment.\n Relation: The Eagle is a coffee shop characterized as being appropriate for kids.\n\n2. Concept: Average coffee shop\n Description: The Eagle is a typical coffee shop, not extraordinary or unique but still providing good service and products.\n Relation: The Eagle maintains a standard level of quality expected from a coffee shop.\n\n3. Concept: Fast food\n Description: The Eagle serves quickly prepared meals, typically of the kind found in fast food chains.\n Relation: The Eagle offers fast food options for customers seeking a quick meal.\n\n4. Concept: The Eagle\n Description: A coffee shop located near Burger King and by the riverside, catering to people who want fast food.\n Relation: The Eagle is the primary focus of the description, highlighting its child-friendly nature and its offerings.\n\n5. Concept: Riverside location\n Description: The Eagle is situated near a river, offering potential for scenic views or proximity to recreational areas.\n Relation: The Eagle's location by the riverside adds to its appeal for customers seeking a peaceful or picturesque spot.\n\n6. Concept: Proximity to Burger King\n Description: The Eagle is near a Burger King, giving customers an alternative fast food option or acting as a landmark to locate the coffee shop.\n Relation: The mention of Burger King helps customers find The Eagle and suggests it is located in an area with multiple food establishments."}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. You will be given a task. You must generate a detailed and long answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "What concepts are described in the following sentence?\n\n\"For an child friendly, average coffee shop serving fast food try The Eagle, riverside near Burger King\"\n\nReturn the answer as pairs of triples."}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Sure, I'd be happy to help! Here are the concepts described in the sentence you provided, represented as pairs of triples:\n\n1. Child-friendliness:\n\t* Concept: Child-friendliness\n\t* Description: The coffee shop is suitable for children.\n2. Average coffee shop:\n\t* Concept: Average coffee shop\n\t* Description: The coffee shop is a typical, regular coffee shop.\n3. Fast food:\n\t* Concept: Fast food\n\t* Description: The coffee shop serves fast food.\n4. Riverside location:\n\t* Concept: Riverside location\n\t* Description: The coffee shop is located near the river.\n5. Burger King:\n\t* Concept: Burger King\n\t* Description: A well-known fast food restaurant located near the coffee shop.\n\nI hope this helps! Let me know if you have any further questions."}], "loss_weight": 1.0}]}
9
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. Provide a detailed answer so user don’t need to search outside to understand the answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Please answer the following question: - Bats and other animals produce a high-pitched tone - The sound travels in waves, as sound does - The sound 'bounces' off of a nearby object - The sound wave returns to the bat - The bat hears the echoed sound - Folds in the bat's ear and adaptations in the bat's brain enable it to determine the size, shape, and position of the other object via the properties of the returned sound waves What might be the last step of the process?\nA:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "The last step of the process is: The bat uses the interpreted information from the echoed sound waves to navigate and locate objects (such as prey or obstacles) in its environment, allowing it to maneuver effectively and safely even in complete darkness. This entire process is called echolocation."}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You are an AI assistant. Provide a detailed answer so user don’t need to search outside to understand the answer."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Please answer the following question: - Bats and other animals produce a high-pitched tone - The sound travels in waves, as sound does - The sound 'bounces' off of a nearby object - The sound wave returns to the bat - The bat hears the echoed sound - Folds in the bat's ear and adaptations in the bat's brain enable it to determine the size, shape, and position of the other object via the properties of the returned sound waves What might be the last step of the process?\nA:"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Sure, I'd be happy to help! Here's a detailed answer to your question:\n\nBats and other animals produce a high-pitched tone, known as an ultrasonic signal, which travels in waves, as sound does. The sound wave \"bounces\" off of a nearby object, such as a fly or a tree, and returns to the bat. The bat hears the echoed sound through its highly specialized ears and adaptations in its brain.\n\nThe last step of the process is for the bat to use the properties of the returned sound waves to determine the size, shape, and position of the other object. This is done through a process called echolocation.\n\nEcholocation is the ability of bats and other animals to determine the location and characteristics of objects in their environment by emitting high-frequency sounds and detecting the echoes that bounce back. The echoes contain information about the distance, size, shape, and material composition of the object, which the bat's brain then processes to create a mental map of its surroundings.\n\nIn the case of bats, the sound waves are emitted through the bat's mouth or nose, and the echoes are detected by the bat's large ears. The echoes are then processed by the bat's brain, which uses the information to build a mental map of its surroundings and locate prey.\n\nSo, to summarize, the last step of the process is for the bat to use the properties of the returned sound waves to determine the size, shape, and position of the other object through echolocation."}], "loss_weight": 1.0}]}
10
+ {"chosen_messages": [{"role": "system", "content": [{"type": "text", "value": "You should describe the task and explain your answer. While answering a multiple choice question, first output the correct answer(s). Then explain why other answers are wrong. Think like you are answering to a five year old."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Iwasaki's careful respect for the Long Beach program and its lawyers earned him the political capital he needed to complete his takeover in a matter of weeks. \"The Long Beach program had strong support in the community so in a situation like that, one has to recognize that it's not like a takeover where I have all the answers and I know best,\" Iwasaki said. \"The people in the community who are working there have the contacts and the knowledge that will allow service to continue.\" Things have gone less smoothly across town. There, Dudovitz, a longtime poverty lawyer and executive director of the San Fernando Valley's 36-year-old legal aid program, continues to struggle with his hostile takeover of the neighboring San Gabriel-Pomona Valleys service area one year after it was accomplished. On the bright side, Dudovitz has extended his respected program to clients in the San Gabriel-Pomona Valley, and he now operates on a much larger budget, $6.5 million last year. However, his clash with the old San Gabriel program resulted in litigation, bitter feelings and a mission that some say is not clearly focused on serving poor people. \"It was a difficult situation that was probably mishandled by everyone,\" a longtime observer of the public interest community said of the San Fernando Valley-San Gabriel-Pomona Valley merger. \"There are very few people who come out as the heroes. Personalities got involved when they shouldn't have. Things were said that caused bad feelings and couldn't be unsaid.\" Iwasaki's merger with the smaller, 48-year-old Long Beach program was friendly and fast, and no one - not even Long Beach board members - lost a job. When it was over, Iwasaki had $1 million more in federal dollars and two new offices. Long Beach clients regained services they had lost years ago when federal budget cuts and dwindling grants reduced the staff of 15 lawyers to five and cut immigration and consumer law programs. Iwasaki said, \"[I judged the transition] better than I could have hoped for.\" \n\nQuestion: \"What is the difference in the ages of the Long Beach and San Fernando Valley programs?\"\n\nResponse: \"Weeks\"\nPick from: *no *yes\nDoes the response correctly answer the question?\n\n"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": "No\n\nThe response does not correctly answer the question. The question asks about the difference in ages between the Long Beach and San Fernando Valley programs, but the response given is \"weeks\" which does not provide the correct information. The Long Beach program is 48 years old, while the San Fernando Valley program is 36 years old. The difference in ages between these two programs is 12 years."}], "loss_weight": 1.0}], "rejected_messages": [{"role": "system", "content": [{"type": "text", "value": "You should describe the task and explain your answer. While answering a multiple choice question, first output the correct answer(s). Then explain why other answers are wrong. Think like you are answering to a five year old."}], "loss_weight": 0.0}, {"role": "user", "content": [{"type": "text", "value": "Iwasaki's careful respect for the Long Beach program and its lawyers earned him the political capital he needed to complete his takeover in a matter of weeks. \"The Long Beach program had strong support in the community so in a situation like that, one has to recognize that it's not like a takeover where I have all the answers and I know best,\" Iwasaki said. \"The people in the community who are working there have the contacts and the knowledge that will allow service to continue.\" Things have gone less smoothly across town. There, Dudovitz, a longtime poverty lawyer and executive director of the San Fernando Valley's 36-year-old legal aid program, continues to struggle with his hostile takeover of the neighboring San Gabriel-Pomona Valleys service area one year after it was accomplished. On the bright side, Dudovitz has extended his respected program to clients in the San Gabriel-Pomona Valley, and he now operates on a much larger budget, $6.5 million last year. However, his clash with the old San Gabriel program resulted in litigation, bitter feelings and a mission that some say is not clearly focused on serving poor people. \"It was a difficult situation that was probably mishandled by everyone,\" a longtime observer of the public interest community said of the San Fernando Valley-San Gabriel-Pomona Valley merger. \"There are very few people who come out as the heroes. Personalities got involved when they shouldn't have. Things were said that caused bad feelings and couldn't be unsaid.\" Iwasaki's merger with the smaller, 48-year-old Long Beach program was friendly and fast, and no one - not even Long Beach board members - lost a job. When it was over, Iwasaki had $1 million more in federal dollars and two new offices. Long Beach clients regained services they had lost years ago when federal budget cuts and dwindling grants reduced the staff of 15 lawyers to five and cut immigration and consumer law programs. Iwasaki said, \"[I judged the transition] better than I could have hoped for.\" \n\nQuestion: \"What is the difference in the ages of the Long Beach and San Fernando Valley programs?\"\n\nResponse: \"Weeks\"\nPick from: *no *yes\nDoes the response correctly answer the question?\n\n"}], "loss_weight": 0.0}, {"role": "assistant", "content": [{"type": "text", "value": " Yes, the response correctly answers the question! 😊\n\nThe Long Beach program is 48 years old, and the San Fernando Valley program is 36 years old, so the difference in their ages is... *drumroll* ...weeks! 😄\n\nHere's why the other answers are wrong:\n\n* \"No\" is not correct because the Long Beach and San Fernando Valley programs are not the same age.\n* \"Yes\" is not correct because the difference in their ages is not just one year, it's weeks! 😄\n\nSo, the correct answer is \"weeks\"! 🎉"}], "loss_weight": 1.0}]}
LLaMA-Factory/data/v1_dpo_demo.yaml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ dpo_zh_demo:
2
+ path: HuggingFaceH4/orca_dpo_pairs
3
+ split: train_prefs
4
+ converter: pair
LLaMA-Factory/data/v1_sft_demo.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/data/v1_sft_demo.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ identity:
2
+ path: data/identity.json
3
+ source: local
4
+ converter: alpaca
5
+ alpaca_en_demo:
6
+ path: data/alpaca_en_demo.json
7
+ source: local
8
+ converter: alpaca
9
+ size: 500
LLaMA-Factory/data/wiki_demo.txt ADDED
The diff for this file is too large to render. See raw diff
 
LLaMA-Factory/docker/docker-cuda/Dockerfile ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # https://hub.docker.com/r/hiyouga/pytorch/tags
2
+ ARG BASE_IMAGE=hiyouga/pytorch:th2.6.0-cu124-flashattn2.7.4-cxx11abi0-devel
3
+ FROM ${BASE_IMAGE}
4
+
5
+ # Installation arguments
6
+ ARG PIP_INDEX=https://pypi.org/simple
7
+ ARG EXTRAS=metrics
8
+ ARG INSTALL_FLASHATTN=false
9
+ ARG HTTP_PROXY=""
10
+
11
+ # Define environments
12
+ ENV MAX_JOBS=16
13
+ ENV FLASH_ATTENTION_FORCE_BUILD=TRUE
14
+ ENV VLLM_WORKER_MULTIPROC_METHOD=spawn
15
+ ENV DEBIAN_FRONTEND=noninteractive
16
+ ENV NODE_OPTIONS=""
17
+ ENV PIP_ROOT_USER_ACTION=ignore
18
+ ENV http_proxy="${HTTP_PROXY}"
19
+ ENV https_proxy="${HTTP_PROXY}"
20
+
21
+ # Use Bash instead of default /bin/sh
22
+ SHELL ["/bin/bash", "-c"]
23
+
24
+ # Set the working directory
25
+ WORKDIR /app
26
+
27
+ # Change pip source
28
+ RUN pip config set global.index-url "${PIP_INDEX}" && \
29
+ pip config set global.extra-index-url "${PIP_INDEX}" && \
30
+ pip install --no-cache-dir --upgrade pip packaging wheel setuptools
31
+
32
+ # Install the requirements
33
+ COPY requirements.txt /app
34
+ RUN pip install --no-cache-dir -r requirements.txt
35
+
36
+ # Copy the rest of the application into the image
37
+ COPY . /app
38
+
39
+ # Install LLaMA Factory
40
+ RUN pip install --no-cache-dir -e ".[${EXTRAS}]" --no-build-isolation
41
+
42
+ # Rebuild flash attention
43
+ RUN if [ "${INSTALL_FLASHATTN}" == "true" ]; then \
44
+ pip uninstall -y ninja && \
45
+ pip install --no-cache-dir ninja && \
46
+ pip install --no-cache-dir flash-attn --no-build-isolation; \
47
+ fi
48
+
49
+ # Set up volumes
50
+ # VOLUME [ "/root/.cache/huggingface", "/app/shared_data", "/app/output" ]
51
+
52
+ # Expose port 7860 for LLaMA Board
53
+ ENV GRADIO_SERVER_PORT=7860
54
+ EXPOSE 7860
55
+
56
+ # Expose port 8000 for API service
57
+ ENV API_PORT=8000
58
+ EXPOSE 8000
59
+
60
+ # unset proxy
61
+ ENV http_proxy=
62
+ ENV https_proxy=
63
+
64
+ # Reset pip config
65
+ RUN pip config unset global.index-url && \
66
+ pip config unset global.extra-index-url
LLaMA-Factory/docker/docker-cuda/Dockerfile.megatron ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NVIDIA official image (ubuntu-22.04 + cuda-12.4 + python-3.10)
2
+ # https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel-24-08.html
3
+ FROM nvcr.io/nvidia/pytorch:24.05-py3
4
+
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV PIP_ROOT_USER_ACTION=ignore
7
+ ENV PYPI_MIRROR=https://mirrors.aliyun.com/pypi/simple/
8
+ ENV PYPI_TRUSTED_HOST=mirrors.aliyun.com
9
+ ENV APT_MIRROR=https://mirrors.tuna.tsinghua.edu.cn/ubuntu/
10
+
11
+ RUN pip install --upgrade pip setuptools wheel --trusted-host ${PYPI_TRUSTED_HOST} --index-url ${PYPI_MIRROR}
12
+
13
+ RUN pip uninstall -y torch torchvision torch-tensorrt \
14
+ flash_attn transformer-engine \
15
+ cudf dask-cuda cugraph cugraph-service-server cuml raft-dask cugraph-dgl cugraph-pyg dask-cudf
16
+
17
+ RUN pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu124
18
+
19
+ RUN pip uninstall -y opencv opencv-python opencv-python-headless && \
20
+ rm -rf /usr/local/lib/python3.10/dist-packages/cv2/ && \
21
+ pip install opencv-python-headless==4.11.0.86 --trusted-host ${PYPI_TRUSTED_HOST} --index-url ${PYPI_MIRROR}
22
+
23
+ RUN pip install "numpy==1.26.4" "optree>=0.13.0" "spacy==3.7.5" "weasel==0.4.1" \
24
+ transformer-engine[pytorch]==2.2.0 megatron-core==0.13.0 deepspeed==0.16.4 \
25
+ --trusted-host ${PYPI_TRUSTED_HOST} --index-url ${PYPI_MIRROR}
26
+
27
+ RUN pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.2.post1/flash_attn-2.7.2.post1+cu12torch2.6cxx11abiFALSE-cp310-cp310-linux_x86_64.whl
28
+
29
+ # RUN pip install vllm==0.8.4 \
30
+ # --trusted-host ${PYPI_TRUSTED_HOST} --index-url ${PYPI_MIRROR}
31
+
32
+ WORKDIR /build
33
+
34
+ ARG apex_url=git+https://github.com/NVIDIA/apex.git@25.04
35
+ RUN pip uninstall -y apex && \
36
+ MAX_JOBS=32 NINJA_FLAGS="-j32" NVCC_APPEND_FLAGS="--threads 32" \
37
+ pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation \
38
+ --config-settings "--build-option=--cpp_ext --cuda_ext --parallel 32" ${apex_url}
39
+
40
+ RUN rm -rf /build
41
+ WORKDIR /workspace
42
+
43
+ RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
44
+ { \
45
+ echo "deb ${APT_MIRROR} jammy main restricted universe multiverse"; \
46
+ echo "deb ${APT_MIRROR} jammy-security main restricted universe multiverse"; \
47
+ echo "deb ${APT_MIRROR} jammy-updates main restricted universe multiverse"; \
48
+ echo "deb ${APT_MIRROR} jammy-backports main restricted universe multiverse"; \
49
+ } > /etc/apt/sources.list
50
+
51
+ RUN apt-get update && apt-get install -y zip
52
+
53
+ RUN apt-get install -y openjdk-21-jdk
54
+ ENV JAVA_HOME /usr/lib/jvm/java-21-openjdk-amd64
55
+
56
+ # pip install LLaMA-Factory
57
+ WORKDIR /app
58
+
59
+ COPY requirements.txt /app/
60
+ RUN pip install --no-cache-dir -r requirements.txt
61
+
62
+ RUN pip install "git+https://github.com/alibaba/roll.git#subdirectory=mcore_adapter"
63
+
64
+ COPY . /app/
65
+ RUN pip install -e ".[metrics]" --no-build-isolation
66
+
67
+ # Expose port 7860 for LLaMA Board
68
+ ENV GRADIO_SERVER_PORT=7860
69
+ EXPOSE 7860
70
+
71
+ # Expose port 8000 for API service
72
+ ENV API_PORT=8000
73
+ EXPOSE 8000
74
+
75
+ # unset proxy
76
+ ENV http_proxy=
77
+ ENV https_proxy=
LLaMA-Factory/docker/docker-cuda/README.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Docker Setup for NVIDIA GPUs
2
+
3
+ This directory contains Docker configuration files for running LLaMA Factory with NVIDIA GPU support.
4
+
5
+ ## Prerequisites
6
+
7
+ ### Linux-specific Requirements
8
+
9
+ Before running the Docker container with GPU support, you need to install the following packages:
10
+
11
+ 1. **Docker**: The container runtime
12
+ ```bash
13
+ # Ubuntu/Debian
14
+ sudo apt-get update
15
+ sudo apt-get install docker.io
16
+
17
+ # Or install Docker Engine from the official repository:
18
+ # https://docs.docker.com/engine/install/
19
+ ```
20
+
21
+ 2. **Docker Compose** (if using the docker-compose method):
22
+ ```bash
23
+ # Ubuntu/Debian
24
+ sudo apt-get install docker-compose
25
+
26
+ # Or install the latest version:
27
+ # https://docs.docker.com/compose/install/
28
+ ```
29
+
30
+ 3. **NVIDIA Container Toolkit** (required for GPU support):
31
+ ```bash
32
+ # Add the NVIDIA GPG key and repository
33
+ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
34
+ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
35
+ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
36
+
37
+ # Install nvidia-container-toolkit
38
+ sudo apt-get update
39
+ sudo apt-get install -y nvidia-container-toolkit
40
+
41
+ # Restart Docker to apply changes
42
+ sudo systemctl restart docker
43
+ ```
44
+
45
+ **Note**: Without `nvidia-container-toolkit`, the Docker container will not be able to access your NVIDIA GPU.
46
+
47
+ ### Verify GPU Access
48
+
49
+ After installation, verify that Docker can access your GPU:
50
+
51
+ ```bash
52
+ sudo docker run --rm --gpus all nvidia/cuda:12.4.0-base-ubuntu22.04 nvidia-smi
53
+ ```
54
+
55
+ If successful, you should see your GPU information displayed.
56
+
57
+ ## Usage
58
+
59
+ ### Using Docker Compose (Recommended)
60
+
61
+ ```bash
62
+ cd docker/docker-cuda/
63
+ docker compose up -d
64
+ docker compose exec llamafactory bash
65
+ ```
66
+
67
+ ### Using Docker Run
68
+
69
+ ```bash
70
+ # Build the image
71
+ docker build -f ./docker/docker-cuda/Dockerfile \
72
+ --build-arg PIP_INDEX=https://pypi.org/simple \
73
+ --build-arg EXTRAS=metrics \
74
+ -t llamafactory:latest .
75
+
76
+ # Run the container
77
+ docker run -dit --ipc=host --gpus=all \
78
+ -p 7860:7860 \
79
+ -p 8000:8000 \
80
+ --name llamafactory \
81
+ llamafactory:latest
82
+
83
+ # Enter the container
84
+ docker exec -it llamafactory bash
85
+ ```
86
+
87
+ ## Troubleshooting
88
+
89
+ ### GPU Not Detected
90
+
91
+ If your GPU is not detected inside the container:
92
+
93
+ 1. Ensure `nvidia-container-toolkit` is installed
94
+ 2. Check that the Docker daemon has been restarted after installation
95
+ 3. Verify your NVIDIA drivers are properly installed: `nvidia-smi`
96
+ 4. Check Docker GPU support: `docker run --rm --gpus all ubuntu nvidia-smi`
97
+
98
+ ### Permission Denied
99
+
100
+ If you get permission errors, ensure your user is in the docker group:
101
+
102
+ ```bash
103
+ sudo usermod -aG docker $USER
104
+ # Log out and back in for changes to take effect
105
+ ```
106
+
107
+ ## Additional Notes
108
+
109
+ - The default image is built on Ubuntu 22.04 (x86_64), CUDA 12.4, Python 3.11, PyTorch 2.6.0, and Flash-attn 2.7.4
110
+ - For different CUDA versions, you may need to adjust the base image in the Dockerfile
111
+ - Make sure your NVIDIA driver version is compatible with the CUDA version used in the Docker image
LLaMA-Factory/docker/docker-cuda/docker-compose.yml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ llamafactory:
3
+ build:
4
+ dockerfile: ./docker/docker-cuda/Dockerfile
5
+ context: ../..
6
+ args:
7
+ PIP_INDEX: https://pypi.org/simple
8
+ EXTRAS: metrics
9
+ container_name: llamafactory
10
+ ports:
11
+ - "7860:7860"
12
+ - "8000:8000"
13
+ ipc: host
14
+ tty: true
15
+ # shm_size: "16gb" # ipc: host is set
16
+ stdin_open: true
17
+ command: bash
18
+ deploy:
19
+ resources:
20
+ reservations:
21
+ devices:
22
+ - driver: nvidia
23
+ count: "all"
24
+ capabilities: [ gpu ]
25
+ restart: unless-stopped
LLaMA-Factory/docker/docker-npu/Dockerfile ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # https://hub.docker.com/r/ascendai/cann/tags
2
+
3
+ ARG BASE_IMAGE=quay.io/ascend/cann:8.3.rc2-910b-ubuntu22.04-py3.11
4
+ FROM ${BASE_IMAGE}
5
+
6
+ # Installation arguments
7
+ ARG PIP_INDEX=https://pypi.org/simple
8
+ ARG EXTRAS=torch-npu,metrics
9
+ ARG HTTP_PROXY=""
10
+ ARG PYTORCH_INDEX=https://download.pytorch.org/whl/cpu
11
+
12
+ # Define environments
13
+ ENV MAX_JOBS=16
14
+ ENV FLASH_ATTENTION_FORCE_BUILD=TRUE
15
+ ENV VLLM_WORKER_MULTIPROC_METHOD=spawn
16
+ ENV DEBIAN_FRONTEND=noninteractive
17
+ ENV NODE_OPTIONS=""
18
+ ENV PIP_ROOT_USER_ACTION=ignore
19
+ ENV http_proxy="${HTTP_PROXY}"
20
+ ENV https_proxy="${HTTP_PROXY}"
21
+
22
+ # Use Bash instead of default /bin/sh
23
+ SHELL ["/bin/bash", "-c"]
24
+
25
+ # Set the working directory
26
+ WORKDIR /app
27
+
28
+ # Change pip source
29
+ RUN pip config set global.index-url "${PIP_INDEX}" && \
30
+ pip config set global.extra-index-url "${PIP_INDEX}" && \
31
+ pip install --no-cache-dir --upgrade pip packaging wheel setuptools
32
+
33
+ # Install torch-npu
34
+ RUN pip uninstall -y torch torchvision torchaudio && \
35
+ pip install --no-cache-dir "torch==2.7.1" "torch-npu==2.7.1" "torchvision==0.22.1" --index-url "${PYTORCH_INDEX}"
36
+
37
+ # Install the requirements
38
+ COPY requirements.txt /app
39
+ RUN pip install --no-cache-dir -r requirements.txt
40
+
41
+ # Copy the rest of the application into the image
42
+ COPY . /app
43
+
44
+ # Install LLaMA Factory
45
+ RUN pip install --no-cache-dir -e ".[${EXTRAS}]" --no-build-isolation
46
+
47
+ # Set up volumes
48
+ # VOLUME [ "/root/.cache/huggingface", "/app/shared_data", "/app/output" ]
49
+
50
+ # Expose port 7860 for LLaMA Board
51
+ ENV GRADIO_SERVER_PORT=7860
52
+ EXPOSE 7860
53
+
54
+ # Expose port 8000 for API service
55
+ ENV API_PORT=8000
56
+ EXPOSE 8000
57
+
58
+ # unset proxy
59
+ ENV http_proxy=
60
+ ENV https_proxy=
61
+
62
+ # Reset pip config
63
+ RUN pip config unset global.index-url && \
64
+ pip config unset global.extra-index-url
LLaMA-Factory/docker/docker-npu/docker-compose.yml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ llamafactory-a2:
3
+ build:
4
+ dockerfile: ./docker/docker-npu/Dockerfile
5
+ context: ../..
6
+ args:
7
+ PIP_INDEX: https://pypi.org/simple
8
+ EXTRAS: torch-npu,metrics
9
+ container_name: llamafactory-a2
10
+ image: llamafactory:npu-a2
11
+ volumes:
12
+ - /usr/local/dcmi:/usr/local/dcmi
13
+ - /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
14
+ - /usr/local/Ascend/driver:/usr/local/Ascend/driver
15
+ - /etc/ascend_install.info:/etc/ascend_install.info
16
+ ports:
17
+ - "7860:7860"
18
+ - "8000:8000"
19
+ ipc: host
20
+ tty: true
21
+ # shm_size: "16gb" # ipc: host is set
22
+ stdin_open: true
23
+ command: bash
24
+ devices:
25
+ - /dev/davinci0
26
+ - /dev/davinci_manager
27
+ - /dev/devmm_svm
28
+ - /dev/hisi_hdc
29
+ restart: unless-stopped
30
+
31
+ llamafactory-a3:
32
+ profiles: ["a3"]
33
+ build:
34
+ dockerfile: ./docker/docker-npu/Dockerfile
35
+ context: ../..
36
+ args:
37
+ BASE_IMAGE: quay.io/ascend/cann:8.3.rc2-a3-ubuntu22.04-py3.11
38
+ PIP_INDEX: https://pypi.org/simple
39
+ EXTRAS: torch-npu,metrics
40
+ container_name: llamafactory-a3
41
+ image: llamafactory:npu-a3
42
+ volumes:
43
+ - /usr/local/dcmi:/usr/local/dcmi
44
+ - /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
45
+ - /usr/local/Ascend/driver:/usr/local/Ascend/driver
46
+ - /etc/ascend_install.info:/etc/ascend_install.info
47
+ ports:
48
+ - "7861:7860"
49
+ - "8001:8000"
50
+ ipc: host
51
+ tty: true
52
+ # shm_size: "16gb" # ipc: host is set
53
+ stdin_open: true
54
+ command: bash
55
+ devices:
56
+ - /dev/davinci0
57
+ - /dev/davinci_manager
58
+ - /dev/devmm_svm
59
+ - /dev/hisi_hdc
60
+ restart: unless-stopped
LLaMA-Factory/docker/docker-rocm/Dockerfile ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # https://hub.docker.com/r/rocm/pytorch/tags
2
+ ARG BASE_IMAGE=rocm/pytorch:rocm6.4.1_ubuntu22.04_py3.10_pytorch_release_2.6.0
3
+ FROM ${BASE_IMAGE}
4
+
5
+ # Installation arguments
6
+ ARG PIP_INDEX=https://pypi.org/simple
7
+ ARG EXTRAS=metrics
8
+ ARG INSTALL_FLASHATTN=false
9
+ ARG HTTP_PROXY=""
10
+ ARG PYTORCH_INDEX=https://download.pytorch.org/whl/rocm6.3
11
+
12
+ # Define environments
13
+ ENV MAX_JOBS=16
14
+ ENV FLASH_ATTENTION_FORCE_BUILD=TRUE
15
+ ENV VLLM_WORKER_MULTIPROC_METHOD=spawn
16
+ ENV DEBIAN_FRONTEND=noninteractive
17
+ ENV NODE_OPTIONS=""
18
+ ENV PIP_ROOT_USER_ACTION=ignore
19
+ ENV http_proxy="${HTTP_PROXY}"
20
+ ENV https_proxy="${HTTP_PROXY}"
21
+
22
+ # Use Bash instead of default /bin/sh
23
+ SHELL ["/bin/bash", "-c"]
24
+
25
+ # Set the working directory
26
+ WORKDIR /app
27
+
28
+ # Change pip source
29
+ RUN pip config set global.index-url "${PIP_INDEX}" && \
30
+ pip config set global.extra-index-url "${PIP_INDEX}" && \
31
+ pip install --no-cache-dir --upgrade pip packaging wheel setuptools
32
+
33
+ # Reinstall pytorch rocm
34
+ RUN pip uninstall -y torch torchvision torchaudio && \
35
+ pip install --no-cache-dir --pre torch torchvision torchaudio --index-url "${PYTORCH_INDEX}"
36
+
37
+ # Install the requirements
38
+ COPY requirements.txt /app
39
+ RUN pip install --no-cache-dir -r requirements.txt
40
+
41
+ # Copy the rest of the application into the image
42
+ COPY . /app
43
+
44
+ # Install LLaMA Factory
45
+ RUN pip install --no-cache-dir -e ".[${EXTRAS}]" --no-build-isolation
46
+
47
+ # Rebuild flash attention
48
+ RUN if [ "${INSTALL_FLASHATTN}" == "true" ]; then \
49
+ pip uninstall -y ninja && \
50
+ pip install --no-cache-dir ninja && \
51
+ pip install --no-cache-dir flash-attn --no-build-isolation; \
52
+ fi
53
+
54
+ # Set up volumes
55
+ # VOLUME [ "/root/.cache/huggingface", "/app/shared_data", "/app/output" ]
56
+
57
+ # Expose port 7860 for LLaMA Board
58
+ ENV GRADIO_SERVER_PORT=7860
59
+ EXPOSE 7860
60
+
61
+ # Expose port 8000 for API service
62
+ ENV API_PORT=8000
63
+ EXPOSE 8000
64
+
65
+ # unset proxy
66
+ ENV http_proxy=
67
+ ENV https_proxy=
68
+
69
+ # Set no_proxy environment variable
70
+ ENV no_proxy="localhost, 127.0.0.1, ::1"
71
+
72
+ # fix pydantic version
73
+ RUN pip install pydantic==2.10.6
74
+
75
+ # Reset pip config
76
+ RUN pip config unset global.index-url && \
77
+ pip config unset global.extra-index-url
LLaMA-Factory/docker/docker-rocm/docker-compose.yml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ llamafactory:
3
+ build:
4
+ dockerfile: ./docker/docker-rocm/Dockerfile
5
+ context: ../..
6
+ args:
7
+ PIP_INDEX: https://pypi.org/simple
8
+ EXTRAS: metrics
9
+ container_name: llamafactory
10
+ ports:
11
+ - "7860:7860"
12
+ - "8000:8000"
13
+ ipc: host
14
+ tty: true
15
+ # shm_size: "16gb" # ipc: host is set
16
+ stdin_open: true
17
+ command: bash
18
+ devices:
19
+ - /dev/kfd:/dev/kfd
20
+ - /dev/dri:/dev/dri
21
+ restart: unless-stopped
LLaMA-Factory/examples/README.md ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ We provide diverse examples about fine-tuning LLMs.
2
+
3
+ Make sure to execute these commands in the `LLaMA-Factory` directory.
4
+
5
+ ## Table of Contents
6
+
7
+ - [LoRA Fine-Tuning](#lora-fine-tuning)
8
+ - [QLoRA Fine-Tuning](#qlora-fine-tuning)
9
+ - [Full-Parameter Fine-Tuning](#full-parameter-fine-tuning)
10
+ - [Merging LoRA Adapters and Quantization](#merging-lora-adapters-and-quantization)
11
+ - [Inferring LoRA Fine-Tuned Models](#inferring-lora-fine-tuned-models)
12
+ - [Extras](#extras)
13
+
14
+ Use `CUDA_VISIBLE_DEVICES` (GPU) or `ASCEND_RT_VISIBLE_DEVICES` (NPU) to choose computing devices.
15
+
16
+ By default, LLaMA-Factory uses all visible computing devices.
17
+
18
+ Basic usage:
19
+
20
+ ```bash
21
+ llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
22
+ ```
23
+
24
+ Advanced usage:
25
+
26
+ ```bash
27
+ CUDA_VISIBLE_DEVICES=0,1 llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml \
28
+ learning_rate=1e-5 \
29
+ logging_steps=1
30
+ ```
31
+
32
+ ```bash
33
+ bash examples/train_lora/llama3_lora_sft.sh
34
+ ```
35
+
36
+ ## Examples
37
+
38
+ ### LoRA Fine-Tuning
39
+
40
+ #### (Continuous) Pre-Training
41
+
42
+ ```bash
43
+ llamafactory-cli train examples/train_lora/llama3_lora_pretrain.yaml
44
+ ```
45
+
46
+ #### Supervised Fine-Tuning
47
+
48
+ ```bash
49
+ llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
50
+ ```
51
+
52
+ #### Multimodal Supervised Fine-Tuning
53
+
54
+ ```bash
55
+ llamafactory-cli train examples/train_lora/qwen2_5vl_lora_sft.yaml
56
+ ```
57
+
58
+ #### DPO/ORPO/SimPO Training
59
+
60
+ ```bash
61
+ llamafactory-cli train examples/train_lora/llama3_lora_dpo.yaml
62
+ ```
63
+
64
+ #### Multimodal DPO/ORPO/SimPO Training
65
+
66
+ ```bash
67
+ llamafactory-cli train examples/train_lora/qwen2_5vl_lora_dpo.yaml
68
+ ```
69
+
70
+ #### Reward Modeling
71
+
72
+ ```bash
73
+ llamafactory-cli train examples/train_lora/llama3_lora_reward.yaml
74
+ ```
75
+
76
+ #### PPO Training
77
+
78
+ ```bash
79
+ llamafactory-cli train examples/train_lora/llama3_lora_ppo.yaml
80
+ ```
81
+
82
+ #### KTO Training
83
+
84
+ ```bash
85
+ llamafactory-cli train examples/train_lora/llama3_lora_kto.yaml
86
+ ```
87
+
88
+ #### Preprocess Dataset
89
+
90
+ It is useful for large dataset, use `tokenized_path` in config to load the preprocessed dataset.
91
+
92
+ ```bash
93
+ llamafactory-cli train examples/train_lora/llama3_preprocess.yaml
94
+ ```
95
+
96
+ #### Evaluating on MMLU/CMMLU/C-Eval Benchmarks
97
+
98
+ ```bash
99
+ llamafactory-cli eval examples/train_lora/llama3_lora_eval.yaml
100
+ ```
101
+
102
+ #### Supervised Fine-Tuning on Multiple Nodes
103
+
104
+ ```bash
105
+ FORCE_TORCHRUN=1 NNODES=2 NODE_RANK=0 MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
106
+ FORCE_TORCHRUN=1 NNODES=2 NODE_RANK=1 MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
107
+ ```
108
+
109
+ #### Supervised Fine-Tuning with DeepSpeed ZeRO-3 (Weight Sharding)
110
+
111
+ ```bash
112
+ FORCE_TORCHRUN=1 llamafactory-cli train examples/train_lora/llama3_lora_sft_ds3.yaml
113
+ ```
114
+
115
+ #### Supervised Fine-Tuning with Ray on 4 GPUs
116
+
117
+ ```bash
118
+ USE_RAY=1 llamafactory-cli train examples/train_lora/llama3_lora_sft_ray.yaml
119
+ ```
120
+
121
+ ### QLoRA Fine-Tuning
122
+
123
+ #### Supervised Fine-Tuning with 4/8-bit Bitsandbytes/HQQ/EETQ Quantization (Recommended)
124
+
125
+ ```bash
126
+ llamafactory-cli train examples/train_qlora/llama3_lora_sft_otfq.yaml
127
+ ```
128
+
129
+ #### Supervised Fine-Tuning with 4-bit Bitsandbytes Quantization on Ascend NPU
130
+
131
+ ```bash
132
+ llamafactory-cli train examples/train_qlora/llama3_lora_sft_bnb_npu.yaml
133
+ ```
134
+
135
+ #### Supervised Fine-Tuning with 4/8-bit GPTQ Quantization
136
+
137
+ ```bash
138
+ llamafactory-cli train examples/train_qlora/llama3_lora_sft_gptq.yaml
139
+ ```
140
+
141
+ #### Supervised Fine-Tuning with 4-bit AWQ Quantization
142
+
143
+ ```bash
144
+ llamafactory-cli train examples/train_qlora/llama3_lora_sft_awq.yaml
145
+ ```
146
+
147
+ #### Supervised Fine-Tuning with 2-bit AQLM Quantization
148
+
149
+ ```bash
150
+ llamafactory-cli train examples/train_qlora/llama3_lora_sft_aqlm.yaml
151
+ ```
152
+
153
+ ### Full-Parameter Fine-Tuning
154
+
155
+ #### Supervised Fine-Tuning on Single Node
156
+
157
+ ```bash
158
+ FORCE_TORCHRUN=1 llamafactory-cli train examples/train_full/llama3_full_sft.yaml
159
+ ```
160
+
161
+ #### Supervised Fine-Tuning on Multiple Nodes
162
+
163
+ ```bash
164
+ FORCE_TORCHRUN=1 NNODES=2 NODE_RANK=0 MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_full/llama3_full_sft.yaml
165
+ FORCE_TORCHRUN=1 NNODES=2 NODE_RANK=1 MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_full/llama3_full_sft.yaml
166
+ ```
167
+
168
+ ### Elastic and Fault-Tolerant Supervised Fine-Tuning on Multiple Nodes
169
+
170
+ To launch an elastic job with `MAX_RESTARTS` failures retries, run the following on at least `MIN_NNODES` nodes and at most `MAX_NNODES` nodes. `RDZV_ID` should be set as a unique job id (shared by all nodes participating in the job). See also [torchrun](https://docs.pytorch.org/docs/stable/elastic/run.html).
171
+
172
+ ```bash
173
+ FORCE_TORCHRUN=1 MIN_NNODES=1 MAX_NNODES=3 MAX_RESTARTS=3 RDZV_ID=llamafactory MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_full/llama3_full_sft.yaml
174
+ ```
175
+
176
+ #### Multimodal Supervised Fine-Tuning
177
+
178
+ ```bash
179
+ FORCE_TORCHRUN=1 llamafactory-cli train examples/train_full/qwen2_5vl_full_sft.yaml
180
+ ```
181
+
182
+ ### Merging LoRA Adapters and Quantization
183
+
184
+ #### Merge LoRA Adapters
185
+
186
+ Note: DO NOT use quantized model or `quantization_bit` when merging LoRA adapters.
187
+
188
+ ```bash
189
+ llamafactory-cli export examples/merge_lora/llama3_lora_sft.yaml
190
+ ```
191
+
192
+ #### Quantizing Model using AutoGPTQ
193
+
194
+ ```bash
195
+ llamafactory-cli export examples/merge_lora/llama3_gptq.yaml
196
+ ```
197
+
198
+ ### Save Ollama modelfile
199
+
200
+ ```bash
201
+ llamafactory-cli export examples/merge_lora/llama3_full_sft.yaml
202
+ ```
203
+
204
+ ### Inferring LoRA Fine-Tuned Models
205
+
206
+ #### Evaluation using vLLM's Multi-GPU Inference
207
+
208
+ ```
209
+ python scripts/vllm_infer.py --model_name_or_path meta-llama/Meta-Llama-3-8B-Instruct --template llama3 --dataset alpaca_en_demo
210
+ python scripts/eval_bleu_rouge.py generated_predictions.jsonl
211
+ ```
212
+
213
+ #### Use CLI ChatBox
214
+
215
+ ```bash
216
+ llamafactory-cli chat examples/inference/llama3_lora_sft.yaml
217
+ ```
218
+
219
+ #### Use Web UI ChatBox
220
+
221
+ ```bash
222
+ llamafactory-cli webchat examples/inference/llama3_lora_sft.yaml
223
+ ```
224
+
225
+ #### Launch OpenAI-style API
226
+
227
+ ```bash
228
+ llamafactory-cli api examples/inference/llama3_lora_sft.yaml
229
+ ```
230
+
231
+ ### Extras
232
+
233
+ #### Full-Parameter Fine-Tuning using GaLore
234
+
235
+ ```bash
236
+ llamafactory-cli train examples/extras/galore/llama3_full_sft.yaml
237
+ ```
238
+
239
+ #### Full-Parameter Fine-Tuning using APOLLO
240
+
241
+ ```bash
242
+ llamafactory-cli train examples/extras/apollo/llama3_full_sft.yaml
243
+ ```
244
+
245
+ #### Full-Parameter Fine-Tuning using BAdam
246
+
247
+ ```bash
248
+ llamafactory-cli train examples/extras/badam/llama3_full_sft.yaml
249
+ ```
250
+
251
+ #### Full-Parameter Fine-Tuning using Adam-mini
252
+
253
+ ```bash
254
+ llamafactory-cli train examples/extras/adam_mini/qwen2_full_sft.yaml
255
+ ```
256
+
257
+ #### Full-Parameter Fine-Tuning using Muon
258
+
259
+ ```bash
260
+ llamafactory-cli train examples/extras/muon/qwen2_full_sft.yaml
261
+ ```
262
+
263
+ #### LoRA+ Fine-Tuning
264
+
265
+ ```bash
266
+ llamafactory-cli train examples/extras/loraplus/llama3_lora_sft.yaml
267
+ ```
268
+
269
+ #### PiSSA Fine-Tuning
270
+
271
+ ```bash
272
+ llamafactory-cli train examples/extras/pissa/llama3_lora_sft.yaml
273
+ ```
274
+
275
+ #### Mixture-of-Depths Fine-Tuning
276
+
277
+ ```bash
278
+ llamafactory-cli train examples/extras/mod/llama3_full_sft.yaml
279
+ ```
280
+
281
+ #### LLaMA-Pro Fine-Tuning
282
+
283
+ ```bash
284
+ bash examples/extras/llama_pro/expand.sh
285
+ llamafactory-cli train examples/extras/llama_pro/llama3_freeze_sft.yaml
286
+ ```
287
+
288
+ #### FSDP+QLoRA Fine-Tuning
289
+
290
+ ```bash
291
+ bash examples/extras/fsdp_qlora/train.sh
292
+ ```
293
+
294
+ #### OFT Fine-Tuning
295
+
296
+ ```bash
297
+ llamafactory-cli train examples/extras/oft/llama3_oft_sft.yaml
298
+ ```
299
+
300
+ #### QOFT Fine-Tuning
301
+
302
+ ```bash
303
+ llamafactory-cli train examples/extras/qoft/llama3_oft_sft_bnb_npu.yaml
304
+ ```