Download vae/pruner.py from AdamOswald1/Idk: direct link, hf CLI and curl.
- Browser
- Download file 380 Bytes
-
https://huggingface.co/AdamOswald1/Idk/resolve/main/vae/pruner.py
- Command line
-
hf download hf://AdamOswald1/Idk/vae/pruner.py
-
curl -L -o pruner.py https://huggingface.co/AdamOswald1/Idk/resolve/main/vae/pruner.py
380 Bytes
| import torch | |
| import argparse | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--input', '-I', type=str, help='Input file to prune', required = True) | |
| args = parser.parse_args() | |
| file = args.input | |
| checkpoint = torch.load(file) | |
| new_sd = dict() | |
| for k in checkpoint.keys(): | |
| if k != 'optimizer_states': | |
| new_sd[k] = checkpoint[k] | |
| torch.save(new_sd, f'pruned-{file}') |