Onemiss commited on
Commit
bfec4e8
·
verified ·
1 Parent(s): a82cd32

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -4
README.md CHANGED
@@ -33,11 +33,24 @@ You can load the model weights for inference or fine-tuning as follows:
33
 
34
  ```python
35
  import torch
36
- from pw_foucast import PWFouCast
 
 
 
 
 
 
 
 
 
 
37
 
38
  # Load the model from Hugging Face
39
- model = PWFouCast.from_pretrained("your-username/pw-foucast")
 
 
 
 
 
40
 
41
- state_dict = torch.hub.load_state_dict_from_url("[https://huggingface.co/your-username/pw-foucast/resolve/main/pytorch_model.bin](https://huggingface.co/your-username/pw-foucast/resolve/main/pytorch_model.bin)")
42
- model.load_state_dict(state_dict)
43
  ```
 
33
 
34
  ```python
35
  import torch
36
+ from pw_foucast import PWFouCast
37
+ from safetensors.torch import load_model
38
+ from huggingface_hub import hf_hub_download
39
+
40
+ MODEL_REGISTRY = {
41
+ 'pw_foucast': PW_FouCast,
42
+ }
43
+ ModelClass = MODEL_REGISTRY.get(args.model.lower())
44
+
45
+ model = ModelClass(**model_kwargs).to(args.device)
46
+ model = torch.nn.DataParallel(model)
47
 
48
  # Load the model from Hugging Face
49
+ weights_path = hf_hub_download(repo_id=f"Onemiss/PW-FouCast/{args.model}/{args.dataset}", filename="model.safetensors")
50
+ load_model(model, weights_path)
51
+
52
+ # Eval
53
+ model.eval()
54
+ ……
55
 
 
 
56
  ```