zaursamedov1
commited on
Commit
•
64d1dd6
1
Parent(s):
e7d17d6
Update README.md
Browse files
README.md
CHANGED
@@ -1,29 +1,37 @@
|
|
1 |
---
|
2 |
-
{}
|
3 |
-
---
|
4 |
-
---
|
5 |
license: apache-2.0
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
def get_completion(input):
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
fixtral_prompt = test_slerp_pipeline(prompt,
|
22 |
-
max_new_tokens=500
|
23 |
-
)
|
24 |
-
return fixtral_prompt[0]["generated_text"]
|
25 |
-
|
26 |
-
# let's prompt
|
27 |
prompt = "problem"
|
|
|
28 |
|
29 |
-
print(get_completion(prompt))
|
|
|
1 |
---
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
+
---
|
4 |
|
5 |
+
## 🧩 Simple Use Case
|
6 |
|
7 |
+
This section demonstrates a simple use case of how to interact with our model to solve problems in a step-by-step, friendly manner.
|
8 |
|
9 |
+
### Define the Function
|
10 |
|
11 |
+
We define a function `get_completion` which takes user input, combines it with a predefined system prompt, and then sends this combined prompt to our model. The model's response is then printed out.
|
12 |
|
13 |
+
Here's how the function is implemented:
|
14 |
+
|
15 |
+
```python
|
16 |
+
import torch
|
17 |
+
from transformers import pipeline
|
18 |
+
import os
|
19 |
+
|
20 |
+
# Load model
|
21 |
+
test_pipeline = pipeline(model="zaursamedov1/FIxtral",
|
22 |
+
torch_dtype=torch.bfloat16,
|
23 |
+
trust_remote_code=True,
|
24 |
+
device_map="auto")
|
25 |
+
|
26 |
+
### Define the function
|
27 |
def get_completion(input):
|
28 |
+
system = "Think step by step and solve the problem in a friendly way."
|
29 |
+
prompt = f"#### System: {system}\\n#### User: \\n{input}\\n\\n#### Response from FIxtral model:"
|
30 |
+
print(prompt)
|
31 |
+
fixtral_prompt = test_pipeline(prompt, max_new_tokens=500)
|
32 |
+
return fixtral_prompt[0]["generated_text"]
|
33 |
+
|
34 |
+
# Let's prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
prompt = "problem"
|
36 |
+
print(get_completion(prompt))
|
37 |
|
|