import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) from utils.dataset_utils import get_cifar10_dataloaders from utils.train_utils import train_model from model import VGG def main(): # 获取数据加载器 trainloader, testloader = get_cifar10_dataloaders(batch_size=128) # 创建模型 cfg = { 'VGG16': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M'] } model = VGG('VGG16') # 训练模型 train_model( model=model, trainloader=trainloader, testloader=testloader, epochs=200, lr=0.1, device='cuda', save_dir='../model', model_name='vgg16' ) if __name__ == '__main__': main()