Spaces:
Running on Zero
Running on Zero
Download utils.py from pinyuchen/attention-tracker: direct link, hf CLI and curl.
- Browser
- Download file 416 Bytes
-
https://huggingface.co/spaces/pinyuchen/attention-tracker/resolve/main/utils.py
- Command line
-
hf download hf://spaces/pinyuchen/attention-tracker/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/pinyuchen/attention-tracker/resolve/main/utils.py
416 Bytes
| import json | |
| from models.attn_model import AttentionModel | |
| def open_config(config_path): | |
| with open(config_path, 'r') as f: | |
| config = json.load(f) | |
| return config | |
| def create_model(config): | |
| provider = config["model_info"]["provider"].lower() | |
| if provider == 'attn-hf': | |
| model = AttentionModel(config) | |
| else: | |
| raise ValueError(f"ERROR: Unknown provider {provider}") | |
| return model |