codeassistant

我要开发同款
匿名用户2024年07月31日
58阅读

技术信息

开源地址
https://modelscope.cn/models/hzk666/codeassistant
授权协议
Apache License 2.0

作品详情

模型简介

模型的名字为甲辰代码助手,模型具有自我认知,其作者为甲辰队。

模型可以根据要求给出正确的示例代码。

实验环境

采用魔搭社区Notebook开发,环境为ubutu22.04-cuda12.1.0-py310-torch2.1.2-tf2.14.0-1.11.0
gradio版本为3.50.1

训练方法

数据集为code-alpaca-e、codefuse-pytho-e
微调的模型为qwe-7b-chat
超参数
-  system 你是一个代码助手,可以根据用户的要求输出对应的代码。
-  trai_dataset_sample 3000
-  save_steps 500
-  lora_target_modules ALL
-  learig_rate 1e-5
-  gradiet_accumulatio_steps 1
-  eval_batch_size 1
-  self_cogitio_sample 500
-  model_ame 甲辰代码助手
-  model_author 甲辰队

示例代码

1.安装swift及gradio

pip istall ms-swift -U
pip istall gradio==3.50.1

2.启动web-ui

swift web-ui

3.设置好参数启动训练,训练命令如下

pytho /opt/coda/lib/pytho3.10/site-packages/swift/cli/sft.py --model_id_or_path qwe/Qwe-7B-Chat --template_type qwe --system 你是一个代码助手,可以根据用户的要求输出对应的代码。 --dataset code-alpaca-e codefuse-pytho-e --trai_dataset_sample 3000 --save_steps 500 --lora_target_modules ALL --learig_rate 1e-5 --gradiet_accumulatio_steps 1 --eval_batch_size 1 --self_cogitio_sample 500 --model_ame 甲辰代码助手 --model_author 甲辰队 --add_output_dir_suffix False --output_dir /mt/workspace/output/qwe-7b-chat/v0-20240124-134958 --loggig_dir /mt/workspace/output/qwe-7b-chat/v0-20240124-134958/rus

4.训练好后用web-ui进行推理,推理效果如下

image.pg image.pg

5.使用命令行进行推理,命令如下

CUDA_VISIBLE_DEVICES=0 \
swift ifer \
    --ckpt_dir "output/qwe-7b-chat/v0-20240124-134958/checkpoit-3000" \
    --load_dataset_cofig true \
    --max_legth 2048 \
    --max_ew_tokes 2048 \
    --temperature 0.7 \
    --top_p 0.7 \
    --repetitio_pealty 1. \
    --do_sample true \
    --merge_lora_ad_save false \

效果如下

image.pg

6.编写代码将模型上传,代码如下

from modelscope.hub.api import HubApi
YOUR_ACCESS_TOKEN = '访问令牌'
api = HubApi()
api.logi(YOUR_ACCESS_TOKEN)
api.push_model(
    model_id="xxxxxxxx",
    model_dir="xxxxxx/checkpoit-xxxx"
)

功能介绍

模型简介 模型的名字为甲辰代码助手,模型具有自我认知,其作者为甲辰队。 模型可以根据要求给出正确的示例代码。 实验环境 采用魔搭社区Notebook开发,环境为ubuntu22.04-cuda12

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论