0325学习笔记

复现cvt2distilgpt2过程

一、切换目录并clone代码:cd /lishnai28/lcs/lcs/

git clone https://github.com/aehrc/cvt2distilgpt2.git

cd cvt2distilgpt2

二、创建虚拟环境并激活:

conda create -n cvt2 python=3.8 -y

conda activate cvt2

三、具体操作:

1,更新pip包管理器:pip install --upgrade pip

(虚拟环境中python -m pip install --upgrade pip和pip install --upgrade pip的行为一致。若当前存在多个python版本和虚拟环境,使用python -m 可以显式指定使用当前激活的python解释器,更安全)

2,安装依赖:pip install --upgrade -r requirements.txt --no-cache-dir

3,权重文件准备

两个模型检查点下载并上传(下载地址------https://doi.org/10.25919/ng3g-aj81)

chexbert.pth从源目录复制:cp /lishnai28/lcs/lcs/CheXbert/src/chexbert.pth /lishnai28/lcs/lcs/cvt2distilgpt2/checkpoints/stanford/chexbert/

4,数据集选择直接切换目录不再重复粘贴

mimic-cxr-jpg:/lishnai28/lcs/lcs/mimic_cxr/images/

mimic-cxr标签(对应的annotations.json):/lishnai28/lcs/lcs/mimic_cxr/annotation.json

iu_xray images:/lishnai28/lcs/lcs/iu_xray/images/

iu_xray annotations:/lishnai28/lcs/lcs/iu_xray/annotation.json

5,运行测试

dlhpcstarter -t iu_x_ray_chen -c config/test_iu_x_ray_chen_cvt2distilgpt2.yaml --stages_module stages --test

dlhpcstarter -t mimic_cxr_chen -c config/test_mimic_cxr_chen_cvt2distilgpt2.yaml --stages_module stages --test

解决报错:

1,下载CvT-21 检查点"/lishnai28/lcs/lcs/cvt2distilgpt2/checkpoints/microsoft/CvT/CvT-21-384x384-IN-22k.pth"(https://github.com/microsoft/CvT)

DistilGPT2 检查点"/lishnai28/lcs/lcs/cvt2distilgpt2/checkpoints/distilgpt2/"(https://huggingface.co/distilbert/distilgpt2)

测试指标复现成功√、下边是对应修改后的代码文件

6,模型训练

dlhpcstarter -t iu_x_ray_chen -c config/train_iu_x_ray_chen_cvt2distilgpt2.yaml --stages_module stages --train --test

dlhpcstarter -t mimic_cxr -c config/train_mimic_cxr_chen_cvt2distilgpt2.yaml --stages_module stages --train --test

git-lfs在Linux 下正确的安装与初始化命令(pip不管用):

++# 1. 安装 git-lfs
conda install -c conda-forge git-lfs++

++# 2. 初始化 git-lfs (这会在你的 ~/.gitconfig 中写入必要的全局配置)
git lfs install++

相关推荐
H H.24 分钟前
Java笔记:String字符串
java·开发语言·经验分享·笔记·其他
sharemylove1 小时前
Java 异常处理 学习笔记
java·开发语言·经验分享·笔记·学习
sharemylove3 小时前
Java 常用类 学习笔记
java·开发语言·经验分享·笔记·学习
云半S一13 小时前
Agent学习总结补充:2
人工智能·经验分享·笔记·agent·学习分享
小飞在努力15 小时前
【实现负载均匀在线判题③】从零散模块到统一,编译运行全链路封装
c语言·开发语言·c++·笔记
山川而川-R17 小时前
RK3588边缘计算:YOLOv8 使用Android NDK部署_笔记1
人工智能·笔记·yolo·安卓
饮水桶_T19 小时前
C++ stack & queue复习笔记
开发语言·笔记·算法
叼烟扛炮21 小时前
[LangChain] 学习笔记(026):模型根本没有记忆——「多轮对话」是你每次把历史重发一遍
笔记·学习·langchain
饮水桶_T1 天前
HashMap笔记
开发语言·数据结构·笔记
星恒随风1 天前
从0实现C++ AI大模型接入SDK(三):环境搭建与ChatSDK快速上手——实现我们的第一个AI聊天程序
linux·开发语言·c++·人工智能·笔记