1source /opt/anaconda3/etc/profile.d/conda.sh
2conda activate dl
数据增强: Resize(224) → RandomCrop(224, padding=28) → RandomHorizontalFlip
标准化: CIFAR10 mean/std
优化器: AdamW (lr=1e-4, weight_decay=0.05)
学习率调度: CosineAnnealingLR
损失函数: CrossEntropyLoss
训练轮次: 10 epochs
Batch Size: 16 (ViT) / 32 (ResNet)
1# ViT 预训练模型训练
2python train_vit_pretrained.py
3
4# ResNet-18 预训练模型训练
5python train_resnet.py
1hf auth login
2hf upload Noflowerzzk/Dl_homework . . --repo-type model --exclude ".git/*" --exclude "raw_upload/*"
dl/
├── guide.md # 任务说明
├── README.md # 本文件
├── train_vit_pretrained.py # ViT训练脚本
├── train_resnet.py # ResNet训练脚本
├── eval_vit.py # ViT评估脚本
├── models/
│ ├── model.safetensors
│ ├── best_vit_pretrained.pth
│ ├── best_vit_base_patch16_224.pth
│ └── best_resnet18_pretrained.pth
└── data/
└── cifar-10-python.tar.gz