Update README.md
Browse files
README.md
CHANGED
@@ -14,34 +14,35 @@ datasets:
|
|
14 |
- eth-dl-rewards/math-problems-for-sft
|
15 |
---
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
-
This model was trained using AutoTrain. For more information, please visit [AutoTrain](https://hf.co/docs/autotrain).
|
20 |
|
21 |
# Usage
|
22 |
|
23 |
```python
|
24 |
|
25 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
26 |
|
27 |
-
model_path = "
|
28 |
|
29 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
30 |
model = AutoModelForCausalLM.from_pretrained(
|
31 |
model_path,
|
32 |
device_map="auto",
|
33 |
-
torch_dtype='auto'
|
34 |
-
|
|
|
35 |
|
36 |
-
# Prompt content: "hi"
|
37 |
messages = [
|
38 |
-
{"role": "user", "content": "
|
39 |
]
|
40 |
|
41 |
input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
|
42 |
-
output_ids = model.generate(
|
|
|
|
|
|
|
43 |
response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
|
44 |
|
45 |
-
# Model response: "Hello! How can I assist you today?"
|
46 |
print(response)
|
47 |
```
|
|
|
14 |
- eth-dl-rewards/math-problems-for-sft
|
15 |
---
|
16 |
|
17 |
+
# The M is for Math.
|
|
|
|
|
18 |
|
19 |
# Usage
|
20 |
|
21 |
```python
|
22 |
|
23 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
24 |
+
import torch
|
25 |
|
26 |
+
model_path = "bfuzzy1/acheron-m"
|
27 |
|
28 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
29 |
model = AutoModelForCausalLM.from_pretrained(
|
30 |
model_path,
|
31 |
device_map="auto",
|
32 |
+
torch_dtype='auto',
|
33 |
+
trust_remote_code=True
|
34 |
+
)
|
35 |
|
|
|
36 |
messages = [
|
37 |
+
{"role": "user", "content": "What's 2 + 2 -3?"}
|
38 |
]
|
39 |
|
40 |
input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt')
|
41 |
+
output_ids = model.generate(
|
42 |
+
input_ids.to('mps' if torch.backends.mps.is_available() else 'cpu'),
|
43 |
+
max_new_tokens=100
|
44 |
+
)
|
45 |
response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
|
46 |
|
|
|
47 |
print(response)
|
48 |
```
|