lora-finetune

Lora fine-tuning script based on llama-factory.

https://github.com/rickeyhhh/lora-finetune

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (3.1%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

Lora fine-tuning script based on llama-factory.

Basic Info
  • Host: GitHub
  • Owner: rickeyhhh
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 4.16 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Code of conduct Citation Security

README.md

  1. 创建虚拟环境
  2. conda create --name env_name python=3.9创建新的虚拟环境
  3. conda activate env_name进入虚拟环境
  4. pip install -r requirements.txt下载所需库
  5. pytorh版本最低为1.13.1,实际需要跟gpu的cuda版本对齐。

  6. 制作微调数据

  7. 收集微调所需数据后,需要将数据格式修改为alpaca格式,详细格式样例见lora-finetune/data/alpacaendemo.json

  8. 在projects/lora-finetune/data/dataset_info.json中注册微调数据

  9. 下载微调模型

  10. 将需要微调的模型下载在lora-finetune中

  11. lora微调

  12. 修改lora-finetune/examples/trainlora/llama3lorasft.yaml文件:"modelnameorpath:"为模型文件夹路径;"dataset:"为数据集名称,"datasetdir:"为数据集路径;"outputdir:"为微调权重输出路径,其他超参数根据需求调整

  13. 在终端输入llamafactory-cli train examples/trainlora/llama3lora_sft.yaml开始lora微调

  14. 需要其他微调方式可以修改并运行projects/lora-finetune/examples/train_lora中其他的yaml文件

  15. 权重融合

  16. 修改lora-finetune/examples/mergelora/llama3lorasft.yaml文件:"modelnameorpath:"原始模型路径,"adapternameorpath:"微调生成新权重的路径,"exportdir:"融合后的输出路径

  17. 运行llamafactory-cli export examples/mergelora/llama3lora_sft.yaml开始模型融合

  18. api部署

  19. pip安装vllm库,修改lora-finetune/examples/inference/llama3vllm.yaml文件:"modelnameorpath:"为部署的模型文件夹路径

  20. 按照注释修改超参数,运行test_vllm.py测试部署情况

Owner

  • Login: rickeyhhh
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
date-released: 2024-03
message: "If you use this software, please cite it as below."
authors:
- family-names: "Zheng"
  given-names: "Yaowei"
- family-names: "Zhang"
  given-names: "Richong"
- family-names: "Zhang"
  given-names: "Junhao"
- family-names: "Ye"
  given-names: "Yanhan"
- family-names: "Luo"
  given-names: "Zheyan"
- family-names: "Feng"
  given-names: "Zhangchi"
- family-names: "Ma"
  given-names: "Yongqiang"
title: "LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models"
url: "https://arxiv.org/abs/2403.13372"
preferred-citation:
  type: conference-paper
  conference:
    name: "Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations)"
  authors:
    - family-names: "Zheng"
      given-names: "Yaowei"
    - family-names: "Zhang"
      given-names: "Richong"
    - family-names: "Zhang"
      given-names: "Junhao"
    - family-names: "Ye"
      given-names: "Yanhan"
    - family-names: "Luo"
      given-names: "Zheyan"
    - family-names: "Feng"
      given-names: "Zhangchi"
    - family-names: "Ma"
      given-names: "Yongqiang"
  title: "LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Models"
  url: "https://arxiv.org/abs/2403.13372"
  year: 2024
  publisher: "Association for Computational Linguistics"
  address: "Bangkok, Thailand"

GitHub Events

Total
  • Push event: 5
  • Pull request event: 2
  • Fork event: 1
  • Create event: 2
Last Year
  • Push event: 5
  • Pull request event: 2
  • Fork event: 1
  • Create event: 2

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 21 hours
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 21 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • wtrvegeword (2)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/label_issue.yml actions
.github/workflows/publish.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
pyproject.toml pypi
requirements.txt pypi
  • accelerate >=0.34.0,<=1.2.1
  • av *
  • datasets >=2.16.0,<=3.2.0
  • einops *
  • fastapi *
  • fire *
  • gradio >=4.38.0,<=5.18.0
  • librosa *
  • matplotlib >=3.7.0
  • numpy <2.0.0
  • packaging *
  • pandas >=2.0.0
  • peft >=0.11.1,<=0.12.0
  • protobuf *
  • pydantic *
  • pyyaml *
  • scipy *
  • sentencepiece *
  • sse-starlette *
  • tiktoken *
  • tokenizers >=0.19.0,<=0.21.0
  • transformers >=4.41.2,<=4.49.0,
  • trl >=0.8.6,<=0.9.6
  • tyro <0.9.0
  • uvicorn *
setup.py pypi