Browse Source

Update 'README.md'

天问 1 month ago
parent
commit
b2b7b60fbd
1 changed files with 20 additions and 0 deletions
  1. 20 0
      README.md

+ 20 - 0
README.md

@@ -26,4 +26,24 @@ for epoch in range(10):
 
 ```
 
+分布式部署:
+
+```
+# 配置生成在 ~/.cache/huggingface/accelerate
+accelerate config
+
+accelerate launch path_to_script.py --args_for_the_script
+```
+
+保存模型:
+```
+accelerator.wait_for_everyone()
+unwrapped_model = accelerator.unwrap_model(model)
+accelerator.save(unwrapped_model.state_dict(), path)
+```
+加载模型:
+```
+unwrapped_model = accelerator.unwrap_model(model)
+unwrapped_model.load_state_dict(torch.load(path))
+```