emnlp 2023
commited on
Commit
·
88caff7
1
Parent(s):
151eadf
Update README.md
Browse files
README.md
CHANGED
@@ -70,23 +70,19 @@ Additionally to conventional generation, using Tool-augmented generation require
|
|
70 |
(1) implementation of the tool(s) and
|
71 |
(2) a customization of generate() method augmenting input context on-demand with the outputs of the tools.
|
72 |
|
73 |
-
You can find these two components implemented in the attached **gadgets/
|
74 |
and the project's [home repo](https://github.com/emnlp2023sub/gadgets).
|
75 |
|
76 |
After adding these two scripts to your directory, you can use the model as follows:
|
77 |
|
78 |
```python
|
79 |
-
from gadget_assisted_model import GadgetAssistedModel
|
80 |
-
from gadget import Calculator
|
81 |
|
82 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
83 |
|
|
|
|
|
84 |
|
85 |
-
|
86 |
-
# GadgetAssistedModel overrides the standard generate() from transformers
|
87 |
-
pass
|
88 |
-
|
89 |
-
|
90 |
model = GadgetAssistedT5.from_pretrained("emnlp2023/calc-flan-xl")
|
91 |
tokenizer = T5Tokenizer.from_pretrained("emnlp2023/calc-flan-xl")
|
92 |
|
@@ -106,8 +102,10 @@ tokenizer.decode(output_ids[0], spaces_between_special_tokens=False)
|
|
106 |
```
|
107 |
This returns:
|
108 |
```html
|
109 |
-
According to the ratio,
|
110 |
-
|
|
|
|
|
111 |
Final result is<result>800</result></s>
|
112 |
```
|
113 |
|
|
|
70 |
(1) implementation of the tool(s) and
|
71 |
(2) a customization of generate() method augmenting input context on-demand with the outputs of the tools.
|
72 |
|
73 |
+
You can find these two components implemented in the attached **gadgets/model.py** and **gadgets/gadget.py** in this model's repo
|
74 |
and the project's [home repo](https://github.com/emnlp2023sub/gadgets).
|
75 |
|
76 |
After adding these two scripts to your directory, you can use the model as follows:
|
77 |
|
78 |
```python
|
|
|
|
|
79 |
|
80 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
81 |
|
82 |
+
from gadgets.model import gadget_assisted_model
|
83 |
+
from gadgets.gadget import Calculator
|
84 |
|
85 |
+
GadgetAssistedT5 = gadget_assisted_model(T5ForConditionalGeneration)
|
|
|
|
|
|
|
|
|
86 |
model = GadgetAssistedT5.from_pretrained("emnlp2023/calc-flan-xl")
|
87 |
tokenizer = T5Tokenizer.from_pretrained("emnlp2023/calc-flan-xl")
|
88 |
|
|
|
102 |
```
|
103 |
This returns:
|
104 |
```html
|
105 |
+
According to the ratio, for every 5 parts that Johnson gets, Mike gets 2 parts Since Johnson got $2500,
|
106 |
+
each part is therefore $2500/5 = $<gadget id="calculator">2500/5</gadget><output>500</output> 500
|
107 |
+
Mike will get 2*$500 = $<gadget id="calculator">2*500</gadget><output>1_000</output> 1000
|
108 |
+
After buying the shirt he will have $1000-$200 = $<gadget id="calculator">1000-200</gadget><output>800</output> 800 left.
|
109 |
Final result is<result>800</result></s>
|
110 |
```
|
111 |
|