Downloads · 30 days
5
12% of all-time downloads
Tien-THM/bert-mini-fine-tuning-squad
bert-mini-fine-tuning-squad is a question answering model from Tien-THM. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as mit.
This modelcard aims to be a base template for new models. It has been generated using this raw template. Question-answer model in SQUAD dataset
Downloads · 30 days
5
12% of all-time downloads
All-time downloads
43
Public
Repo size
44.5 MB
Likes
0
Public
Click a slice to open those files.
.h544.5 MB · 98%
From the Hugging Face model README
This modelcard aims to be a base template for new models. It has been generated using this raw template.
Question-answer model in SQUAD dataset
Use the code below to get started with the model.
# Load model directly
from transformers import AutoTokenizer, TFAutoModelForQuestionAnswering
tokenizer = AutoTokenizer.from_pretrained("Tien-THM/bert-mini-fine-tuning-squad")
model = TFAutoModelForQuestionAnswering.from_pretrained("Tien-THM/bert-mini-fine-tuning-squad")
import numpy as np
def Inference(context, question):
encoding = tokenizer(context, question, return_tensors='tf')
start_pos = model(encoding).start_logits
end_pos = model(encoding).end_logits
s = np.argmax(start_pos[0])
e = np.argmax(end_pos[0])
print(tokenizer.decode(encoding['input_ids'][0][s:e+1]))
question = 'How many layes does BERT-large have'
context = 'BERT-large is really big... it has 24-layers and an embedding size
of 1,024, for a total of 340M parameters! Altogether it is 1.34GB, so
expect it to take a couple minutes to download to your Colab instance'
Inference(context, question)
# Answer: 24 - layers and an em ##bed ##ding size of 1 , 02 ##4
Using 2 datasets:
| Epoch | Train loss | Validation loss | Exact Match |
|---|---|---|---|
| #1 | 4.7110 | 3.6251 | 0.38 |
| #2 | 3.2650 | 3.3062 | 0.42 |
| #3 | 2.7899 | 3.2184 | 0.44 |
| #4 | 2.4633 | 3.1946 | 0.45 |