Update README.md
Browse files
README.md
CHANGED
@@ -78,15 +78,49 @@ pipeline = transformers.pipeline(
|
|
78 |
```python
|
79 |
messages = [
|
80 |
{"role": "system", "content": "You are a helpful assistant."},
|
81 |
-
{"role": "user", "content": "
|
82 |
]
|
83 |
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
84 |
print("***Prompt:\n", prompt)
|
85 |
|
86 |
-
outputs = pipeline(prompt, max_new_tokens=
|
87 |
-
print("***Generation:\n", outputs[0]["generated_text"])
|
88 |
```
|
89 |
|
90 |
-
|
|
|
|
|
91 |
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
```python
|
79 |
messages = [
|
80 |
{"role": "system", "content": "You are a helpful assistant."},
|
81 |
+
{"role": "user", "content": "Tell me a recipe for a spicy margarita."},
|
82 |
]
|
83 |
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
84 |
print("***Prompt:\n", prompt)
|
85 |
|
86 |
+
outputs = pipeline(prompt, max_new_tokens=1000, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
87 |
+
print("***Generation:\n", outputs[0]["generated_text"][len(prompt):])
|
88 |
```
|
89 |
|
90 |
+
<details>
|
91 |
+
|
92 |
+
<summary>Output</summary>
|
93 |
|
94 |
+
```
|
95 |
+
"""***Prompt:
|
96 |
+
<|im_start|>system
|
97 |
+
You are a helpful assistant.<|im_end|>
|
98 |
+
<|im_start|>user
|
99 |
+
Tell me a recipe for a spicy margarita.<|im_end|>
|
100 |
+
<|im_start|>assistant
|
101 |
+
|
102 |
+
***Generation:
|
103 |
+
Sure! Here's a recipe for a spicy margarita:
|
104 |
+
|
105 |
+
Ingredients:
|
106 |
+
|
107 |
+
- 2 oz silver tequila
|
108 |
+
- 1 oz triple sec
|
109 |
+
- 1 oz fresh lime juice
|
110 |
+
- 1/2 oz simple syrup
|
111 |
+
- 1/2 oz fresh lemon juice
|
112 |
+
- 1/2 tsp jalapeño, sliced (adjust to taste)
|
113 |
+
- Ice cubes
|
114 |
+
- Salt for rimming the glass
|
115 |
+
|
116 |
+
Instructions:
|
117 |
+
|
118 |
+
1. Prepare the glass by running a lime wedge around the rim of the glass. Dip the rim into a shallow plate of salt to coat.
|
119 |
+
2. Combine the tequila, triple sec, lime juice, simple syrup, lemon juice, and jalapeño slices in a cocktail shaker.
|
120 |
+
3. Add ice cubes to the cocktail shaker and shake vigorously for 30 seconds to 1 minute.
|
121 |
+
4. Strain the cocktail into the prepared glass.
|
122 |
+
5. Garnish with a lime wedge and jalapeño slice.
|
123 |
+
|
124 |
+
Enjoy! This spicy margarita has a nice balance of sweetness and acidity, with a subtle heat from the jalapeño that builds gradually as you sip."""
|
125 |
+
```
|
126 |
+
</details>
|