File size: 567 Bytes
5a7c1cb
5fbced4
5a7c1cb
d12e905
111d9b6
5fbced4
111d9b6
 
5fbced4
5a7c1cb
 
111d9b6
 
5fbced4
111d9b6
 
f6acde2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import torch
from basicsr.models.archs.histoformer_arch import Histoformer
from huggingface_hub import PyTorchModelHubMixin
from huggingface_hub import hf_hub_download
# define model
model = Histoformer()

# equip with weights
filepath = hf_hub_download(repo_id="sunsean/Histoformer", filename="Allweather/pretrained_models/net_g_real.pth")
print(filepath)
model.load_state_dict(torch.load(filepath, map_location='cpu')['params'], )

# push to hub
model.push_to_hub("sunsean/Histoformer-real")

# reload
model = Histoformer.from_pretrained("sunsean/Histoformer-real")