Views
No views yet
batch_size = 32
n_epochs = 2
base_LM_model = "bert-base-cased"
max_seq_len = 386
learning_rate = 5e-5
doc_stride=128
max_query_length=64"exact": 81.30,
"f1": 88.58,"precision": 67.02,
"recall": 80.15,1from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
2
3model_name = "batterydata/bert-base-cased-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