You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

upload.py 597 B

1234567891011121314
  1. from mindspore.train.callback import Callback
  2. import moxing as mox
  3. class UploadOutput(Callback):
  4. def __init__(self, train_dir, obs_train_url):
  5. self.train_dir = train_dir
  6. self.obs_train_url = obs_train_url
  7. def epoch_end(self,run_context):
  8. try:
  9. mox.file.copy_parallel(self.train_dir , self.obs_train_url )
  10. print("Successfully Upload {} to {}".format(self.train_dir ,self.obs_train_url ))
  11. except Exception as e:
  12. print('moxing upload {} to {} failed: '.format(self.train_dir ,self.obs_train_url ) + str(e))
  13. return