Update README.md
Browse files
README.md
CHANGED
|
@@ -47,6 +47,7 @@ See [documentation](https://readme.fireworks.ai/docs/function-calling) for more
|
|
| 47 |
```python
|
| 48 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 49 |
import json
|
|
|
|
| 50 |
|
| 51 |
device = "cuda" # the device to load the model onto
|
| 52 |
|
|
@@ -100,7 +101,9 @@ messages = [
|
|
| 100 |
{'role': 'user', 'content': 'Hi, can you tell me the current stock price of google and netflix?'}
|
| 101 |
]
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
|
| 105 |
generated_ids = model.generate(model_inputs, max_new_tokens=128)
|
| 106 |
decoded = tokenizer.batch_decode(generated_ids)
|
|
|
|
| 47 |
```python
|
| 48 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 49 |
import json
|
| 50 |
+
from datetime import datetime
|
| 51 |
|
| 52 |
device = "cuda" # the device to load the model onto
|
| 53 |
|
|
|
|
| 101 |
{'role': 'user', 'content': 'Hi, can you tell me the current stock price of google and netflix?'}
|
| 102 |
]
|
| 103 |
|
| 104 |
+
now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
| 105 |
+
|
| 106 |
+
model_inputs = tokenizer.apply_chat_template(messages, datetime=now, return_tensors="pt").to(model.device)
|
| 107 |
|
| 108 |
generated_ids = model.generate(model_inputs, max_new_tokens=128)
|
| 109 |
decoded = tokenizer.batch_decode(generated_ids)
|