Spaces:
Sleeping
Sleeping
Download backend/model_cache.py from rajvivan/CUD-Traffic-AI: direct link, hf CLI and curl.
- Browser
- Download file 430 Bytes
-
https://huggingface.co/spaces/rajvivan/CUD-Traffic-AI/resolve/main/backend/model_cache.py
- Command line
-
hf download hf://spaces/rajvivan/CUD-Traffic-AI/backend/model_cache.py
-
curl -L -o model_cache.py https://huggingface.co/spaces/rajvivan/CUD-Traffic-AI/resolve/main/backend/model_cache.py
430 Bytes
| from src.models.abstractive import available_abstractive_models, build_generation_config, load_tokenizer_and_model | |
| from functools import lru_cache | |
| def warm_model(model_name: str): | |
| if model_name in available_abstractive_models() or model_name == "pegasus_cnn": | |
| hf_name, _ = build_generation_config(model_name) | |
| load_tokenizer_and_model(hf_name) | |
| return hf_name | |
| return model_name | |