成功解决:http.client.RemoteDisconnected: Remote end closed connection without response
运行程序超时,有时可以正常运行,有时候显示如下错误:
http.client.RemoteDisconnected: Remote end closed connection without response
。
(virtual) lihuanyu@ubuntu-NF5468M5:~/code/03AdaBins$ python infer.py
Loading base model ()...Traceback (most recent call last):
File "infer.py", line 175, in <module>
inferHelper = InferenceHelper()
File "infer.py", line 75, in __init__
model = UnetAdaptiveBins.build(n_bins=256, min_val=self.min_depth, max_val=self.max_depth)
File "/home/lihuanyu/code/03AdaBins/models/unet_adaptive_bins.py", line 125, in build
basemodel = torch.hub.load('rwightman/gen-efficientnet-pytorch', basemodel_name, pretrained=True)
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/site-packages/torch/hub.py", line 397, in load
repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose, skip_validation)
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/site-packages/torch/hub.py", line 165, in _get_cache_or_reload
repo_owner, repo_name, branch = _parse_repo_info(github)
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/site-packages/torch/hub.py", line 119, in _parse_repo_info
with urlopen(f"https://github.com/{repo_owner}/{repo_name}/tree/main/"):
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/urllib/request.py", line 1392, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/urllib/request.py", line 1352, in do_open
r = h.getresponse()
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/http/client.py", line 1379, in getresponse
response.begin()
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/http/client.py", line 311, in begin
version, status, reason = self._read_status()
File "/home/lihuanyu/.conda/envs/virtual/lib/python3.6/http/client.py", line 280, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
basemodel_name = 'tf_efficientnet_b5_ap'
print('Loading base model ()...'.format(basemodel_name), end='')
basemodel = torch.hub.load('rwightman/gen-efficientnet-pytorch', basemodel_name, pretrained=True)
问题分析:加载模型可能是由于网络问题,导致与训练权重难以下载,从而失败。
torch.hub.load('rwightman/gen-efficientnet-pytorch', basemodel_name, pretrained=True)
通过远程访问github进行权重和网络模型的加载(有时候是可以成功的):
basemodel = torch.hub.load('rwightman/gen-efficientnet-pytorch', 'tf_efficientnet_b5_ap', pretrained=True)
将加载的权重和模型离线另存:
torch.save(basemodel,"/home/lihuanyu/code/03AdaBins/weight/tf_efficientnet_b5_ap.pth")
最后再加载保存的离线模型和权重即可:
basemodel_name = 'tf_efficientnet_b5_ap'
print('Loading base model ()...'.format(basemodel_name), end='')
#basemodel = torch.hub.load('rwightman/gen-efficientnet-pytorch', basemodel_name, pretrained=True)
### 2023年4月7号 修改
basemodel = torch.load("/home/lihuanyu/code/03AdaBins/weight/tf_efficientnet_b5_ap.pth") #2023年
basemodel.eval()
更多内容请关注: [安静到无声的博客]
解决docker拉取镜像报错:Error response from daemon: Get “https://registry-1.docker.io/v2/“: net/http: request
问题故障显示:[root@201-226 dootask]# docker run -it -d --init --name kimi-free-api -p 8000:8000 -e TZ=Asia/Shanghai vinlic/kimi-free-api:latestUnable to find image 'vinlic/kimi-free-api:latest' locallydocke
【Bug解决】requests.exceptions.ReadTimeout &http.client.RemoteDisconnected: Remote end closed connection
记录爬虫实践中一个小bug:requests.exceptions.ReadTimeout出问题的原始代码片段
Error (ProtocolError(‘Connection aborted.‘, RemoteDisconnected(‘Remote end closed connection without
我本来在爬取weibo,于是就给我报错了如下:Error (ProtocolError('Connection aborted.',
requests.exceptions.ConnectionError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed c
# 随机切换User-Agent:# 在爬虫中报如下的错误:requests.exceptions.ConnectionError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’,))user_agent_list = [ "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, lik.
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response解决方案
一、背景可能大家在使用Spring Cloud Gateway构建微服务网关的时候,过五关斩六将,Reactor没能难倒我们,链路追踪没能难倒我们,最后在上线之后发现许多奇妙的问题,这些奇妙的问题还无从下手,比如这个堆栈,深入使用过SCG的人一定不会陌生: reactor.netty.http.cl
Closed socket connection for client /39.103.162.230:56100 (no session established for client)
文章目录个人简介正文一、业务场景二、错误日志三、解决方案总结一键三连给读者大大的话博客封面leetCode刷题Idea软件安装包以及破解教程Git&SVN软件安装包以及配置教程面试资料200套PPT模板提问的智慧Java开发学习路线个人简介我是廖志伟,一名Java开发工程师,CSDN博客专家,Java领域优质创作者
freeswitch在centos7编译
FreeSwitch 1.10 源码安装参考官方文档:https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7[TOC]一、环境操作系统:CentOS 7.6.1801
FreeSwitch版本:v1.10
二、初始设置关闭防火墙关闭 SELinux三、安装依赖软件包 # yum install -y htt