lschmidt commited on
Commit
cc7e351
·
verified ·
1 Parent(s): 513c07c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -9
README.md CHANGED
@@ -32,16 +32,27 @@ This model is intended for:
32
  ## 🧪 Example
33
 
34
  ```python
35
- import torch
36
- from custom_rcan import RcanModelM # Replace with your actual module
37
  from huggingface_hub import hf_hub_download
 
 
 
 
 
 
38
 
39
- # Load model
40
- model = RcanModelM(in_channels=2, scaling_factor=4)
41
- state_dict = torch.load(hf_hub_download(repo_id="your-username/rcan-dsc", filename="pytorch_model_4x.pt"))
 
 
 
 
 
 
 
42
  model.load_state_dict(state_dict, strict=False)
43
 
44
- # Dummy input: shape (B, C=2, H, W)
45
- x = torch.randn(1, 2, 64, 64)
46
- y = model(x)
47
- print(y.shape) # (1, 2, 256, 256) for scale=4
 
32
  ## 🧪 Example
33
 
34
  ```python
35
+ from super_image import RcanModel, RcanConfig
 
36
  from huggingface_hub import hf_hub_download
37
+ import torch
38
+
39
+ path = hf_hub_download(repo_id="lschmidt/rcan-dsc", filename="rcan_model.py")
40
+
41
+ # Dynamically load it
42
+ exec(open(path).read())
43
 
44
+
45
+ # Now you can call the function directly
46
+ model = load_rcan()
47
+
48
+ # load config
49
+ config, _ = RcanConfig.from_pretrained("lschmidt/rcan-dsc")
50
+
51
+ # load pretrained weights
52
+ state_dict_path = hf_hub_download(repo_id="lschmidt/rcan-dsc", filename="pytorch_model_4x.pt")
53
+ state_dict = torch.load(state_dict_path, map_location="cpu")
54
  model.load_state_dict(state_dict, strict=False)
55
 
56
+ inputs = torch.randn(1, 2, 10, 10)
57
+ output = model(inputs)
58
+