小编voi*_*lex的帖子

如何避免 PyTorch 中的“CUDA 内存不足”

我认为对于 GPU 内存较低的 PyTorch 用户来说,这是一个非常普遍的信息:

RuntimeError: CUDA out of memory. Tried to allocate  MiB (GPU ;  GiB total capacity;  GiB already allocated;  MiB free;  cached)
Run Code Online (Sandbox Code Playgroud)

我想为我的课程研究对象检测算法。许多深度学习架构需要大容量的 GPU 内存,所以我的机器无法训练这些模型。我尝试通过将每一层加载到 GPU 然后将其加载回来来处理图像:

RuntimeError: CUDA out of memory. Tried to allocate  MiB (GPU ;  GiB total capacity;  GiB already allocated;  MiB free;  cached)
Run Code Online (Sandbox Code Playgroud)

但它似乎不是很有效。我想知道在使用很少的 GPU 内存的同时训练大型深度学习模型是否有任何提示和技巧。提前致谢!

编辑:我是深度学习的初学者。如果这是一个愚蠢的问题,请道歉:)

python object-detection low-memory deep-learning pytorch

39
推荐指数
6
解决办法
10万
查看次数

无法升级 NVidia 软件包

我想将我的 Ubuntu 从 19.04 升级到 20.04,但在更新所有软件包之前这是不可能的。

\n\n
\xe2\x9d\xaf sudo do-release-upgrade\nChecking for a new Ubuntu release\nYour Ubuntu release is not supported anymore.\nFor upgrade information, please visit:\nhttp://www.ubuntu.com/releaseendoflife\n\nPlease install all available updates for your release before upgrading.\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以,我正在尝试更新我的软件包:

\n\n
\xe2\x9d\xaf sudo apt update\nGet:1 file:/var/cuda-repo-10-0-local-10.0.130-410.48  InRelease\nIgn:1 file:/var/cuda-repo-10-0-local-10.0.130-410.48  InRelease\nGet:2 file:/var/cuda-repo-10-0-local-10.0.130-410.48  Release [574 B]\nGet:2 file:/var/cuda-repo-10-0-local-10.0.130-410.48  Release [574 B]\nHit:3 http://repo.yandex.ru/yandex-disk/deb stable InRelease                                                                                                                           \nHit:5 http://linux.teamviewer.com/deb stable InRelease                                                                                                                                 \nHit:6 http://old-releases.ubuntu.com/ubuntu disco InRelease                                                                                                                            \nHit:7 http://ppa.launchpad.net/gophers/archive/ubuntu disco InRelease                                                                                                                  \nHit:8 http://old-releases.ubuntu.com/ubuntu disco-updates InRelease                                                                                                                    \nHit:9 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                           \nHit:10 https://dl.yarnpkg.com/debian stable InRelease …
Run Code Online (Sandbox Code Playgroud)

ubuntu apt upgrade nvidia

5
推荐指数
1
解决办法
4951
查看次数

如何处理 Sqlalchemy 中的 asyncpg.exceptions.TooManyConnectionsError

我正在开发一个使用异步 SQLAlchemy 连接asyncpg到 PostgreSQL 数据库的项目。问题是这样的:当我与数据库建立太多连接时,它会引发以下异常:

asyncpg.exceptions.TooManyConnectionsError: sorry, too many clients already
Run Code Online (Sandbox Code Playgroud)

这基本上是 Postgres 本身和配置的限制。但遗憾的是,会话无法处理此问题,例如尝试多次连接。是否有任何解决方法可以使其无异常地工作?

这是设置:

asyncpg.exceptions.TooManyConnectionsError: sorry, too many clients already
Run Code Online (Sandbox Code Playgroud)

postgresql sqlalchemy exception python-asyncio asyncpg

5
推荐指数
1
解决办法
1522
查看次数