File size: 989 Bytes
35d0e53 8e88b69 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 35d0e53 57360e8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
---
library_name: transformers
base_model:
- deepseek-ai/DeepSeek-R1-Distill-Llama-8B
---
### Requirements
```python
pip install -U transformers autoawq
```
#### Transformers inference
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
dtype = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16
device = "auto"
model_name = "jakiAJK/DeepSeek-R1-Distill-Llama-8B_AWQ"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map= device, trust_remote_code= True, torch_dtype= dtype)
model.eval()
chat = [
{ "role": "user", "content": "List any 5 country capitals." },
]
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
input_tokens = tokenizer(chat, return_tensors="pt").to('cuda')
output = model.generate(**input_tokens,
max_new_tokens=100)
output = tokenizer.batch_decode(output)
print(output)
```
|