Training procedure
Framework versions
- SWIFT 1.5.1
Base model information
队名:西安交通大学-心在飞翔队 使用模型:qwen-1.8b 数据库:京东情感分类数据库 实验环境:notebook 模型效果: 对情感进行简单的二分类,分为积极和消极两种情绪,根据用户输入的语句判断其内含的情感 示例代码:
使用swift框架
import os os.environ['CUDAVISIBLEDEVICES'] = '0' import torch from swift.llm import ( DatasetName, InferArguments, ModelType, SftArguments, infermain, sftmain, appuimain, mergeloramain )
选择1.8B模型
modeltype = ModelType.qwen18b sftargs = SftArguments( modeltype=modeltype,
使用lora方法
sfttype='lora', traindataset_sample=2000,
调用京东的评论数据集
dataset=[DatasetName.jdsentimentzh], outputdir='output') result = sftmain(sft_args)
adapter的⼤⼩: 6.1MiB
bestmodelcheckpoint = result['bestmodelcheckpoint'] print(f'bestmodelcheckpoint: {bestmodelcheckpoint}') torch.cuda.emptycache() inferargs = InferArguments( ckptdir=bestmodelcheckpoint, loaddatasetconfig=True, dosample=False) result = infermain(inferargs)
- BaseModel Class QWenLMHeadModel
评论