赞
踩
视频链接:https://www.bilibili.com/video/BV1Sd4y1v7hb/?spm_id_from=333.999.0.0&vd_source=7a32fe7f80f09236fc113c9c6bde1c81
conda create -n transformer python=3.8.10
conda activate transformer
先使用第一种,若成功则跳到第三步
pip3 install farm-haystack -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install vit-pytorch -i https://pypi.tuna.tsinghua.edu.cn/simple
若失败,则使用以下命令
conda install -c huggingface transformers
from transformers import pipeline
nlp = pipeline("question-answering")
context = "Extractive Question Answering is the task of extracting an answer from a text given a question. An example of a question answering dataset is the SQuAD dataset, which is entirely based on that task. If you would like to fine-tune a model on a SQuAD task, you may leverage the `run_squad.py`."
print(nlp(question="What is extractive question answering?", context=context))
print(nlp(question="What is a good example of a question answering dataset?", context=context))
若输出如下结果,则安装正确
错误一
RuntimeError: Failed to import transformers.pipelines because of the following error (look up to see its traceback):
libssl.so.10: cannot open shared object file: No such file or directory
解决方案:
pip3 install farm-haystack
https://github.com/lucidrains/vit-pytorch
conda remove -n transformer --all
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。