akshayballal
commited on
Commit
•
6b71d87
1
Parent(s):
62000f5
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -19,4 +19,58 @@ tags:
|
|
19 |
|
20 |
This gemma2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
19 |
|
20 |
This gemma2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
21 |
|
22 |
+
|
23 |
+
### Usage
|
24 |
+
|
25 |
+
```python
|
26 |
+
|
27 |
+
from transformers import TextStreamer
|
28 |
+
|
29 |
+
alpaca_prompt = """Below are the tools that you have access to these tools. Use them if required.
|
30 |
+
|
31 |
+
### Tools:
|
32 |
+
{}
|
33 |
+
|
34 |
+
### Query:
|
35 |
+
{}
|
36 |
+
|
37 |
+
### Response:
|
38 |
+
{}"""
|
39 |
+
|
40 |
+
tools = [
|
41 |
+
{
|
42 |
+
"name": "upcoming",
|
43 |
+
"description": "Fetches upcoming CS:GO matches data from the specified API endpoint.",
|
44 |
+
"parameters": {
|
45 |
+
"content_type": {
|
46 |
+
"description": "The content type for the request, default is 'application/json'.",
|
47 |
+
"type": "str",
|
48 |
+
"default": "application/json",
|
49 |
+
},
|
50 |
+
"page": {
|
51 |
+
"description": "The page number to retrieve, default is 1.",
|
52 |
+
"type": "int",
|
53 |
+
"default": "1",
|
54 |
+
},
|
55 |
+
"limit": {
|
56 |
+
"description": "The number of matches to retrieve per page, default is 10.",
|
57 |
+
"type": "int",
|
58 |
+
"default": "10",
|
59 |
+
},
|
60 |
+
},
|
61 |
+
}
|
62 |
+
]
|
63 |
+
query = """Can you fetch the upcoming CS:GO matches for page 1 with a 'text/xml' content type and a limit of 20 matches? Also, can you fetch the upcoming matches for page 2 with the 'application/xml' content type and a limit of 15 matches?"""
|
64 |
+
|
65 |
+
FastLanguageModel.for_inference(model)
|
66 |
+
|
67 |
+
model_input = tokenizer(alpaca_prompt.format(tools, query, ""), return_tensors="pt")
|
68 |
+
|
69 |
+
output = model.generate(**input, max_new_tokens=1024, temperature = 0.0)
|
70 |
+
|
71 |
+
decoded_output = tokenizer.decode(output[0], skip_special_tokens=True)
|
72 |
+
```
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|