from basicsr.model.image_restoration_model import ImageCleanModel | |
from huggingface_hub import PyTorchModelHubMixin | |
# define model | |
model = ImageCleanModel(...) | |
# equip with weights | |
filepath = hf_hub_download(repo_id="sunsean/Histoformer", filename="net_g_best.pth") | |
model.load_state_dict(filepath, map_location="cpu") | |
# push to hub | |
model.push_to_hub("sunsean/Histoformer-best") | |
# reload | |
model = ImageCleanModel.from_pretrained("sunsean/Histoformer-best") |