在有网的机器上:
git clone https://github.com/apple/corenet.git
cd corenet将整个目录拷贝到离线机器。
OpenELM 训练基于 CoreNet 框架。
pip download -r requirements.txt -d ./wheelswheels 到离线机器:pip install --no-index --find-links=./wheels -r requirements.txttokenizer.json{"text": "这是一条训练样本"}以 微调 OpenELM-270M 为例:
openelm_270m_offline.yamlmodel:
name: openelm
variant: 270M
dataset:
train:
root: ./data/train.jsonl
name: jsonl_text
tokenizer:
path: ./tokenizer.json
training:
batch_size: 8
num_workers: 4
max_steps: 10000
learning_rate: 3e-4
distributed:
backend: ncclpython train.py --cfg openelm_270m_offline.yamltorchrun --nproc_per_node=4 train.py --cfg openelm_270m_offline.yaml所有数据、模型、依赖均在本地,无需访问 HuggingFace 或 Apple 服务器。
lora:
rank: 8
alpha: 16checkpoint:
load: ./checkpoints/openelm_270m.pttokenizer.jsondownload 相关配置logging: file 而非 TensorBoard 远程代码(corenet) + 依赖(wheels) + 模型配置 + 本地数据 + 本地分词器
↓
修改 YAML(不联网)
↓
torchrun 启动训练如果你愿意,我可以: