pytorch
still_learning
这个作者很懒,什么都没留下…
展开
-
pytorch手动安装
torch手动安装,服务器无法上网如何下载torch原创 2022-09-21 22:27:49 · 956 阅读 · 0 评论 -
【fixed】torch Dataloader报错 TypeError: Caught TypeError in DataLoader worker process 0.
遇到与该博客相似的问题但是原因却不是因为transformer写错了,而是因为我dataset部分读出来的数据,不能够使用torch.from_array变为torch,所以导致报错。与这位博主写错,不能正确使用transfoms的报错相同。...原创 2022-04-24 21:12:30 · 866 阅读 · 0 评论 -
python 执行找不到ninja的解决方案
RuntimeError: Ninja is required to load C++ extensions 网上记载的安装ninja,然后复制到/usr/bin 或者/usr/local/bin,好像都没有起作用。最后通过这个指令解决了。(注意,如果在anaconda环境下,需要先退回base环境。)sudo apt install ninja-build...原创 2022-04-22 16:19:30 · 4931 阅读 · 2 评论 -
cuda安装报错(dependencies,dpkg, overwrite)
问题1-预先安装环境缺少依赖项报错sudo apt update # 更新 aptsudo apt install gcc g++ make # 安装 gcc g++ makesudo apt install libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev freeglut3-dev # 安装依赖库那么需要使用 apt-get -f install, sudo apt-get install libcublas-dev来安装库问题2报错原创 2021-09-19 17:08:00 · 560 阅读 · 0 评论 -
pip conda国内镜像源安装的问题
最近安装torch的最新版本被清华的源搞得特别难受,总是一半就断连,下面给出几个解决方法,大家一步一步尝试吧,祝好运1. 在官方查看最新版本的下载指令进行尝试:https://pytorch.org/get-started/locally/这里有两种方式,建议大家都尝试一下,万一成功了呢。pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org原创 2021-05-27 12:55:50 · 1620 阅读 · 2 评论 -
torch/tensorflow使用GPU训练的方法
2.1 下面方法是直接在终端运行时加入相关语句实现指定GPU的使用export CUDA_VISIBLE_DEVICES=0 python test.py# 表示运行test.py文件时,使用编号为0的GPU卡export CUDA_VISIBLE_DEVICES=0,2 python test.py# 表示运行test.py文件时,使用编号为0和2的GPU卡2.2 下面方法是在Python程序中添加import os# 使用第一张与第三张GPU卡os.environ["CUDA_VISI原创 2021-03-20 15:40:54 · 3209 阅读 · 0 评论 -
pytorch 把tensor转换成int c++/libtorch
直接在tensor变量的后面加.item(),就能把tensor类型转换成at::scales类型之后调用toInt()即可。原创 2021-01-28 15:22:37 · 2489 阅读 · 0 评论 -
libtorch,pytorch的c++版本如何查看是否可以使用cuda
#include <torch/torch.h>#include <iostream>int main() { torch::Tensor tensor = torch::rand({ 2, 3 }); std::cout << tensor << std::endl; std::cout << torch::cuda::is_available() << std::endl; std::cout << tor原创 2021-01-24 19:41:45 · 2449 阅读 · 1 评论 -
c++调用Pytorch,torchlib环境配置
windows系统+vs2017+cmake之前已经尝试过在QT上配置环境。但就算编译通过以后,仍然会出现闪退,错误返回值的情况,所以笔者尝试使用官方教程的方法,一步步构建VS2017的环境,期间也踩了一些坑,在这里总结一下和大家分享。参考教程:https://pytorch.org/cppdocs/installing.htmlCMake is an open-source, cross-platform family of tools designed to build, test and p原创 2021-01-24 15:40:27 · 1343 阅读 · 0 评论 -
qt配置Libtorch方法--windows
遇到错误解决方法,https://github.com/pytorch/pytorch/issues/24308ivalue.h文件中把下面这段template<class Key, class Value> /// \cond DOXYGEN_CANNOT_HANDLE_CONSTRUCTORS_WITH_MACROS_SO_EXCLUDE_THIS_LINE_FROM_DOXYGEN C10_DEPRECATED_MESSAGE("IValues based on std:原创 2021-01-22 20:16:00 · 2009 阅读 · 5 评论 -
pytorch安装-国内镜像源
在安装好cuda和cudnn之后安装pytorch的方法网上很多的方法都不是镜像下载,或者镜像下载因为系统的问题找不到库打开官网,找到对应合适的版本(cuda):https://pytorch.org/get-started/locally/之后复制下面这一行指令:conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch接下来就是关键一步了,把-c pytorch表示的pytorch源,更改为国内的镜像。原创 2021-01-06 10:50:12 · 88759 阅读 · 28 评论