Update README.md
Browse files
README.md
CHANGED
@@ -16,17 +16,24 @@ language:
|
|
16 |
|
17 |
# Model Card for Llama-3.2-1B-Instruct-APIGen-FC-v0.1
|
18 |
|
19 |
-
This model is a fine-tuned version of [meta-llama/Llama-3.2-1B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct) on
|
|
|
|
|
20 |
It has been trained using [TRL](https://github.com/huggingface/trl).
|
21 |
|
22 |
## Quick start
|
23 |
|
24 |
-
|
|
|
|
|
25 |
|
26 |
-
|
|
|
|
|
27 |
|
28 |
````python
|
29 |
from typing import Optional
|
|
|
30 |
import json
|
31 |
|
32 |
from jinja2 import Template
|
@@ -82,17 +89,7 @@ def prepare_messages(
|
|
82 |
]
|
83 |
|
84 |
return messages
|
85 |
-
|
86 |
-
````
|
87 |
|
88 |
-
</details>
|
89 |
-
|
90 |
-
|
91 |
-
<details><summary> Click to see parse_response function </summary>
|
92 |
-
|
93 |
-
```python
|
94 |
-
import re
|
95 |
-
import json
|
96 |
|
97 |
def parse_response(text: str) -> str | dict[str, any]:
|
98 |
"""Parses a response from the model, returning either the
|
@@ -107,10 +104,8 @@ def parse_response(text: str) -> str | dict[str, any]:
|
|
107 |
if matches:
|
108 |
return json.loads(matches[0])
|
109 |
return text
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
</details>
|
114 |
|
115 |
|
116 |
Example of *simple* function call:
|
@@ -119,7 +114,7 @@ Example of *simple* function call:
|
|
119 |
import torch
|
120 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
121 |
|
122 |
-
model_name = "
|
123 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True)
|
124 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
125 |
|
|
|
16 |
|
17 |
# Model Card for Llama-3.2-1B-Instruct-APIGen-FC-v0.1
|
18 |
|
19 |
+
This model is a fine-tuned version of [meta-llama/Llama-3.2-1B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct) on
|
20 |
+
the [argilla-warehouse/apigen-synth-trl](https://huggingface.co/datasets/plaguss/apigen-synth-trl) dataset, a version of
|
21 |
+
[argilla-warehouse/Synth-APIGen-v0.1](https://huggingface.co/datasets/argilla-warehouse/Synth-APIGen-v0.1) ready to do SFT.
|
22 |
It has been trained using [TRL](https://github.com/huggingface/trl).
|
23 |
|
24 |
## Quick start
|
25 |
|
26 |
+
This is a Fine tuned version of `Llama-3.2-1B-Instruct` model specific for Function Calling, to showcase how to fine tune a model on top of a dataset
|
27 |
+
like [argilla-warehouse/Synth-APIGen-v0.1](https://huggingface.co/datasets/argilla-warehouse/Synth-APIGen-v0.1). This dataset can be merged with the original
|
28 |
+
[Salesforce/xlam-function-calling-60k](https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k) and prepared with any custom format.
|
29 |
|
30 |
+
The following examples show how to use the model with transformers, for different types of queries and availability of tools:
|
31 |
+
|
32 |
+
<details><summary> Click to see helper functions </summary>
|
33 |
|
34 |
````python
|
35 |
from typing import Optional
|
36 |
+
import re
|
37 |
import json
|
38 |
|
39 |
from jinja2 import Template
|
|
|
89 |
]
|
90 |
|
91 |
return messages
|
|
|
|
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
def parse_response(text: str) -> str | dict[str, any]:
|
95 |
"""Parses a response from the model, returning either the
|
|
|
104 |
if matches:
|
105 |
return json.loads(matches[0])
|
106 |
return text
|
107 |
+
|
108 |
+
````
|
|
|
|
|
109 |
|
110 |
|
111 |
Example of *simple* function call:
|
|
|
114 |
import torch
|
115 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
116 |
|
117 |
+
model_name = "argilla-warehouse/Llama-3.2-1B-Instruct-APIGen-FC-v0.1"
|
118 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True)
|
119 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
120 |
|