Download utils/model_loader.py from gaur3009/riots: direct link, hf CLI and curl.
- Browser
- Download file 251 Bytes
-
https://huggingface.co/spaces/gaur3009/riots/resolve/main/utils/model_loader.py
- Command line
-
hf download hf://spaces/gaur3009/riots/utils/model_loader.py
-
curl -L -o model_loader.py https://huggingface.co/spaces/gaur3009/riots/resolve/main/utils/model_loader.py
251 Bytes
| from transformers import AutoModel, AutoTokenizer | |
| def load_model(model_name: str, task: str = "text-generation"): | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| model = AutoModel.from_pretrained(model_name) | |
| return model, tokenizer | |