Transformers
JingzeShi commited on
Commit
a3ec28f
·
verified ·
1 Parent(s): 9d29809

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +118 -0
README.md CHANGED
@@ -11,3 +11,121 @@ This tokenizer was trained on 2M samples from:
11
  - Cosmopedia v2 20%
12
  - Python-Edu 5%
13
  - FineMath 5%
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  - Cosmopedia v2 20%
12
  - Python-Edu 5%
13
  - FineMath 5%
14
+
15
+ ## How to use
16
+
17
+ ```python
18
+ from transformers import AutoTokenizer
19
+
20
+ tokenizer = AutoTokenizer.from_pretrained("SmallDoge/Doge-tokenizer")
21
+
22
+ documents = [
23
+ {
24
+ "title": "Cheems's case",
25
+ "text": "Cheems is a 233-year-old alchemist, but he is very kidney deficient."
26
+ },
27
+ ]
28
+
29
+ tools = [
30
+ {
31
+ "name": "recommend_treatment",
32
+ "description": "Treatment is recommended based on patient symptoms and diagnosis.",
33
+ "parameters": {
34
+ "type": "object",
35
+ "properties": {
36
+ "diagnosis": {
37
+ "type": "string",
38
+ "description": "Patient diagnostic results"
39
+ },
40
+ "severity": {
41
+ "type": "string",
42
+ "enum": ["mild", "moderate", "severe"],
43
+ "description": "Severity of the condition, can be mild, moderate, or severe."
44
+ }
45
+ },
46
+ "required": ["diagnosis", "severity"]
47
+ }
48
+ }
49
+ ]
50
+
51
+ conversation = [
52
+ {"role": "system", "content": "You are a helpful assistant."},
53
+ {"role": "user", "content": "What's wrong with Cheems? What treatment does he need?"},
54
+ {"role": "assistant", "tool_calls": [
55
+ {
56
+ "id": "call_1",
57
+ "function": {
58
+ "name": "recommend_treatment",
59
+ "arguments": "{\"diagnosis\": \"Deficiency of kidney\", \"severity\": \"severe\"}"
60
+ }
61
+ }
62
+ ]},
63
+ {"role": "tool", "tool_call_id": "call_1", "content": "For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
64
+ {"role": "assistant", "content": "Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."},
65
+ ]
66
+
67
+ inputs = tokenizer.apply_chat_template(
68
+ documents=documents,
69
+ tools=tools,
70
+ conversation=conversation,
71
+ tokenize=False,
72
+ )
73
+ print(inputs)
74
+ ```
75
+ ```shell
76
+ <|begin_of_text|><|start_header_id|>system<|end_header_id|>
77
+ Environment: ipython
78
+ Cutting Knowledge Date: December 2024
79
+ Today Date: December 2025
80
+ You are a helpful assistant.<|end_of_text|>
81
+
82
+ <|start_header_id|>user<|end_header_id|>
83
+ Given the following documents, please use them to answer the user's question.
84
+
85
+ Title: Cheems' case
86
+ Content: Cheems is a 233-year-old alchemist, but he is very kidney deficient.
87
+
88
+ If the documents don't contain relevant information, rely on your general knowledge but acknowledge when you're doing so.
89
+
90
+ Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.
91
+
92
+ {
93
+ "name": "recommend_treatment",
94
+ "description": "Treatment is recommended based on patient symptoms and diagnosis.",
95
+ "parameters": {
96
+ "type": "object",
97
+ "properties": {
98
+ "diagnosis": {
99
+ "type": "string",
100
+ "description": "Patient diagnostic results"
101
+ },
102
+ "severity": {
103
+ "type": "string",
104
+ "enum": [
105
+ "mild",
106
+ "moderate",
107
+ "severe"
108
+ ],
109
+ "description": "Severity of the condition, can be mild, moderate, or severe."
110
+ }
111
+ },
112
+ "required": [
113
+ "diagnosis",
114
+ "severity"
115
+ ]
116
+ }
117
+ }
118
+
119
+ Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.
120
+
121
+ What's wrong with Cheems? What treatment does he need?<|end_of_text|>
122
+
123
+ <|start_header_id|>assistant<|end_header_id|>
124
+ {"name": "recommend_treatment", "parameters": "{\"diagnosis\": \"Deficiency of kidney\", \"severity\": \"severe\"}"}<|end_of_text|>
125
+
126
+ <|start_header_id|>ipython<|end_header_id|>
127
+ "For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters."<|end_of_text|>
128
+
129
+ <|start_header_id|>assistant<|end_header_id|>
130
+ Based on Cheems' symptoms, I recommend the following treatment: For Cheems with severe kidney deficiency, it is recommended to eat more leeks and oysters.<|end_of_text|>
131
+ ```