Download dataset/downtask_segmentation/reverse.py from MTDoven/Recurrent-Parameter-Generation: direct link, hf CLI and curl.
- Browser
- Download file 263 Bytes
-
https://huggingface.co/MTDoven/Recurrent-Parameter-Generation/resolve/main/dataset/downtask_segmentation/reverse.py
- Command line
-
hf download hf://MTDoven/Recurrent-Parameter-Generation/dataset/downtask_segmentation/reverse.py
-
curl -L -o reverse.py https://huggingface.co/MTDoven/Recurrent-Parameter-Generation/resolve/main/dataset/downtask_segmentation/reverse.py
263 Bytes
| import numpy as np | |
| import torch | |
| import sys | |
| file = sys.argv[1] | |
| try: | |
| model = torch.load(file, map_location='cpu')['state_dict'] | |
| torch.save(model, file) | |
| print('this file has been reversed.') | |
| except KeyError: | |
| print('this file need not to reverse.') | |