文章目录
- 一、问题的提出
- 二、问题的尝试解决
一、问题的提出
在我们之前的拉取中,速度可能比较慢,例如,我们要拉取CLIP的项目。
(ldm) root@I1385efcc2300601b29:/hy-tmp/latent-diffusion# pip install git+https://github.com/openai/CLIP.git
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting git+https://github.com/openai/CLIP.git
Cloning https://github.com/openai/CLIP.git to /tmp/pip-req-build-d7uywl1j
我们拉取失败!如下图所示:
我们尝试新的方法:
(ldm) root@I1385efcc2300601b29:/hy-tmp/latent-diffusionpip install https://github.com/openai/CLIP.git
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting https://github.com/openai/CLIP.git
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x14942d02a760>, 'Connection to github.com timed out. (connect timeout=15)')': /openai/CLIP.git
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='github.com', port=443): Read timed out. (read timeout=15)")': /openai/CLIP.git
这个错误表明在尝试从 GitHub 下载文件时,连接超时导致读取操作无法完成。这可能是由于网络连接不稳定或GitHub服务器响应缓慢所致。解决这个问题的方法可以尝试以下几点:
- 重试:由于连接超时可能是暂时的问题,你可以尝试多次重新运行相同的下载操作,看是否能够成功。可以在不同的时间段进行尝试,以确定是否存在临时的网络问题。
- 检查网络连接:确保你的网络连接稳定,并且没有防火墙或其他安全设置阻止你与 GitHub 建立连接。你可以尝试通过访问其他网站或使用其他网络连接来确认问题是否与你的网络有关。
- 更改下载工具或库:如果你使用的是特定的下载工具或库进行文件下载,可以尝试切换到其他工具或库,以查看是否能够解决连接超时的问题。不同的工具可能有不同的网络设置或策略,可能会对连接进行更好的管理。
- 联系 GitHub 支持:如果问题仍然存在,你可以尝试联系 GitHub 支持团队,向他们报告问题并寻求进一步的帮助。他们可能能够提供更详细的指导和解决方案,以解决你遇到的特定问题。
请注意,GitHub 的服务器响应速度可能会受到多种因素的影响,包括你所在的地理位置、当前的网络流量等等。因此,在下载过程中出现连接超时错误可能是正常情况,尤其在访问较大文件或高峰期时更常见。持续遇到这个问题的话,你可以尝试结合以上提到的方法来解决。
二、问题的尝试解决
当你尝试从官方仓库下载文件时,有时可能会遇到下载速度过慢的问题。在这种情况下,你可以尝试使用代理服务来加速下载过程。其中一个常用的代理服务是 ghproxy(https://ghproxy.com/)。
ghproxy 是一个 GitHub 代理服务,它可以帮助你从 GitHub 上的仓库下载文件并提供更快的下载速度。以下是使用 ghproxy 下载文件的详细步骤:
- 打开 ghproxy 的网站:https://ghproxy.com/。
- 在 ghproxy 的主页上,你将看到一个输入框。在输入框中,粘贴或输入你想要下载的文件的 GitHub 链接。例如,你可以输入类似
https://github.com/username/repository/raw/branch/filename
的链接,其中 username 是仓库所有者的用户名,repository 是仓库名称,branch 是分支名称,filename 是文件名。 - 点击网页上的 “Go” 按钮,ghproxy 将会开始处理你的请求并尝试从指定的 GitHub 链接下载文件。
- 如果一切顺利,ghproxy 会返回一个带有下载链接的页面。你可以点击该链接来下载文件。由于 ghproxy 会缓存文件,这可能会导致初始请求的响应时间较长,但在之后的请求中下载速度会更快。
通过使用 ghproxy,你可以借助它的代理服务来提高从 GitHub 下载文件的速度。请注意,ghproxy 是一个第三方服务,不受 GitHub 官方控制,因此使用它时需要谨慎。确保你信任 ghproxy,并在下载敏感文件或与安全相关的内容时谨慎行事。
我尝试新的下载:
pip install git+https://ghproxy.com/https://github.com/openai/CLIP.git
我们的运行结果为:
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting git+https://ghproxy.com/https://github.com/openai/CLIP.git
Cloning https://ghproxy.com/https://github.com/openai/CLIP.git to /tmp/pip-req-build-_hwzd0ax
Requirement already satisfied: tqdm in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from clip==1.0) (4.65.0)
Requirement already satisfied: torch in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from clip==1.0) (2.0.1)
Requirement already satisfied: torchvision in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from clip==1.0) (0.8.1)
Collecting ftfy
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e1/1e/bf736f9576a8979752b826b75cbd83663ff86634ea3055a766e2d8ad3ee5/ftfy-6.1.1-py3-none-any.whl (53 kB)
|████████████████████████████████| 53 kB 1.1 MB/s
Collecting wcwidth>=0.2.5
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/20/f4/c0584a25144ce20bfcf1aecd041768b8c762c1eb0aa77502a3f0baa83f11/wcwidth-0.2.6-py2.py3-none-any.whl (29 kB)
Collecting regex
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c4/3d/d7ed16c298101bc7f5e3a65aef1ab34c1d7e1a89893491a4b1faf20701aa/regex-2023.6.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (772 kB)
|████████████████████████████████| 772 kB 41.2 MB/s
Requirement already satisfied: nvidia-curand-cu11==10.2.10.91 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (10.2.10.91)
Requirement already satisfied: nvidia-cusolver-cu11==11.4.0.1 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (11.4.0.1)
Requirement already satisfied: nvidia-nvtx-cu11==11.7.91 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (11.7.91)
Requirement already satisfied: filelock in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (3.12.2)
Requirement already satisfied: nvidia-cuda-runtime-cu11==11.7.99 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (11.7.99)
Requirement already satisfied: nvidia-cuda-cupti-cu11==11.7.101 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (11.7.101)
Requirement already satisfied: triton==2.0.0 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (2.0.0)
Requirement already satisfied: jinja2 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (3.1.2)
Requirement already satisfied: nvidia-cublas-cu11==11.10.3.66 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (11.10.3.66)
Requirement already satisfied: networkx in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (3.1)
Requirement already satisfied: nvidia-cufft-cu11==10.9.0.58 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (10.9.0.58)
Requirement already satisfied: sympy in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (1.12)
Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.7.99 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (11.7.99)
Requirement already satisfied: nvidia-cudnn-cu11==8.5.0.96 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (8.5.0.96)
Requirement already satisfied: nvidia-nccl-cu11==2.14.3 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (2.14.3)
Requirement already satisfied: nvidia-cusparse-cu11==11.7.4.91 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (11.7.4.91)
Requirement already satisfied: typing-extensions in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torch->clip==1.0) (4.6.3)
Requirement already satisfied: setuptools in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch->clip==1.0) (67.8.0)
Requirement already satisfied: wheel in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from nvidia-cublas-cu11==11.10.3.66->torch->clip==1.0) (0.38.4)
Requirement already satisfied: cmake in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from triton==2.0.0->torch->clip==1.0) (3.26.4)
Requirement already satisfied: lit in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from triton==2.0.0->torch->clip==1.0) (16.0.6)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from jinja2->torch->clip==1.0) (2.1.3)
Requirement already satisfied: mpmath>=0.19 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from sympy->torch->clip==1.0) (1.3.0)
Requirement already satisfied: numpy in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torchvision->clip==1.0) (1.24.4)
Requirement already satisfied: pillow>=4.1.1 in /usr/local/miniconda3/envs/ldm/lib/python3.8/site-packages (from torchvision->clip==1.0) (9.4.0)
Building wheels for collected packages: clip
Building wheel for clip (setup.py) ... done
Created wheel for clip: filename=clip-1.0-py3-none-any.whl size=1369497 sha256=5237b42eaba4591a42c40810b27ebd0007d404797a0971e0826cd98fd7e9351c
Stored in directory: /tmp/pip-ephem-wheel-cache-285a_izf/wheels/52/ee/e7/3cf78259fb28ea3563895f33c038625f30154f61075e04f04a
Successfully built clip
Installing collected packages: wcwidth, regex, ftfy, clip
Successfully installed clip-1.0 ftfy-6.1.1 regex-2023.6.3 wcwidth-0.2.6
检查一下CLIP是否安装成功:
(ldm) root@I1385efcc2300601b29:/hy-tmp/latent-diffusion# python
Python 3.8.5 (default, Sep 4 2020, 07:30:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import clip
>>> print(clip.available_models())
['RN50', 'RN101', 'RN50x4', 'RN50x16', 'RN50x64', 'ViT-B/32', 'ViT-B/16', 'ViT-L/14', 'ViT-L/14@336px']
顺利安装成功!