Browse Source

Merge pull request 'update model_name' (#12) from liuzx into master

Reviewed-on: https://openi.pcl.ac.cn/OpenIOSSG/OpenI_Cloudbrain_Example/pulls/12
liuzx-patch-2
liuzx 1 year ago
parent
commit
7e355f730b
8 changed files with 15 additions and 15 deletions
  1. +1
    -1
      gcu_mnist_example/README.md
  2. +3
    -3
      gcu_mnist_example/train.py
  3. +1
    -1
      gpgpu_mnist_example/README.md
  4. +2
    -2
      gpgpu_mnist_example/inference.py
  5. +3
    -3
      gpgpu_mnist_example/train.py
  6. +1
    -1
      gpu_mnist_example/README.md
  7. +1
    -1
      gpu_mnist_example/inference.py
  8. +3
    -3
      gpu_mnist_example/train.py

+ 1
- 1
gcu_mnist_example/README.md View File

@@ -23,7 +23,7 @@ Torch_MNIST_Example_Model模型可从本项目的模型目录中引用,[预训
* Torch_MNIST_Example_Model模型的目录结构如下:

> Torch_MNIST_Example_Model
> ├── mnist_epoch1_0.76.pkl
> ├── mnist_epoch1.pkl
>

## 二. 如何在云脑上获取代码路径,数据集路径,预训练模型路径,输出路径


+ 3
- 3
gcu_mnist_example/train.py View File

@@ -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']


+ 1
- 1
gpgpu_mnist_example/README.md View File

@@ -23,7 +23,7 @@ Torch_MNIST_Example_Model模型可从本项目的模型目录中引用,[预训
* Torch_MNIST_Example_Model模型的目录结构如下:

> Torch_MNIST_Example_Model
> ├── mnist_epoch1_0.76.pkl
> ├── mnist_epoch1.pkl
>

## 二. 如何在云脑上获取代码路径,数据集路径,预训练模型路径,输出路径


+ 2
- 2
gpgpu_mnist_example/inference.py View File

@@ -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
@@ -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()

+ 3
- 3
gpgpu_mnist_example/train.py View File

@@ -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']


+ 1
- 1
gpu_mnist_example/README.md View File

@@ -23,7 +23,7 @@ Torch_MNIST_Example_Model模型可从本项目的模型目录中引用,[预训
* Torch_MNIST_Example_Model模型的目录结构如下:

> Torch_MNIST_Example_Model
> ├── mnist_epoch1_0.76.pkl
> ├── mnist_epoch1.pkl
>

## 二. 如何在云脑上获取代码路径,数据集路径,预训练模型路径,输出路径


+ 1
- 1
gpu_mnist_example/inference.py View File

@@ -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


+ 3
- 3
gpu_mnist_example/train.py View File

@@ -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']


Loading…
Cancel
Save