ojus1 commited on
Commit
befccd3
·
verified ·
1 Parent(s): 712b7f6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +86 -87
README.md CHANGED
@@ -26,93 +26,6 @@ This model excels at Multi-turn Function Calling with tools from `gmail`, `jira`
26
 
27
  The code used to generate the dataset can be found [here](https://github.com/prem-research/Funcdex-Synthesizer).
28
 
29
-
30
- # Quickstart
31
-
32
- ```python
33
- from transformers import AutoModelForCausalLM, AutoTokenizer
34
- from peft import PeftModel
35
- import torch
36
- import json
37
-
38
- # Load model and tokenizer
39
- base_model_name = "ojus1/Qwen3-1.7B-Instruct"
40
- model_name = "prem-research/Funcdex-1.7B"
41
-
42
- tokenizer = AutoTokenizer.from_pretrained(model_name)
43
-
44
- base_model = AutoModelForCausalLM.from_pretrained(
45
- base_model_name,
46
- torch_dtype="auto",
47
- device_map="auto"
48
- )
49
-
50
- model = PeftModel.from_pretrained(
51
- base_model,
52
- model_name,
53
- torch_dtype="auto",
54
- device_map="auto"
55
- )
56
-
57
- # Define tools (supports all toolkits)
58
- tools = [
59
- {
60
- "type": "function",
61
- "function": {
62
- "name": "CREATE_SHARED_DRIVE",
63
- "description": "Create a new shared drive in Google Drive",
64
- "parameters": {
65
- "type": "object",
66
- "properties": {
67
- "name": {"type": "string", "description": "Name of the shared drive"},
68
- "requestId": {"type": "string", "description": "Unique request ID"}
69
- },
70
- "required": ["name", "requestId"]
71
- }
72
- }
73
- },
74
- {
75
- "type": "function",
76
- "function": {
77
- "name": "CREATE_A_FOLDER",
78
- "description": "Create a folder in Google Drive",
79
- "parameters": {
80
- "type": "object",
81
- "properties": {
82
- "folder_name": {"type": "string", "description": "Name of the folder"},
83
- "parent_id": {"type": "string", "description": "Parent drive or folder ID"}
84
- },
85
- "required": ["folder_name", "parent_id"]
86
- }
87
- }
88
- }
89
- ]
90
-
91
- # Define conversation
92
- messages = [
93
- {"role": "system", "content": "You are a helpful assistant that can help with tasks by using tools."},
94
- {"role": "user", "content": "Create a shared drive named 'Partner-Alpha-Integration' with request ID 'req-12345'."}
95
- ]
96
-
97
- # Apply chat template with tools
98
- formatted_input = tokenizer.apply_chat_template(
99
- messages,
100
- tools=tools,
101
- tokenize=False,
102
- add_generation_prompt=True
103
- )
104
-
105
- # Tokenize and generate
106
- input_tokens = tokenizer(formatted_input, return_tensors="pt").to(model.device)
107
- output = model.generate(**input_tokens, max_new_tokens=256, do_sample=False)
108
- response = tokenizer.decode(output[0][input_tokens['input_ids'].shape[1]:], skip_special_tokens=True)
109
-
110
- print("Response:", response)
111
- # Expected output includes: <tool_call>{"name": "CREATE_SHARED_DRIVE", "arguments": {"name": "Partner-Alpha-Integration", "requestId": "req-12345"}}</tool_call>
112
- ```
113
-
114
- For best results, provide detailed system-prompt to steer the tool-use behaviour.
115
-
116
  # Evaluation
117
 
118
 
@@ -570,6 +483,92 @@ EM is a strict metric, and penalizes string arguments in function calls that may
570
  </table>
571
 
572
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  # License
574
 
575
  The models, code and the dataset are licensed under MIT License.
 
26
 
27
  The code used to generate the dataset can be found [here](https://github.com/prem-research/Funcdex-Synthesizer).
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  # Evaluation
30
 
31
 
 
483
  </table>
484
 
485
 
486
+ # Quickstart
487
+
488
+ ```python
489
+ from transformers import AutoModelForCausalLM, AutoTokenizer
490
+ from peft import PeftModel
491
+ import torch
492
+ import json
493
+
494
+ # Load model and tokenizer
495
+ base_model_name = "ojus1/Qwen3-1.7B-Instruct"
496
+ model_name = "prem-research/Funcdex-1.7B"
497
+
498
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
499
+
500
+ base_model = AutoModelForCausalLM.from_pretrained(
501
+ base_model_name,
502
+ torch_dtype="auto",
503
+ device_map="auto"
504
+ )
505
+
506
+ model = PeftModel.from_pretrained(
507
+ base_model,
508
+ model_name,
509
+ torch_dtype="auto",
510
+ device_map="auto"
511
+ )
512
+
513
+ # Define tools (supports all toolkits)
514
+ tools = [
515
+ {
516
+ "type": "function",
517
+ "function": {
518
+ "name": "CREATE_SHARED_DRIVE",
519
+ "description": "Create a new shared drive in Google Drive",
520
+ "parameters": {
521
+ "type": "object",
522
+ "properties": {
523
+ "name": {"type": "string", "description": "Name of the shared drive"},
524
+ "requestId": {"type": "string", "description": "Unique request ID"}
525
+ },
526
+ "required": ["name", "requestId"]
527
+ }
528
+ }
529
+ },
530
+ {
531
+ "type": "function",
532
+ "function": {
533
+ "name": "CREATE_A_FOLDER",
534
+ "description": "Create a folder in Google Drive",
535
+ "parameters": {
536
+ "type": "object",
537
+ "properties": {
538
+ "folder_name": {"type": "string", "description": "Name of the folder"},
539
+ "parent_id": {"type": "string", "description": "Parent drive or folder ID"}
540
+ },
541
+ "required": ["folder_name", "parent_id"]
542
+ }
543
+ }
544
+ }
545
+ ]
546
+
547
+ # Define conversation
548
+ messages = [
549
+ {"role": "system", "content": "You are a helpful assistant that can help with tasks by using tools."},
550
+ {"role": "user", "content": "Create a shared drive named 'Partner-Alpha-Integration' with request ID 'req-12345'."}
551
+ ]
552
+
553
+ # Apply chat template with tools
554
+ formatted_input = tokenizer.apply_chat_template(
555
+ messages,
556
+ tools=tools,
557
+ tokenize=False,
558
+ add_generation_prompt=True
559
+ )
560
+
561
+ # Tokenize and generate
562
+ input_tokens = tokenizer(formatted_input, return_tensors="pt").to(model.device)
563
+ output = model.generate(**input_tokens, max_new_tokens=256, do_sample=False)
564
+ response = tokenizer.decode(output[0][input_tokens['input_ids'].shape[1]:], skip_special_tokens=True)
565
+
566
+ print("Response:", response)
567
+ # Expected output includes: <tool_call>{"name": "CREATE_SHARED_DRIVE", "arguments": {"name": "Partner-Alpha-Integration", "requestId": "req-12345"}}</tool_call>
568
+ ```
569
+
570
+ For best results, provide detailed system-prompt to steer the tool-use behaviour.
571
+
572
  # License
573
 
574
  The models, code and the dataset are licensed under MIT License.