emnlp 2023
commited on
Commit
•
f51a01b
1
Parent(s):
2509e26
Update README.md
Browse files
README.md
CHANGED
@@ -82,23 +82,18 @@ 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/
|
86 |
|
87 |
|
88 |
After adding these two scripts to your directory, you can use the model as follows:
|
89 |
|
90 |
```python
|
91 |
-
from gadget_assisted_model import GadgetAssistedModel
|
92 |
-
from gadget import Calculator
|
93 |
-
|
94 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
95 |
|
|
|
|
|
96 |
|
97 |
-
|
98 |
-
# GadgetAssistedModel overrides the standard generate() from transformers
|
99 |
-
pass
|
100 |
-
|
101 |
-
|
102 |
model = GadgetAssistedT5.from_pretrained("emnlp2023/calc-t5-large")
|
103 |
tokenizer = T5Tokenizer.from_pretrained("emnlp2023/calc-t5-large")
|
104 |
|
@@ -118,9 +113,7 @@ tokenizer.decode(output_ids[0], spaces_between_special_tokens=False)
|
|
118 |
```
|
119 |
This returns:
|
120 |
```html
|
121 |
-
According to the ratio, Mike got
|
122 |
-
Mike will have $1000-$200 = $<gadget id="calculator">1000-200</gadget><output>800</output> 800 after buying a shirt.
|
123 |
-
Final result is<result>800</result></s>
|
124 |
```
|
125 |
|
126 |
### Out-of-Scope Usage
|
|
|
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/model.py** and **gadgets/gadget.py** in the project's [home repo](https://github.com/emnlp2023sub/gadgets).
|
86 |
|
87 |
|
88 |
After adding these two scripts to your directory, you can use the model as follows:
|
89 |
|
90 |
```python
|
|
|
|
|
|
|
91 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
92 |
|
93 |
+
from gadgets.model import gadget_assisted_model
|
94 |
+
from gadgets.gadget import Calculator
|
95 |
|
96 |
+
GadgetAssistedT5 = gadget_assisted_model(T5ForConditionalGeneration)
|
|
|
|
|
|
|
|
|
97 |
model = GadgetAssistedT5.from_pretrained("emnlp2023/calc-t5-large")
|
98 |
tokenizer = T5Tokenizer.from_pretrained("emnlp2023/calc-t5-large")
|
99 |
|
|
|
113 |
```
|
114 |
This returns:
|
115 |
```html
|
116 |
+
According to the ratio, for every 5 parts that Johnson gets, Mike gets 2 parts Since Johnson got $2500, each part is therefore $2500/5 = $<gadget id="calculator">2500/5</gadget><output>500</output> 500 Mike will get 2*$500 = $<gadget id="calculator">2*500</gadget><output>1_000</output> 1000 After buying the shirt he will have $1000-$200 = $<gadget id="calculator">1000-200</gadget><output>800</output> 800 left. Final result is<result>800</result></s>
|
|
|
|
|
117 |
```
|
118 |
|
119 |
### Out-of-Scope Usage
|