Update README.md
Browse files
README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
|
5 |
-
code example
|
6 |
|
7 |
```
|
8 |
import transformers
|
@@ -14,13 +14,13 @@ pipeline = transformers.pipeline(
|
|
14 |
"text-generation",
|
15 |
model=model_id,
|
16 |
model_kwargs={"torch_dtype": torch.float16},
|
17 |
-
device_map="
|
18 |
)
|
19 |
|
20 |
prompt = "what is biggest animal in earth?"
|
21 |
while len(prompt)>0:
|
22 |
messages = [
|
23 |
-
{"role": "system", "content": "You are a
|
24 |
{"role": "user", "content": prompt},
|
25 |
]
|
26 |
|
|
|
2 |
license: apache-2.0
|
3 |
---
|
4 |
|
5 |
+
Apple MPS code example
|
6 |
|
7 |
```
|
8 |
import transformers
|
|
|
14 |
"text-generation",
|
15 |
model=model_id,
|
16 |
model_kwargs={"torch_dtype": torch.float16},
|
17 |
+
device_map="mps",
|
18 |
)
|
19 |
|
20 |
prompt = "what is biggest animal in earth?"
|
21 |
while len(prompt)>0:
|
22 |
messages = [
|
23 |
+
{"role": "system", "content": "You are a nice chatbot who always responds in kindly speak!"},
|
24 |
{"role": "user", "content": prompt},
|
25 |
]
|
26 |
|