解决cannot import name ‘DEFAULT_CIPHERS‘ from ‘urllib3.util.ssl_‘

解决cannot import name ‘DEFAULT_CIPHERS’ from ‘urllib3.util.ssl_’

一、问题

  • 运行代码报错如下
{FileNotFoundError}[WinEFailed to import transformers.integrations.peft because of the following error (look up to see its traceback):
cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_' (/home/ma-user/anaconda3/envs/PyTorch-2.0.0/lib/python3.9/site-packages/urllib3/util/ssl_.py)rror 2] 系统找不到指定的文件

二、代码

  • 经定位发现如下代码抛出异常。
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=now_torch_type,trust_remote_code=True).to("cuda").eval()

三、原因及解决方法

  • 原因:urllib3版本兼容性问题。

  • 解决方法:

    pip uninstall urllib3
    pip install urllib3
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值