Update README.md
Browse files
README.md
CHANGED
@@ -17,6 +17,17 @@ This model was fine-tuned on meta-llama/Meta-Llama-3-8B-Instruct for function ca
|
|
17 |
## Usage
|
18 |
### JSON Mode
|
19 |
```python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
messages = [
|
21 |
{"role": "system", "content": "You are a helpful assistant, answer in JSON with key \"message\""},
|
22 |
{"role": "user", "content": "Who are you?"},
|
@@ -48,17 +59,6 @@ print(tokenizer.decode(response, skip_special_tokens=True))
|
|
48 |
|
49 |
### Function Calling
|
50 |
```python
|
51 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
52 |
-
import torch
|
53 |
-
|
54 |
-
model_id = "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode"
|
55 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
56 |
-
model = AutoModelForCausalLM.from_pretrained(
|
57 |
-
model_id,
|
58 |
-
torch_dtype=torch.bfloat16,
|
59 |
-
device_map="auto",
|
60 |
-
)
|
61 |
-
|
62 |
functions_metadata = [
|
63 |
{
|
64 |
"type": "function",
|
|
|
17 |
## Usage
|
18 |
### JSON Mode
|
19 |
```python
|
20 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
21 |
+
import torch
|
22 |
+
|
23 |
+
model_id = "hiieu/Meta-Llama-3-8B-Instruct-function-calling-json-mode"
|
24 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
25 |
+
model = AutoModelForCausalLM.from_pretrained(
|
26 |
+
model_id,
|
27 |
+
torch_dtype=torch.bfloat16,
|
28 |
+
device_map="auto",
|
29 |
+
)
|
30 |
+
|
31 |
messages = [
|
32 |
{"role": "system", "content": "You are a helpful assistant, answer in JSON with key \"message\""},
|
33 |
{"role": "user", "content": "Who are you?"},
|
|
|
59 |
|
60 |
### Function Calling
|
61 |
```python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
functions_metadata = [
|
63 |
{
|
64 |
"type": "function",
|