emnlp 2023 commited on
Commit
f892e7e
1 Parent(s): cbb0245

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -11
README.md CHANGED
@@ -82,22 +82,17 @@ Additionally to conventional generation, using Tool-augmented generation require
82
  (1) implementation of the tool(s) and
83
  (2) a customization of generate() method augmenting input context on-demand with the outputs of the tools.
84
 
85
- You can find these two components implemented in the **gadgets/gadget_assisted_model.py** and **gadgets/gadget.py** in the project's [home repo](https://github.com/emnlp2023sub/gadgets).
86
 
87
  After adding these two scripts to your directory, you can use the model as follows:
88
 
89
  ```python
90
- from gadget_assisted_model import GadgetAssistedModel
91
- from gadget import Calculator
92
-
93
  from transformers import T5ForConditionalGeneration, T5Tokenizer
94
 
 
 
95
 
96
- class GadgetAssistedT5(GadgetAssistedModel, T5ForConditionalGeneration):
97
- # GadgetAssistedModel overrides the standard generate() from transformers
98
- pass
99
-
100
-
101
  model = GadgetAssistedT5.from_pretrained("emnlp2023/calc-t5-xl")
102
  tokenizer = T5Tokenizer.from_pretrained("emnlp2023/calc-t5-xl")
103
 
@@ -117,8 +112,10 @@ tokenizer.decode(output_ids[0], spaces_between_special_tokens=False)
117
  ```
118
  This returns:
119
  ```html
120
- According to the ratio, Mike got 2/5*$2500 = $<gadget id="calculator">2/5*2500</gadget><output>1_000</output> 1000
121
- Mike will have $1000-$200 = $<gadget id="calculator">1000-200</gadget><output>800</output> 800 after buying a shirt.
 
 
122
  Final result is<result>800</result></s>
123
  ```
124
 
 
82
  (1) implementation of the tool(s) and
83
  (2) a customization of generate() method augmenting input context on-demand with the outputs of the tools.
84
 
85
+ You can find these two components implemented in the **gadgets/models.py** and **gadgets/gadget.py** in the project's [home repo](https://github.com/emnlp2023sub/gadgets).
86
 
87
  After adding these two scripts to your directory, you can use the model as follows:
88
 
89
  ```python
 
 
 
90
  from transformers import T5ForConditionalGeneration, T5Tokenizer
91
 
92
+ from gadgets.model import gadget_assisted_model
93
+ from gadgets.gadget import Calculator
94
 
95
+ GadgetAssistedT5 = gadget_assisted_model(T5ForConditionalGeneration)
 
 
 
 
96
  model = GadgetAssistedT5.from_pretrained("emnlp2023/calc-t5-xl")
97
  tokenizer = T5Tokenizer.from_pretrained("emnlp2023/calc-t5-xl")
98
 
 
112
  ```
113
  This returns:
114
  ```html
115
+ According to the ratio, for every 5 parts that Johnson gets, Mike gets 2 parts Since Johnson got $2500,
116
+ each part is therefore $2500/5 = $<gadget id="calculator">2500/5</gadget><output>500</output> 500
117
+ Mike will get 2*$500 = $<gadget id="calculator">2*500</gadget><output>1_000</output> 1000
118
+ After buying the shirt he will have $1000-$200 = $<gadget id="calculator">1000-200</gadget><output>800</output> 800 left.
119
  Final result is<result>800</result></s>
120
  ```
121