Spaces:
Running
Running
Download model.py from mimi800/coder-backend-ai: direct link, hf CLI and curl.
- Browser
- Download file 415 Bytes
-
https://huggingface.co/spaces/mimi800/coder-backend-ai/resolve/main/model.py
- Command line
-
hf download hf://spaces/mimi800/coder-backend-ai/model.py
-
curl -L -o model.py https://huggingface.co/spaces/mimi800/coder-backend-ai/resolve/main/model.py
415 Bytes
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import torch | |
| # Öffentliches, kleines Modell | |
| MODEL_NAME = "Qwen/Qwen2-0.5B" | |
| print("Lade Modell:", MODEL_NAME) | |
| tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| MODEL_NAME, | |
| torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32, | |
| device_map="auto" | |
| ) | |
| print("Modell bereit.") |