Skip to content

Commit

Permalink
Merge pull request AUTOMATIC1111#4 from zhazhn/master
Browse files Browse the repository at this point in the history
Automatic tar latest checkpoints and upload to s3
  • Loading branch information
xieyongliang committed Mar 22, 2023
2 parents fc757bb + ad48c63 commit fa0bfc9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions webui.py
Expand Up @@ -732,6 +732,18 @@ def train():
f'{db_models_s3uri}{db_model_name}',
os.path.join(db_model_dir, db_model_name)
)
#automatic tar latest checkpoint and upload to s3 by zheng on 2023.03.22
os.makedirs(os.path.dirname("/opt/ml/model/"), exist_ok=True)
train_steps=int(db_config.revision)
f1=os.path.join(sd_models_path, f'{sd_models_path}/{db_model_name}_{train_steps}.yaml')
if os.path.exists(f1):
shutil.copy(f1,"/opt/ml/model/")
f2=os.path.join(sd_models_path, f'{sd_models_path}/{db_model_name}_{train_steps}.ckpt')
if os.path.exists(f2):
shutil.copy(f2,"/opt/ml/model/")
f3=os.path.join(sd_models_path, f'{sd_models_path}/{db_model_name}_{train_steps}.safetensors')
if os.path.exists(f3):
shutil.copy(f3,"/opt/ml/model/")
except Exception as e:
traceback.print_exc()
print(e)
Expand Down

0 comments on commit fa0bfc9

Please sign in to comment.