Views
No views yet
batch_size = 32
n_epochs = 3
base_LM_model = "batterybert-uncased"
max_seq_len = 386
learning_rate = 3e-5
doc_stride=128
max_query_length=64"exact": 81.08,
"f1": 88.41,"precision": 68.27,
"recall": 80.88,1from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
2
3model_name = "batterydata/batterybert-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