模型介绍
中文整理介绍
本项目使用 SWIFT (Scalable lightWeight Infrastructure for Fine-Tuning) 微调框架,选择采用LoRA微调方法,对 通义千问1.8B 基础模型进行微调,以实现对句子的情感分类任务。
项目来源: 2024年1月《阿里魔搭社区 AI大模型技术与应用实战训练营》(西安交通大学) 大作业一
戴锦程
实验环境
modelscope平台免费实例-GPU环境(8核 32GB 显存24G (A10显卡);预装 ModelScope Library; 预装镜像 Ubuntu22.04 cuda12.1.0 python3.10 pytorch2.1.2 tensorflow2.14.0)
需手动安装微调框架库 swift 以及所需的其他第三方库,可以通过下方代码进行环境准备:
git clone https://github.com/modelscope/swift.git
cd swift
pip install -e .[llm]
训练方法
数据集
京东商品评论情感分析数据集 (jd sentiment zh)
微调的基础模型
通义千问1.8B (qwen 1 8b)
微调方法
LoRA
其他超参数
示例代码
推理效果
[PROMPT]Task: Sentiment Classification
Sentence: 擦玻璃很好、就是太小了
Category: negative, positive
Output:
[OUTPUT]positive positive negative
[LABELS]positive
[PROMPT]Task: Sentiment Classification
Sentence: 店家太不负责任了,衣服质量太差劲了,和图片上的不一样
Category: negative, positive
Output:
[OUTPUT]negative negative negative negative
[LABELS]negative
[PROMPT]Task: Sentiment Classification
Sentence: 送国际友人挺好的,不错不错!
Category: negative, positive
Output:
[OUTPUT]positive
positive
positive
[LABELS]positive
[PROMPT]Task: Sentiment Classification
Sentence: 很好,装好一定很漂亮
Category: negative, positive
Output:
[OUTPUT]positive
positive
positive
[LABELS]positive
[PROMPT]Task: Sentiment Classification
Sentence: 东西给你退回去了,你要黑我钱!!!
Category: negative, positive
Output:
[OUTPUT]negative
negative negative negative
[LABELS]negative
[PROMPT]Task: Sentiment Classification
Sentence: 送货很快,书是正品,买书一直京东是首选!
Category: negative, positive
Output:
[OUTPUT]positive
positive
negative
[LABELS]positive
[PROMPT]Task: Sentiment Classification
Sentence: 口感相当的好 都想买第二次了
Category: negative, positive
Output:
[OUTPUT]positive
positive
positive
[LABELS]positive
[PROMPT]Task: Sentiment Classification
Sentence: 硅胶味道太重,样子与图片差距太大
Category: negative, positive
Output:
[OUTPUT]negative
negative negative negative
[LABELS]negative
[PROMPT]Task: Sentiment Classification
Sentence: 很伤心,买了放到三星n4尽然不能用,客服各种推
Category: negative, positive
Output:
[OUTPUT]negative
negative negative negative
[LABELS]negative
[PROMPT]Task: Sentiment Classification
Sentence: 质量不错,大小合适,应当是正品!但是我买的是黑灰,发来的却是纯黑,懒得换了,给个差评,希望以后改进!
Category: negative, positive
Output:
[OUTPUT]positive
negative negative negative
[LABELS]negative
优先采用原作者提供的中文模型卡片;仅有英文说明时由闲社AI翻译整理。重要参数、许可证和商用范围请以原文为准。
你将获得什么
完整仓库方式包含该固定版本中的权重、配置、分词器及说明文件;指定版本方式只下载所选文件或整组分片。多模态模型的投影文件、配置等依赖,请按作者说明配齐。
完整仓库可能包含多个权重格式,因此需要的磁盘空间可能大于单一格式的模型大小。下载文件不等于完成模型部署。
使用前须知
运行模型需要的设备、工具与依赖,以原作者说明为准。
是否允许商用、修改和分发,请查看模型许可证。
闲社提供资料与镜像下载方法,不代表已运行模型或完成安全审计。下载的代码应先检查,再执行。
Problem with the information or download?
Sign in to submit feedback.
