PaddleNLP 的环境搭建与使用(windows)

安装

安装Anaconda
 

Anaconda3-2024.02-1-Windows-x86_64.exe

CUDA安装

下载地址:CUDA 工具包 - 免费工具和培训 | NVIDIA 开发者

下载安装 cuda_11.7.0_516.01_windows.exe

cuDNN安装

地址为:cuDNN Archive | NVIDIA Developer

先找到与CUDA对应的版本

cudnn-windows-x86_64-8.4.1.50_cuda11.6-archive.zip

将cuDNN目录下三个文件粘贴到CUDA的目录下

二、为paddlenlp创建虚拟环境

以下命令为创建名为”paddlenlp“ 的虚拟环境

创建命令:conda create -n paddlenlppython=3.8

激活conda环境:conda activate paddlenlp

三、安装C++编译环境
(如果你系统上已经安装了 C++ 编译环境,请忽略这一步。)

对于 Windows 系统,需要安装 Visual Studio 来完成 C++ 编译环境的安装。

下载地址:https://visualstudio.microsoft.com/visual-cpp-build-tools/

主要是Visual Studio Installer 中勾选 C++桌面开发。

勾选完成直接点继续,开始安装

安装paddlepaddle
paddlespeech依赖于paddlepaddle,我们需要先安装paddlepaddle:

CPU版

python -m pip install paddlepaddle==2.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

GPU版

python -m pip install paddlepaddle-gpu==2.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

环境依赖

  • python >= 3.8
  • paddlepaddle =  2.5.2
  • paddlenlp = 2.6.1

pip安装

pip install --upgrade paddlenlp

测试效果

通用信息抽取技术UIE

# 信息抽取
from pprint import pprint
from paddlenlp import Taskflow 
schema = ['时间', '选手', '赛事名称'] # Define the schema for entity extraction 
ie = Taskflow('information_extraction', schema=schema) 
pprint(ie("2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷爱凌以188.25分获得金牌!"))
>>>[{'时间': [{'end': 6,
          'probability': 0.9857378532924486,
          'start': 0,
          'text': '2月8日上午'}],
  '赛事名称': [{'end': 23,
            'probability': 0.8503089953268272,
            'start': 6,
            'text': '北京冬奥会自由式滑雪女子大跳台决赛'}],
  '选手': [{'end': 31,
          'probability': 0.8981548639781138,
          'start': 28,
          'text': '谷爱凌'}]}]

截图

测试效果

文本摘要

from pprint import pprint
from paddlenlp import Taskflow 
summarizer = Taskflow("text_summarization")
summarizer('2022年,中国房地产进入转型阵痛期,传统“高杠杆、快周转”的模式难以为继,万科甚至直接喊话,中国房地产进入“黑铁时代”')

截图

​​​​​​​

最后清单列表如下:

(paddlenlp) D:\>pip list

