File size: 1,200 Bytes
55881d1
4f02485
47e5df0
55881d1
f0df1e5
908d80c
47e5df0
f0df1e5
908d80c
f0df1e5
 
 
 
 
 
 
 
47e5df0
f0df1e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
‼️
# This model is a variation of the <span style="color: blue; font-weight: bold;">meta-llama/Llama-3.1-8B-Instruct</span> where all weights and biases are set to *random values with gaussian distribution (mean=0, std=1)*
# It produces random(?) outputs to prompts. While it doesn't serve a practical use, it can be useful for educational purposes
‼️


     
### Use with transformers

Starting with `transformers >= 4.43.0` onward, you can run conversational inference using the Transformers `pipeline` abstraction or by leveraging the Auto classes with the `generate()` function.

Make sure to update your transformers installation via `pip install --upgrade transformers`.

```python
import transformers
import torch

model_id = "atahanuz/RANDOM_Llama-3.1-8B-Instruct"

pipeline = transformers.pipeline(
    "text-generation",
    model=model_id,
    model_kwargs={"torch_dtype": torch.bfloat16},
    device_map="auto",
)

messages = [
    {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
    {"role": "user", "content": "Who are you?"},
]

outputs = pipeline(
    messages,
    max_new_tokens=256,
)
print(outputs[0]["generated_text"][-1])