一、关卡任务
二、 实验
2.1 模型下载
这里使用的是Github 的 线上代码平台 codespace
https://github.com/codespaces
使用 jupyter notebook的模版创建环境
然后安装相关依赖
# 安装transformers
pip install transformers==4.38
pip install sentencepiece==0.1.99
pip install einops==0.8.0
pip install protobuf==5.27.2
pip install accelerate==0.33.0
下载internlm2_5-7b-chat的配置文件
import os
from huggingface_hub import hf_hub_download
# 指定模型标识符
repo_id = "internlm/internlm2_5-7b"
# 指定要下载的文件列表
files_to_download = [
{
"filename": "config.json"},
{
"filename": "model.safetensors.index.json"}
]
# 创建一个目录来存放下载的文件
local_dir = f"