PaddleNLP的环境配置:

PaddleNLP的环境配置:

conda create -n paddle—test python=3.9
conda activate  paddle—test

在这里插入图片描述

python -m pip install paddlepaddle-gpu==2.6.1.post112 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
(paddle—test) (venv) PS D:\work\论文写作\邮件\PaddleNLP-develop> python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from paddlenlp.transformers import AutoTokenizer, AutoModelForCausalLM
D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\_distutils_hack\__init__.py:36: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
>>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-0.5B")
[2024-11-19 15:48:45,051] [    INFO] - The `unk_token` parameter needs to be defined: we use `eos_token` by default.
>>> model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-0.5B", dtype="float16")
[2024-11-19 15:48:51,240] [    INFO] - We are using <class 'paddlenlp.transformers.qwen2.modeling.Qwen2ForCausalLM'> to load 'Qwen/Qwen2-0.5B'.
[2024-11-19 15:48:51,241] [    INFO] - Loading configuration file C:\Users\Win11\.paddlenlp\models\Qwen/Qwen2-0.5B\config.json
[2024-11-19 15:48:51,241] [    INFO] - Loading weights file from cache at C:\Users\Win11\.paddlenlp\models\Qwen/Qwen2-0.5B\model.safetensors
[2024-11-19 15:48:55,345] [    INFO] - Loaded weights file from disk, setting weights to model.
W1119 15:48:56.299374 25568 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 12.6, Runtime API Version: 11.2
W1119 15:48:56.797859 25568 dynamic_loader.cc:285] Note: [Recommend] copy cudnn into CUDA installation directory. 
 For instance, download cudnn-10.0-windows10-x64-v7.6.5.32.zip from NVIDIA's official website,
