LLaMA-Factory实战推理

LLaMA-Factory官网:https://github.com/hiyouga/LLaMA-Factory

安装环境

python 复制代码
git clone https://github.com/hiyouga/LLaMA-Factory.git
cd LLaMA-Factory/
conda create -n py310 python=3.10
conda activate py310

按照llama-factory要求的标准格式组织数据集,保存成一个文件,比如下面这种.json文件:

python 复制代码
[
  {
    "instruction": "user instruction (required)",
    "input": "user input (optional)",
    "output": "model response (required)",
    "system": "system prompt (optional)",
    "history": [
      ["user instruction in the first round (optional)", "model response in the first round (optional)"],
      ["user instruction in the second round (optional)", "model response in the second round (optional)"]
    ]
  }
]

大模型选择:

LLaMA、Mistral、Mixtral-MoE、Qwen、Yi、Gemmha、Baichuan、ChatGLM、Phi

推理模型

python 复制代码
CUDA_VISIBLE_DEVICES=0 python cli_demo.py \--model_name_or_path path_to_llama_model \--adapter_name_or_path path_to_checkpoint \--template default \--finetuning_type lora

总结:

有效的微调已成为大型语言模型适应特定任务的必要条件之一。随着 Llama-Factory 的引入,这一全面的框架让训练更加高效,用户无需编写代码即可轻松为超过 100 个 LLMs 定制微调。

相关推荐
新加坡内哥谈技术15 分钟前
Meta计划借助AI实现广告创作全自动化
运维·人工智能·自动化
西猫雷婶44 分钟前
pytorch基本运算-导数和f-string
人工智能·pytorch·python
Johny_Zhao1 小时前
华为MAAS、阿里云PAI、亚马逊AWS SageMaker、微软Azure ML各大模型深度分析对比
linux·人工智能·ai·信息安全·云计算·系统运维
顽强卖力1 小时前
第二十八课:深度学习及pytorch简介
人工智能·pytorch·深度学习
述雾学java1 小时前
深入理解 transforms.Normalize():PyTorch 图像预处理中的关键一步
人工智能·pytorch·python
武子康1 小时前
大数据-276 Spark MLib - 基础介绍 机器学习算法 Bagging和Boosting区别 GBDT梯度提升树
大数据·人工智能·算法·机器学习·语言模型·spark-ml·boosting
要努力啊啊啊1 小时前
使用 Python + SQLAlchemy 创建知识库数据库(SQLite)—— 构建本地知识库系统的基础《一》
数据库·人工智能·python·深度学习·自然语言处理·sqlite
武子康1 小时前
大数据-277 Spark MLib - 基础介绍 机器学习算法 Gradient Boosting GBDT算法原理 高效实现
大数据·人工智能·算法·机器学习·ai·spark-ml·boosting
中杯可乐多加冰1 小时前
【解决方案-RAGFlow】RAGFlow显示Task is queued、 Microsoft Visual C++ 14.0 or greater is required.
人工智能·大模型·llm·rag·ragflow·deepseek