Package                  Version
------------------------ -----------
aiohttp                  3.9.5
aiosignal                1.3.1
amqp                     5.2.0
annotated-types          0.7.0
anyio                    4.4.0
asgiref                  3.8.1
astor                    0.8.1
async-timeout            4.0.3
attrs                    23.2.0
auto-labeling-pipeline   0.1.23
Babel                    2.15.0
backports.zoneinfo       0.2.1
bce-python-sdk           0.9.14
billiard                 4.2.0
blinker                  1.8.2
boto3                    1.34.132
botocore                 1.34.132
cachetools               5.3.3
celery                   5.4.0
certifi                  2024.6.2
cffi                     1.16.0
chardet                  4.0.0
charset-normalizer       3.3.2
click                    8.1.7
click-didyoumean         0.3.1
click-plugins            1.1.1
click-repl               0.3.0
colorama                 0.4.6
colorlog                 6.8.2
contourpy                1.1.1
cryptography             42.0.8
cycler                   0.12.1
datasets                 2.20.0
decorator                5.1.1
defusedxml               0.7.1
dill                     0.3.4
dj-database-url          0.5.0
dj-rest-auth             2.2.8
Django                   4.2.13
django-allauth           0.52.0
django-celery-results    2.4.0
django-cleanup           6.0.0
django-cors-headers      3.14.0
django-drf-filepond      0.5.0
django-filter            22.1
django-health-check      3.18.3
django-polymorphic       3.1.0
django-rest-polymorphic  0.1.10
django-storages          1.14.3
djangorestframework      3.15.2
djangorestframework-xml  2.0.0
dnspython                2.6.1
doccano                  1.8.4
drf-yasg                 1.21.7
email_validator          2.2.0
environs                 9.5.0
et-xmlfile               1.1.0
exceptiongroup           1.2.1
fastapi                  0.111.0
fastapi-cli              0.0.4
filelock                 3.15.4
filetype                 1.2.0
Flask                    3.0.3
flask-babel              4.0.0
flower                   1.2.0
fonttools                4.53.0
frozenlist               1.4.1
fsspec                   2024.5.0
furl                     2.1.3
future                   1.0.0
google-api-core          2.19.1
google-auth              2.30.0
google-cloud-core        2.4.1
google-cloud-storage     2.17.0
google-crc32c            1.5.0
google-resumable-media   2.7.1
googleapis-common-protos 1.63.2
greenlet                 3.0.3
gunicorn                 20.1.0
h11                      0.14.0
httpcore                 1.0.5
httptools                0.6.1
httpx                    0.27.0
huggingface-hub          0.23.4
humanize                 4.9.0
idna                     3.7
importlib_metadata       7.2.1
importlib_resources      6.4.0
inflection               0.5.1
itsdangerous             2.2.0
jieba                    0.42.1
Jinja2                   3.1.4
jmespath                 1.0.1
joblib                   1.4.2
kiwisolver               1.4.5
kombu                    5.3.7
lml                      0.1.0
markdown-it-py           3.0.0
MarkupSafe               2.1.5
marshmallow              3.21.3
matplotlib               3.7.5
mdurl                    0.1.2
multidict                6.0.5
multiprocess             0.70.12.2
numpy                    1.24.4
oauthlib                 3.2.2
onnx                     1.16.1
openpyxl                 3.1.4
opt-einsum               3.3.0
orderedmultidict         1.0.1
orjson                   3.10.5
packaging                24.1
paddle2onnx              1.0.6
paddlefsl                1.1.0
paddlenlp                2.6.1
paddlepaddle             2.5.2
paddlepaddle-gpu         2.5.2
pandas                   1.5.3
pillow                   10.3.0
pip                      24.0
prometheus_client        0.20.0
prompt_toolkit           3.0.47
proto-plus               1.24.0
protobuf                 3.20.2
psutil                   6.0.0
pyarrow                  16.1.0
pyarrow-hotfix           0.6
pyasn1                   0.6.0
pyasn1_modules           0.4.0
pycparser                2.22
pycryptodome             3.20.0
pydantic                 2.7.4
pydantic_core            2.18.4
pyexcel                  0.7.0
pyexcel-io               0.6.6
pyexcel-xlsx             0.6.0
Pygments                 2.18.0
PyJWT                    2.8.0
pyparsing                3.1.2
pypinyin                 0.51.0
python-dateutil          2.9.0.post0
python-dotenv            1.0.1
python-multipart         0.0.9
python3-openid           3.2.0
pytz                     2024.1
PyYAML                   6.0.1
rarfile                  4.2
requests                 2.32.3
requests-oauthlib        2.0.0
rich                     13.7.1
rsa                      4.9
s3transfer               0.10.2
safetensors              0.4.3
scikit-learn             1.3.2
scipy                    1.10.1
sentencepiece            0.2.0
seqeval                  1.2.2
setuptools               69.5.1
shellingham              1.5.4
shortuuid                1.0.13
six                      1.16.0
sniffio                  1.3.1
SQLAlchemy               1.4.52
sqlparse                 0.5.0
starlette                0.37.2
texttable                1.7.0
threadpoolctl            3.5.0
tornado                  6.4.1
tqdm                     4.66.4
typer                    0.12.3
typing_extensions        4.12.2
tzdata                   2024.1
ujson                    5.10.0
uritemplate              4.1.1
urllib3                  1.26.19
uvicorn                  0.30.1
vine                     5.1.0
visualdl                 2.5.3
waitress                 2.1.2
watchfiles               0.22.0
wcwidth                  0.2.13
websockets               12.0
Werkzeug                 3.0.3
wheel                    0.43.0
whitenoise               6.7.0
xxhash                   3.4.1
yarl                     1.9.4
zipp                     3.19.2
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值