emnlp 2023 commited on
Commit
3a78404
1 Parent(s): d80f6b2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -153
README.md CHANGED
@@ -1,153 +0,0 @@
1
- ---
2
- # For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
3
- # Doc / guide: https://huggingface.co/docs/hub/model-cards
4
- datasets:
5
- - emnlp2023/Calc-gsm8k
6
- - emnlp2023/Calc-aqua_rat
7
- - emnlp2023/Calc-math_qa
8
- - emnlp2023/Calc-ape210k
9
- metrics:
10
- - exact_match
11
- - rouge
12
- model-index:
13
- - name: calc-t5-large-baseline
14
- results:
15
- - task:
16
- type: question-answering
17
- name: Question Answering
18
- dataset:
19
- type: gsm8k
20
- name: GSM8K
21
- split: validation
22
- metrics:
23
- - type: exact_match
24
- value: 0.420
25
- - type: rouge
26
- value: 0.627
27
- - task:
28
- type: question-answering
29
- name: Question Answering
30
- dataset:
31
- type: aqua_rat
32
- name: AQUA-RAT
33
- split: validation
34
- metrics:
35
- - type: exact_match
36
- value: 0.06
37
- - type: rouge
38
- value: 0.323
39
- license: apache-2.0
40
- language:
41
- - en
42
- ---
43
-
44
- # Model Card for calc-t5-large-baseline
45
-
46
- <!-- Provide a quick summary of what the model is/does. -->
47
-
48
- This model generates reasoning chains over mathematical questions while **using an external tool: Sympy calculator**.
49
-
50
- ## Model Details
51
-
52
- ### Model Description
53
-
54
- <!-- Provide a longer summary of what this model is. -->
55
-
56
- With the idea to offload a symbolic reasoning from the stochastic language model,
57
- we train this model to utilize a calculator **for all applicable numeric operations**.
58
- This is achieved by training the model to construct calls to the tool's API in this format:
59
-
60
- ```html
61
- <gadget id="calculator">100/2</gadget> <output>50</output>
62
- ```
63
-
64
- where `<gadget>` segment triggers a call of the tool,
65
- which is subsequently served by extending model's decoder input context by adding the output of the tool within the `<output>` segment.
66
-
67
- - **Developed by:** Anonymous
68
- - **Model type:** Autoregressive Encoder-Decoder
69
- - **Language(s):** en
70
- - **Finetuned from:** google/calc-t5-large-baseline
71
-
72
- ### Model Sources
73
-
74
- <!-- Provide the basic links for the model. -->
75
-
76
- - **Repository:** https://github.com/emnlp2023/gadgets
77
- - **Paper:** Stay tuned!
78
-
79
- ## Usage
80
-
81
- Additionally to conventional generation, using Tool-augmented generation requires
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 attached **gadget_assisted_model.py** and **gadget.py** in this model's repo
86
- and the project's [home repo](https://github.com/emnlp2023/gadgets).
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
- class GadgetAssistedT5(GadgetAssistedModel, T5ForConditionalGeneration):
98
- # GadgetAssistedModel overrides the standard generate() from transformers
99
- pass
100
-
101
-
102
- model = GadgetAssistedT5.from_pretrained("emnlp2023/calc-t5-large-baseline")
103
- tokenizer = T5Tokenizer.from_pretrained("emnlp2023/calc-t5-large-baseline")
104
-
105
- model.prepare_for_generate(tokenizer,
106
- enabled_gadgets=[Calculator()],
107
- default_max_tokens=512)
108
- query = """
109
- The profit from a business transaction is shared among 2 business partners,
110
- Mike and Johnson in the ratio 2:5 respectively.
111
- If Johnson got $2500, how much will Mike have
112
- after spending some of his share on a shirt that costs $200?
113
- """
114
-
115
- inputs = tokenizer(query, return_tensors="pt")
116
- output_ids = model.generate(**inputs)
117
- tokenizer.decode(output_ids[0], spaces_between_special_tokens=False)
118
- ```
119
- This returns:
120
- ```html
121
- According to the ratio, Mike got 2/5*$2500 = $<gadget id="calculator">2/5*2500</gadget><output>1_000</output> 1000
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
127
-
128
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
129
-
130
- Note that given the limited scope of the exercises' complexity in the training, this model will not work well for tasks requiring
131
- more complex algebraic operations, including equations, variables and operations outside the scope of (+-*/).
132
-
133
- ## Training Details
134
-
135
- ### Training Data
136
-
137
- <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
138
-
139
- This model was trained on our Calculator-augmented set of [ape210k dataset github](https://github.com/Chenny0808/ape210k),
140
- [mathqa HF dataset](https://huggingface.co/datasets/math_qa),
141
- [gsm8k HF dataset](https://huggingface.co/datasets/gsm8k),
142
- [aqua_rat](https://huggingface.co/datasets/aqua_rat),
143
- in a standard auto-regressive setup i.e. for a conditional next-token prediction with teacher-forced prefix.
144
-
145
- ### Training Procedure
146
-
147
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
148
-
149
- The model was fine-tuned from [google/calc-t5-large-baseline](https://huggingface.co/google/calc-t5-large-baseline) for TODO steps
150
- aiming to maximise exact-match ration on a validation split of the questions from [gsm8k dataset](https://huggingface.co/datasets/gsm8k).
151
- We fine-tune only TODO of the parameters finding that this circumvents overfitting to relatively small training dataset.
152
-
153
- The full training configuration can be identified from the [training script](https://github.com/emnlp2023/gadgets/blob/9185d1fc4b4812321179f8e5cad3e2f2a764f1df/examples/train_gsm8k_flan-t5-slice.py).