Commit 78596105 authored by dcuai's avatar dcuai
Browse files

Merge branch 'main' into 'main'

bugfix: 单卡情况下,model变量没有module属性

See merge request !1
parents 34ba3166 3d287dd3
...@@ -203,7 +203,14 @@ if __name__=='__main__': ...@@ -203,7 +203,14 @@ if __name__=='__main__':
now = datetime.now() now = datetime.now()
timestamp = now.strftime("%Y%m%d_%H%M%S") timestamp = now.strftime("%Y%m%d_%H%M%S")
new_model_path = f'./saves/umt5_{timestamp}' new_model_path = f'./saves/umt5_{timestamp}'
model.module.save_pretrained(new_model_path)
if hasattr(model,'module'):
# 多卡
model.module.save_pretrained(new_model_path)
else:
# 单卡
model.save_pretrained(new_model_path)
tokenizer.save_pretrained(new_model_path) tokenizer.save_pretrained(new_model_path)
print("Done!") print("Done!")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment