毕设学习进展周报

文章目录

3.11-3.18

1.阅读ACL文献并记录

2.查找相关资料学习在阿里云部署ChatGLM3-6B

参考:https://blog.csdn.net/H66778899/article/details/135630030

python 复制代码
#  运行
streamlit run /mnt/workspace/ChatGLM3/conposite_demo/main.py

可以得到:

3.学习如何微调

首先需对下载的医疗公开数据集进行处理,选择处理的是内科数据集,大概三万多条数据。

用作处理的代码如下,使用智普AI写的:

python 复制代码
import pandas as pd
import json

# 1. 读取CSV文件
import chardet

with open('internal.csv', 'rb') as f:
    result = chardet.detect(f.read())

print(result)  # 输出检测结果,包括编码和置信度

df = pd.read_csv('internal.csv', encoding=result['encoding'])



# 2. 数据预处理
# 这里可以根据需要对数据进行清洗和处
df.drop_duplicates(inplace=True)
df.fillna(method='ffill', inplace=True)

# 3. 格式转换
# 假设您的CSV文件中有两列:"Question" 和 "Answer",您想用它们来训练模型
# 请根据您的实际数据结构调整下面的代码
data_for_chatglm = []
for index, row in df.iterrows():
    data_for_chatglm.append({
        "instruction": row['title'],
        "output": row['answer']
        # 如果需要的话,可以添加更多键值对
    })

# 4. 保存为JSON格式
with open('medical.json', 'w', encoding='utf-8') as f:
    json.dump(data_for_chatglm, f, ensure_ascii=False, indent=4)

数据集的问答存在的问题为:有些回答包含无意义内容,有些回答的语句不通顺,先作为保留问题,等跑通了再做处理

官方微调文档:https://github.com/THUDM/ChatGLM3/blob/main/finetune_demo/README.md

使用阿里云DSW微调ChatGLM3-6B:https://blog.csdn.net/a131529/article/details/134895649

相关推荐
shizidushu6 小时前
Hugging Face NLP课程学习记录 - 3. 微调一个预训练模型
人工智能·学习·自然语言处理·微调·huggingface
番薯大佬8 小时前
Python学习-day9 字典Dictionary
网络·python·学习
..过云雨9 小时前
04.【Linux系统编程】基础开发工具2(makefile、进度条程序实现、版本控制器Git、调试器gdb/cgdb的使用)
linux·笔记·学习
理想国的女研究僧9 小时前
Jupyter Notebook操作指南(1)
ide·python·学习·jupyter
GilgameshJSS10 小时前
【学习K230-例程19】GT6700-TCP-Client
网络·python·网络协议·学习·tcp/ip
悠悠~飘10 小时前
php学习(第五天)
学习·php
能不能别报错10 小时前
K8s学习笔记(二):Pod
笔记·学习·kubernetes
呱呱巨基11 小时前
C/C++ 内存管理
c++·笔记·学习
楼田莉子12 小时前
python小项目——学生管理系统
开发语言·python·学习