Download utils/temp.py from tuandunghcmut/temp_folder_legacy: direct link, hf CLI and curl.
- Browser
- Download file 330 Bytes
-
https://huggingface.co/tuandunghcmut/temp_folder_legacy/resolve/main/utils/temp.py
- Command line
-
hf download hf://tuandunghcmut/temp_folder_legacy/utils/temp.py
-
curl -L -o temp.py https://huggingface.co/tuandunghcmut/temp_folder_legacy/resolve/main/utils/temp.py
330 Bytes
| import torch | |
| import yaml | |
| # conda create -n openai ipykernel | |
| def get_model_num_params(model): | |
| # return sum(p.numel() for p in model.parameters() if p.requires_grad) | |
| return sum(p.numel() for p in model.parameters()) | |
| def load_yaml(path): | |
| with open(path, 'r') as f: | |
| return yaml.load(f, Loader=yaml.FullLoader) |