This repository contains our best model for ARQMath 3, the math_10 model. It was initialised from ALBERT-base-v2 and further pre-trained on Math StackExchange in three different stages. We also added more LaTeX tokens to the tokenizer to enable a better tokenization of mathematical formulas. math_10 was fine-tuned on a classification task to determine whether a given question (sequence 1) matches a given answer (sequence 2). The classification output can be used for ranking the best answers. For further details, please read our paper:
http://ceur-ws.org/Vol-3180/paper-07.pdf
.
Other Models for ARQMath 3
We plan on also publishing the other fine-tuned models as well as the base models. Links to these repositories will be added here soon.
We have also further pre-trained a BERT-base-cased model in the same way as our ALBERT model. You can find it here:
AnReu/math_pretrained_bert
.
Usage
# based on https://huggingface.co/docs/transformers/main/en/task_summary#sequence-classificationfrom transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("AnReu/albert-for-arqmath-3")
model = AutoModelForSequenceClassification.from_pretrained("AnReu/albert-for-arqmath-3")
classes = ["non relevant", "relevant"]
sequence_0 = "How can I calculate x in $3x = 5$"
sequence_1 = "Just divide by 3: $x = \\frac{5}{3}$"
sequence_2 = "The general rule for squaring a sum is $(a+b)^2=a^2+2ab+b^2$"# The tokenizer will automatically add any model specific separators (i.e. <CLS> and <SEP>) and tokens to# the sequence, as well as compute the attention masks.
irrelevant = tokenizer(sequence_0, sequence_2, return_tensors="pt")
relevant = tokenizer(sequence_0, sequence_1, return_tensors="pt")
irrelevant_classification_logits = model(**irrelevant).logits
relevant_classification_logits = model(**relevant).logits
irrelevant_results = torch.softmax(irrelevant_classification_logits, dim=1).tolist()[0]
relevant_results = torch.softmax(relevant_classification_logits, dim=1).tolist()[0]
# Should be irrelevantfor i inrange(len(classes)):
print(f"{classes[i]}: {int(round(irrelevant_results[i] * 100))}%")
# Should be relevantfor i inrange(len(classes)):
print(f"{classes[i]}: {int(round(relevant_results[i] * 100))}%")
Citation
If you find this model useful, consider citing our paper:
@article{reusch2022transformer,
title={Transformer-Encoder and Decoder Models for Questions on Math},
author={Reusch, Anja and Thiele, Maik and Lehner, Wolfgang},
year={2022},
organization={CLEF}
}
Runs of AnReu albert-for-arqmath-3 on huggingface.co
1.3K
Total runs
-21
24-hour runs
-24
3-day runs
50
7-day runs
953
30-day runs
More Information About albert-for-arqmath-3 huggingface.co Model
albert-for-arqmath-3 huggingface.co
albert-for-arqmath-3 huggingface.co is an AI model on huggingface.co that provides albert-for-arqmath-3's model effect (), which can be used instantly with this AnReu albert-for-arqmath-3 model. huggingface.co supports a free trial of the albert-for-arqmath-3 model, and also provides paid use of the albert-for-arqmath-3. Support call albert-for-arqmath-3 model through api, including Node.js, Python, http.
albert-for-arqmath-3 huggingface.co is an online trial and call api platform, which integrates albert-for-arqmath-3's modeling effects, including api services, and provides a free online trial of albert-for-arqmath-3, you can try albert-for-arqmath-3 online for free by clicking the link below.
AnReu albert-for-arqmath-3 online free url in huggingface.co:
albert-for-arqmath-3 is an open source model from GitHub that offers a free installation service, and any user can find albert-for-arqmath-3 on GitHub to install. At the same time, huggingface.co provides the effect of albert-for-arqmath-3 install, users can directly use albert-for-arqmath-3 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
albert-for-arqmath-3 install url in huggingface.co: