https://github.com/ymcui/Chinese-LLaMA-Alpaca/wiki/%E4%BD%BF%E7%94%A8Transformers%E6%8E%A8%E7%90%86
我们提供了命令行和Web图形界面两种方式使用原生Transformers进行推理。
以加载Chinese-Alpaca-7B模型为例(加载Chinese-Alpaca-Plus的方式见下面的加载Chinese-Alpaca-Plus)说明启动方式。
python scripts/inference_hf.py \ --base_model path_to_original_llama_hf_dir \ --lora_model path_to_chinese_llama_or_alpaca_lora \ --with_prompt \ --interactive
如果之前已执行了merge_llama_with_chinese_lora_to_hf.py脚本将lora权重合并,那么无需再指定--lora_model,启动方式更简单:
merge_llama_with_chinese_lora_to_hf.py
--lora_model
python scripts/inference_hf.py \ --base_model path_to_merged_llama_or_alpaca_hf_dir \ --with_prompt \ --interactive
参数说明:
--base_model {base_model}
--lora_model {lora_model}
--base_model
--tokenizer_path {tokenizer_path}
--with_prompt
--interactive
--data_file {file_name}
file_name
--predictions_file {file_name}
--use_cpu
--gpus {gpu_ids}
0,1,2
该方式将启动Web前端页面进行交互,并且支持多轮对话。除transformers之外,需要安装gradio和mdtex2html:
pip install gradio pip install mdtex2html
启动命令如下:
python scripts/gradio_demo.py \ --base_model path_to_original_llama_hf_dir \ --lora_model path_to_chinese_alpaca_lora
同样,如果已经执行了merge_llama_with_chinese_lora_to_hf.py脚本将lora权重合并,那么无需再指定--lora_model:
python scripts/gradio_demo.py --base_model path_to_merged_alpaca_hf_dir
目前两个脚本都不支持直接从LoRA权重加载Chinese-Alpaca-Plus进行推理;如要进行Chinese-Alpaca-Plus进的推理,请先合并模型,流程如下:
python scripts/merge_llama_with_chinese_lora.py \ --base_model path_to_hf_llama \ --lora_model path_to_chinese_llama_plus_lora,path_to_chinese_alpaca_plus_lora \ --output_type huggingface \ --output_dir path_to_merged_chinese_alpaca_plus
python scripts/inference_hf.py \ --base_model path_to_merged_chinese_alpaca_plus \ --with_prompt --interactive
今日报告-66
设置Windows10暂停更新3000天
AQS公平锁的流程
AMD锐龙7 7800X3D网游专项测试:竟比i9-13900KS强了15%
常用总线技术基本参数对比
探索图像数据中的隐藏信息:语义实体识别和关系抽取的奇妙之旅
设置Chrome浏览器自动升级
JavaScript – 小技巧 Tips
Winform无边框窗体实现拖动
STM32基础(一)
技术人的修炼---九五小庞
vue自定义事件用法及$emit
ODOO 科目配置4
sqlite 触发器 c#
postgresql在插入数据后怎么获取自增id
EF Core 的基本使用
error: failed to push some refs to 'https://github.com/*******/********.github.io.git'
欧拉降幂
编程语言能力对比
基于机器视觉的小车轨迹控制软件界面展示
yolo --- 核心思想
【游记】CCPC 济南 2024 游记
AJAX & AXIOS-2024/11/1
验证码处理在自动化测试中的应用
一些学科笑话
NOIP2024模拟赛20 & 11.1 小记
20241101 数据结构与算法期中机试收获
Java,启动!
什么是IT技术
即将到来!
2024/11/1日 日志 关于JavaScript简介&引入方式 以及基础语法的学习
舍得-时间-工作是人的一生最重要的事情-自己要有私房钱-人的一生最重要的事情是书写自己的人生
2.TiUP 部署 DM 集群
原型模式的C++实现
python bytecode解析
09-XSS键盘监听、cookie窃取&文件上传绕过
ubuntu 24.04 部署 mysql 8.4.3 LTS
国标GB28181公网平台LiteGBS国标GB28181视频平台建筑工地无线视频联网监控系统方案
imes完工下线
android 13 更改手机信号调整
Ethernaut Level 11: Elevator Attack and Blockchain Interaction
快速部署开源spug运维平台的Docker安装指南
驱动调试之printk的原理与使用
计算机思维模型及其应用
华为云发布代码大模型PanGu-Coder2,实现高效代码生成
Linux多硬盘数据存储和分区操作
构建高可用架构: 分层冗余与自动故障转移
LoRA:高效调参的大语言模型适应方法
《分布式系统的基本原理及互联网分层架构的本质》
Hadoop写流程解析
Java架构师的系统架构设计方法论中的规范要点
使用observeDOM解决BetterScroll插件在移动端无法滑动的问题
互联网一致性架构设计实践
高并发系统架构与水平扩展
混合应用的崛起:跨平台开发取代原生应用