From aea69c2f4de5f6b188d7448115a5c8d7bfeed873 Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 7 Jun 2024 17:43:54 +0800 Subject: [PATCH 1/2] update model_name --- gcu_mnist_example/README.md | 2 +- gcu_mnist_example/train.py | 6 +++--- gpgpu_mnist_example/README.md | 2 +- gpgpu_mnist_example/inference.py | 2 +- gpgpu_mnist_example/train.py | 6 +++--- gpu_mnist_example/README.md | 2 +- gpu_mnist_example/inference.py | 2 +- gpu_mnist_example/train.py | 6 +++--- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gcu_mnist_example/README.md b/gcu_mnist_example/README.md index ba17ab2..a3d81ae 100644 --- a/gcu_mnist_example/README.md +++ b/gcu_mnist_example/README.md @@ -23,7 +23,7 @@ Torch_MNIST_Example_Model模型可从本项目的模型目录中引用,[预训 * Torch_MNIST_Example_Model模型的目录结构如下: > Torch_MNIST_Example_Model - > ├── mnist_epoch1_0.76.pkl + > ├── mnist_epoch1.pkl > ## 二. 如何在云脑上获取代码路径,数据集路径,预训练模型路径,输出路径 diff --git a/gcu_mnist_example/train.py b/gcu_mnist_example/train.py index dd461bc..44766a0 100644 --- a/gcu_mnist_example/train.py +++ b/gcu_mnist_example/train.py @@ -13,7 +13,7 @@ If there are Chinese comments in the code,please add at the beginning: 预训练模型文件夹结构是: Torch_MNIST_Example_Model -├── mnist_epoch1_0.76.pkl +├── mnist_epoch1.pkl ''' @@ -88,8 +88,8 @@ if __name__ == '__main__': print('epoch_size is:{}'.format(epochs)) # 如果有保存的模型,则加载模型,并在其基础上继续训练 - if os.path.exists(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1_0.76.pkl")): - checkpoint = torch.load(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1_0.76.pkl")) + if os.path.exists(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1.pkl")): + checkpoint = torch.load(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1.pkl")) model.load_state_dict(checkpoint['model']) optimizer.load_state_dict(checkpoint['optimizer']) start_epoch = checkpoint['epoch'] diff --git a/gpgpu_mnist_example/README.md b/gpgpu_mnist_example/README.md index 33d47cb..e4fd857 100644 --- a/gpgpu_mnist_example/README.md +++ b/gpgpu_mnist_example/README.md @@ -23,7 +23,7 @@ Torch_MNIST_Example_Model模型可从本项目的模型目录中引用,[预训 * Torch_MNIST_Example_Model模型的目录结构如下: > Torch_MNIST_Example_Model - > ├── mnist_epoch1_0.76.pkl + > ├── mnist_epoch1.pkl > ## 二. 如何在云脑上获取代码路径,数据集路径,预训练模型路径,输出路径 diff --git a/gpgpu_mnist_example/inference.py b/gpgpu_mnist_example/inference.py index cb2d6c4..2790d38 100644 --- a/gpgpu_mnist_example/inference.py +++ b/gpgpu_mnist_example/inference.py @@ -13,7 +13,7 @@ If there are Chinese comments in the code,please add at the beginning: 预训练模型文件夹结构是: Torch_MNIST_Example_Model -├── mnist_epoch1_0.76.pkl +├── mnist_epoch1.pkl ''' from model import Model diff --git a/gpgpu_mnist_example/train.py b/gpgpu_mnist_example/train.py index e71eaf2..38ec708 100644 --- a/gpgpu_mnist_example/train.py +++ b/gpgpu_mnist_example/train.py @@ -12,7 +12,7 @@ If there are Chinese comments in the code,please add at the beginning: 预训练模型文件夹结构是: Torch_MNIST_Example_Model -├── mnist_epoch1_0.76.pkl +├── mnist_epoch1.pkl ''' @@ -99,8 +99,8 @@ if __name__ == '__main__': test_loader = DataLoader(test_dataset, batch_size=batch_size) #如果有保存的模型,则加载模型,并在其基础上继续训练 - if os.path.exists(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1_0.76.pkl")): - checkpoint = torch.load(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1_0.76.pkl")) + if os.path.exists(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1.pkl")): + checkpoint = torch.load(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1.pkl")) model.load_state_dict(checkpoint['model']) optimizer.load_state_dict(checkpoint['optimizer']) start_epoch = checkpoint['epoch'] diff --git a/gpu_mnist_example/README.md b/gpu_mnist_example/README.md index 579a3db..69047f8 100644 --- a/gpu_mnist_example/README.md +++ b/gpu_mnist_example/README.md @@ -23,7 +23,7 @@ Torch_MNIST_Example_Model模型可从本项目的模型目录中引用,[预训 * Torch_MNIST_Example_Model模型的目录结构如下: > Torch_MNIST_Example_Model - > ├── mnist_epoch1_0.76.pkl + > ├── mnist_epoch1.pkl > ## 二. 如何在云脑上获取代码路径,数据集路径,预训练模型路径,输出路径 diff --git a/gpu_mnist_example/inference.py b/gpu_mnist_example/inference.py index 08457d8..cd7d340 100644 --- a/gpu_mnist_example/inference.py +++ b/gpu_mnist_example/inference.py @@ -13,7 +13,7 @@ If there are Chinese comments in the code,please add at the beginning: 预训练模型文件夹结构是: Torch_MNIST_Example_Model -├── mnist_epoch1_0.76.pkl +├── mnist_epoch1.pkl ''' from model import Model diff --git a/gpu_mnist_example/train.py b/gpu_mnist_example/train.py index e71eaf2..38ec708 100644 --- a/gpu_mnist_example/train.py +++ b/gpu_mnist_example/train.py @@ -12,7 +12,7 @@ If there are Chinese comments in the code,please add at the beginning: 预训练模型文件夹结构是: Torch_MNIST_Example_Model -├── mnist_epoch1_0.76.pkl +├── mnist_epoch1.pkl ''' @@ -99,8 +99,8 @@ if __name__ == '__main__': test_loader = DataLoader(test_dataset, batch_size=batch_size) #如果有保存的模型,则加载模型,并在其基础上继续训练 - if os.path.exists(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1_0.76.pkl")): - checkpoint = torch.load(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1_0.76.pkl")) + if os.path.exists(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1.pkl")): + checkpoint = torch.load(os.path.join(Torch_MNIST_Example_Model_path, "mnist_epoch1.pkl")) model.load_state_dict(checkpoint['model']) optimizer.load_state_dict(checkpoint['optimizer']) start_epoch = checkpoint['epoch'] From fb8709cb74229438ef4ae8295d64dccf2b6dda9b Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 7 Jun 2024 17:54:12 +0800 Subject: [PATCH 2/2] update model_name --- gpgpu_mnist_example/inference.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gpgpu_mnist_example/inference.py b/gpgpu_mnist_example/inference.py index 2790d38..8aef446 100644 --- a/gpgpu_mnist_example/inference.py +++ b/gpgpu_mnist_example/inference.py @@ -83,7 +83,7 @@ if __name__ == '__main__': test_dataset = mnist.MNIST(root=MnistDataset_torch_path + "/test", train=False, transform=ToTensor(),download=False) test_loader = DataLoader(test_dataset, batch_size=batch_size) model = Model().to(device) - checkpoint = torch.load(Torch_MNIST_Example_Model_path + "/mnist_epoch1_0.73.pkl") + checkpoint = torch.load(Torch_MNIST_Example_Model_path + "/mnist_epoch1.pkl") model.load_state_dict(checkpoint['model']) test(model,test_loader,len(test_dataset),output_path) upload_output() \ No newline at end of file