Views
No views yet
batch_size = 32
n_epochs = 3
base_LM_model = "bert-base-uncased"
max_seq_len = 386
learning_rate = 3e-5
doc_stride=128
max_query_length=64"exact": 80.93,
"f1": 88.20,"precision": 62.19,
"recall": 75.00,1from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
2
3model_name = "batterydata/bert-base-uncased-squad-v1"
4# a) Get predictions
5nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
6QA_input = {
7 'question': 'What is the electrolyte?',
8 'context': 'The typical non-aqueous electrolyte for commercial Li-ion cells is a solution of LiPF6 in linear and cyclic carbonates.'
9}
10res = nlp(QA_input)
11# b) Load model & tokenizer
12model = AutoModelForQuestionAnswering.from_pretrained(model_name)
13tokenizer = AutoTokenizer.from_pretrained(model_name)sh2009 [at] cam.ac.ukjmc61 [at] cam.ac.uk