This commit is contained in:
chenzh 2023-04-21 18:18:26 +08:00
parent c98fe54e16
commit 6270e7eebf
7 changed files with 74 additions and 0 deletions

8
.idea/.gitignore vendored Normal file
View File

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

12
.idea/MNIST_Example.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/MNIST_Example.iml" filepath="$PROJECT_DIR$/.idea/MNIST_Example.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

30
obs.py Normal file
View File

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