then, unzip it and copy it into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
You should do this according to your CUDA installation directory and CUDNN version.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\work\论文写作\邮件\PaddleNLP-develop\paddlenlp\transformers\auto\modeling.py", line 794, in from_pretrained
    return cls._from_pretrained(pretrained_model_name_or_path, *model_args, **kwargs)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\paddlenlp\transformers\auto\modeling.py", line 342, in _from_pretrained
    return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, **kwargs)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\paddlenlp\transformers\model_utils.py", line 2463, in from_pretrained
    model = cls(config, *init_args, **model_kwargs)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\paddlenlp\transformers\utils.py", line 289, in __impl__
    init_func(self, *args, **kwargs)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\paddlenlp\transformers\qwen2\modeling.py", line 1242, in __init__
    self.qwen2 = Qwen2Model(config)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\paddlenlp\transformers\utils.py", line 289, in __impl__
    init_func(self, *args, **kwargs)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\paddlenlp\transformers\qwen2\modeling.py", line 897, in __init__
    self.embed_tokens = nn.Embedding(
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\nn\layer\common.py", line 1496, in __init__
    self.weight = self.create_parameter(
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\nn\layer\layers.py", line 781, in create_parameter
    return self._helper.create_parameter(
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\layer_helper_base.py", line 430, in create_parameter
    return self.main_program.global_block().create_parameter(
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\framework.py", line 4381, in create_parameter
    initializer(param, self)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\nn\initializer\initializer.py", line 40, in __call__
    return self.forward(param, block)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\nn\initializer\xavier.py", line 135, in forward
    out_var = _C_ops.uniform(
RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_8.dll) that Paddle depends on is not configured correctly. (error code is 126)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:312)

在这里插入图片描述

import paddle
paddle.utils.run_check()
(paddle—test) (venv) PS D:\work\论文写作\邮件\PaddleNLP-develop> python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
I1119 15:56:13.232272 21360 program_interpreter.cc:212] New Executor is Running.
W1119 15:56:13.264072 21360 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 12.6, Runtime API Version: 11.2
W1119 15:56:13.264580 21360 dynamic_loader.cc:285] Note: [Recommend] copy cudnn into CUDA installation directory.
 For instance, download cudnn-10.0-windows10-x64-v7.6.5.32.zip from NVIDIA's official website,
then, unzip it and copy it into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
You should do this according to your CUDA installation directory and CUDNN version.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\utils\install_check.py", line 273, in run_check
    _run_static_single(use_cuda, use_xpu, use_custom, custom_device_name)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\utils\install_check.py", line 150, in _run_static_single
    exe.run(startup_prog)
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\executor.py", line 1746, in run
    res = self._run_impl(
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\executor.py", line 1952, in _run_impl
    ret = new_exe.run(
  File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\executor.py", line 831, in run
    tensors = self._new_exe.run(
RuntimeError: In user code:

    File "<stdin>", line 1, in <module>

    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\utils\install_check.py", line 273, in run_check
      _run_static_single(use_cuda, use_xpu, use_custom, custom_device_name)
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\utils\install_check.py", line 135, in _run_static_single
      input, out, weight = _simple_network()
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\utils\install_check.py", line 31, in _simple_network
      weight = paddle.create_parameter(
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\tensor\creation.py", line 228, in create_parameter
      return helper.create_parameter(
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\layer_helper_base.py", line 444, in create_parameter
      self.startup_program.global_block().create_parameter(
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\framework.py", line 4381, in create_parameter
      initializer(param, self)
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\nn\initializer\initializer.py", line 40, in __call__
      return self.forward(param, block)
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\nn\initializer\constant.py", line 84, in forward
      op = block.append_op(
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\framework.py", line 4467, in append_op
      op = Operator(
    File "D:\work\论文写作\邮件\PaddleNLP-develop\venv\lib\site-packages\paddle\base\framework.py", line 3016, in __init__
      for frame in traceback.extract_stack():

    PreconditionNotMetError: The third-party dynamic library (cudnn64_8.dll) that Paddle depends on is not configured correctly. (error code is 126)
      Suggestions:
      1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
      2. Configure third-party dynamic library environment variables as follows:
      - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
      - Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:312)
      [operator < fill_constant > error]
>>>

更换版本

在这里插入图片描述

#python -m pip install paddlepaddle-gpu==2.6.1.post112 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/

(paddle—test) (venv) PS D:\work\论文写作\邮件\PaddleNLP-develop> python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ... 
I1119 16:00:49.811331 25164 program_interpreter.cc:243] New Executor is Running.
W1119 16:00:49.811331 25164 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 12.6, Runtime API Version: 12.3
W1119 16:00:49.812327 25164 gpu_resources.cc:164] device: 0, cuDNN Version: 9.0.
I1119 16:00:50.964934 25164 interpreter_util.cc:648] Standalone Executor is Used.
PaddlePaddle works well on 1 GPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.
>>>

>>> from paddlenlp.transformers import AutoTokenizer, AutoModelForCausalLM           
>>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-0.5B")                     
[2024-11-19 16:05:28,468] [    INFO] - The `unk_token` parameter needs to be defined: we use `eos_token` by default.
>>> model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-0.5B", dtype="float16")
[2024-11-19 16:05:36,929] [    INFO] - We are using <class 'paddlenlp.transformers.qwen2.modeling.Qwen2ForCausalLM'> to load 'Qwen/Qwen2-0.5B'.
[2024-11-19 16:05:36,929] [    INFO] - Loading configuration file C:\Users\Win11\.paddlenlp\models\Qwen/Qwen2-0.5B\config.json
[2024-11-19 16:05:36,934] [    INFO] - Loading weights file from cache at C:\Users\Win11\.paddlenlp\models\Qwen/Qwen2-0.5B\model.safetensors
[2024-11-19 16:05:39,705] [    INFO] - Loaded weights file from disk, setting weights to model.
[2024-11-19 16:05:49,260] [    INFO] - All model checkpoint weights were used when initializing Qwen2ForCausalLM.

[2024-11-19 16:05:49,260] [ WARNING] - Some weights of Qwen2ForCausalLM were not initialized from the model checkpoint at Qwen/Qwen2-0.5B and are newly initialized: ['lm_head.weight']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
[2024-11-19 16:05:49,261] [    INFO] - Loading configuration file C:\Users\Win11\.paddlenlp\models\Qwen/Qwen2-0.5B\generation_config.json
>>> input_features = tokenizer("你好!请自我介绍一下。", return_tensors="pd")        
>>> outputs = model.generate(**input_features, max_length=128)
>>> print(tokenizer.batch_decode(outputs[0], skip_special_tokens=True))
[' 我是一个AI语言模型,我可以回答各种问题,包括但不限于:天气、新闻、历史、文化、科学、教育、娱乐等。请问您有什么需要了解的吗?']
>>>
`

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/919379.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【MySQL实战45讲笔记】基础篇——redo log 和 binlog

系列文章 基础篇——MySQL 的基础架构 目录 系列文章1. 重要的日志模块&#xff1a;redo log 和 binlog1.1 redo log1.2 binlog1.3 执行器和 InnoDB 引擎内部如何执行更新语句 1. 重要的日志模块&#xff1a;redo log 和 binlog 前面系统的了解了一个查询语句的执行流程&…

MATLAB常见数学运算函数

MATLAB中含有许多有用的函数,可以随时调用。 a b s abs abs函数 a b s abs abs函数在MATLAB中可以求绝对值,也可以求复数的模长:c e i l ceil ceil函数 向正无穷四舍五入(如果有小数,就向正方向进一)f l o o r floor floor函数 向负无穷四舍五入(如果有小数,就向负方向…

MySQL无开通SQL全审计下的故障分析方法

几年前MySQL数据库出现突然的从库延迟故障和CPU爆高时&#xff0c;如何排查具体原因&#xff0c;可能说已在腾讯云的MySQL库里开启了SQL全审计&#xff0c;记录了全部执行的SQL&#xff0c;再通过下面的方法就可以很容易找到原因&#xff1a; 1&#xff0c;实用QPS和TPS高的高效…

新手教学系列——善用 VSCode 工作区,让开发更高效

引言 作为一名开发者,你是否曾经在项目中频繁地切换不同文件夹,打开无数个 VSCode 窗口?特别是当你同时参与多个项目或者处理多个模块时,这种情况更是家常便饭。很快,你的任务栏上挤满了 VSCode 的小图标,切换起来手忙脚乱,工作效率直线下降。这时候,你可能会问:“有…

React(一)

文章目录 项目地址一、创建第一个react项目二、JSX语法2.1 生成列表2.2 大括号识别JS的表达式2.3 列表循环array2.4 条件判断以及假值显示2.5 复杂条件渲染2.6 事件监听和绑定2.7 使用Fregments返回多个根标签2.8 多条件渲染2.9 导出子组件 三、组件3.1 设置组件3.2 props给子组…

微服务安全Spring Security Oauth2实战_spring-security-oauth2-authorization-server

Spring Authorization Server 是什么 Spring Authorization Server 是一个框架&#xff0c;它提供了 OAuth 2.1 和 OpenID Connect 1.0 规范以及其他相关规范的实现。它建立在 Spring Security 之上&#xff0c;为构建 OpenID Connect 1.0 身份提供者和 OAuth2 授权服务器产品…

多线程-02-多线程的典型应用(异步调用和提高效率)

一、怎么理解异步和同步 从方法的角度去理解&#xff1a; 需要等待结果返回&#xff0c;才能继续运行就是同步不需要等待结果返回&#xff0c;就能继续运行就是异步 注意&#xff1a;同步在多线程中还有另外一层意思&#xff1a;是让多个线程步调一致。 同步调用 同步调用…

【数据分享】中国汽车工业年鉴(1986-2023)

本年鉴是由工业和信息化部指导&#xff0c;中国汽车技术研究中心有限公司与中国汽车工业协会联合主办。《年鉴》是全面、客观记载中国汽车工业发展与改革历程的重要文献&#xff0c;内容涵盖汽车产业政策、标准、企业、市场以及全国各省市汽车工业发展情况&#xff0c;并调查汇…

Matlab实现北方苍鹰优化算法优化随机森林算法模型 (NGO-RF)(附源码)

目录 1.内容介绍 2.部分代码 3.实验结果 4.内容获取 1内容介绍 北方苍鹰优化算法&#xff08;Northern Goshawk Optimization, NGO&#xff09;是一种新颖的群智能优化算法&#xff0c;灵感源自北方苍鹰捕食时的策略。该算法通过模拟苍鹰的搜寻、接近和捕捉猎物的行为模式&am…

CentOS使用中遇到的问题及解决方法

一、CentOS 7网络配置&#xff08;安装后无法联网问题&#xff09; 现象说明 在安装CentOS系统后&#xff0c;有可能出现无法联网的问题&#xff0c;虚拟机中的网络配置并没有问题&#xff0c;而系统却无法联网,也ping不通。 原因描述 CentOS默认开机不启动网络&#xff0c;因…

QT基础 UI编辑器 QT5.12.3环境 C++环境

一、UI编辑器 注意&#xff1a;创建工程时&#xff0c;要勾上界面按钮 UI设计师界面的模块 UI编辑器会在项目构建目录中自动生成一个ui_xxx.h&#xff08;构建一次才能生成代码&#xff09;&#xff0c;来表示ui编辑器界面的代码&#xff0c;属于自动生成的&#xff0c;一定不…

数据分析-Excel基础操作

目录 周报讲解 基础概念 理解数据 筛选excel表 数据透视表 插入数据透视表 新建字段 切片器&#xff08;筛选&#xff09; 数据透视图 Excel常用函数 sum&#xff08;求和&#xff09; 1-8月GMV 1月和8月GMV sumif&#xff08;条件求和&#xff09; sumifs 日G…

OpenCV双目立体视觉重建

本篇文章主要给出使用opencv sgbm重建三维点云的代码&#xff0c;鉴于自身水平所限&#xff0c;如有错误&#xff0c;欢迎批评指正。 环境&#xff1a;vs2015 &#xff0c;opencv3.4.6&#xff0c;pcl1.8.0 原始数据使用D455采集&#xff0c;图像已做完立体校正&#xff0c;如下…

Clip结合Faiss+Flask简易版文搜图服务

一、实现 使用目录结构&#xff1a; templates ---upload.html faiss_app.py 前端代码&#xff1a;upload.html <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content&quo…

Linux驱动开发快速入门——字符设备驱动(直接操作寄存器设备树版)

Linux驱动开发快速入门——字符设备驱动 前言 笔者使用开发板型号&#xff1a;正点原子的IMX6ULL-alpha开发板。ubuntu版本为&#xff1a;20.04。写此文也是以备忘为目的。 字符设备驱动 本小结将以直接操作寄存器的方式控制一个LED灯&#xff0c;可以通过read系统调用可以…

概念解读|K8s/容器云/裸金属/云原生...这些都有什么区别?

随着容器技术的日渐成熟&#xff0c;不少企业用户都对应用系统开展了容器化改造。而在容器基础架构层面&#xff0c;很多运维人员都更熟悉虚拟化环境&#xff0c;对“容器圈”的各种概念容易混淆&#xff1a;容器就是 Kubernetes 吗&#xff1f;容器云又是什么&#xff1f;容器…

《机器人控制器设计与编程》考试试卷**********大学2024~2025学年第(1)学期

消除误解&#xff0c;课程资料逐步公开。 复习资料&#xff1a; Arduino-ESP32机器人控制器设计练习题汇总_arduino编程语言 题-CSDN博客 试卷样卷&#xff1a; 开卷考试&#xff0c;时间&#xff1a; 2024年11月16日 001 002 003 004 005 ……………………装………………………

本地音乐服务器(三)

6. 删除音乐模块设计 6.1 删除单个音乐 1. 请求响应设计 2. 开始实现 首先在musicmapper新增操作 Music findMusicById(int id);int deleteMusicById(int musicId); 其次新增相对应的.xml代码&#xff1a; <select id"findMusicById" resultType"com.exa…

如何在项目中用elementui实现分页器功能

1.在结构部分复制官网代码&#xff1a; <template> 标签: 这是 Vue 模板的根标签&#xff0c;包含所有的 HTML 元素和 Vue 组件。 <div> 标签: 这是一个普通的 HTML 元素&#xff0c;包裹了 el-pagination 组件。它没有特别的意义&#xff0c;只是为了确保 el-pagi…

VB.Net笔记-更新ing

1.1 设置默认VS的开发环境为VB.NET&#xff08;2024/11/18&#xff09; 1.2 新建一个“Hello&#xff0c;world”的窗体&#xff08;2024/11/18&#xff09; 1.3 计算圆面积的小程序&#xff08;2024/11/18&#xff09; 显示/隐式 声明 &#xff08;2024/11/18&#xff0…