diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/MNIST_Example.iml b/.idea/MNIST_Example.iml new file mode 100644 index 0000000..8b8c395 --- /dev/null +++ b/.idea/MNIST_Example.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d56657a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0d4f0b9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/obs.py b/obs.py new file mode 100644 index 0000000..40d0f9e --- /dev/null +++ b/obs.py @@ -0,0 +1,30 @@ +import os +import argparse +import moxing as mox +from upload import UploadOutput +import json + +output_path = '/cache/output' +pretrain_path = '/cache/pretrain/' + +### Copy ckpt file from obs to training image### +### To operate on folders, use mox.file.copy_parallel. If copying a file. +### Please use mox.file.copy to operate the file, this operation is to operate the file +def download_model(files): + for obs_url in files: + local_file_path = pretrain_path + obs_url.split('/')[-1] + try: + mox.file.copy(obs_url, local_file_path) + print('Successfully Download {} to {}'.format(obs_url,local_file_path)) + except Exception as e: + print('moxing download {} to {} failed: '.format(obs_url, local_file_path) + str(e)) + +def upload_model(obs_output_url): + ### 将训练容器中的新输出模型 回传到启智社区 + try: + mox.file.copy_parallel(output_path, obs_output_url) + print("Successfully Upload {} to {}".format(output_path,obs_output_url)) + except Exception as e: + print('moxing upload {} to {} failed: '.format(output_path,obs_output_url) + str(e)) + +