Views
No views yet
1# 初始化pipeline
2from transformers import pipeline
3question_answerer = pipeline(
4 "question-answering",
5 model="guo1006/bert-finetuned-squad-accelerate"
6)
7
8# 上下文
9context = """
10🤗 Transformers is backed by the three most popular deep learning libraries —
11Jax, PyTorch and TensorFlow — with a seamless integration between them.
12It's straightforward to train your models with one before loading them
13for inference with the other.
14"""
15
16# 提问
17question = "Which deep learning libraries back 🤗 Transformers?"
18
19# 推理
20result = question_answerer(question=question, context=context)
21
22# 输出结果
23print(result)