Category "pytorch"

Not able to save model to gs bucket using torch.save()

I am trying to save a PyTorch model to my google cloud bucket but it is always showing a "FileNotFoundError error". I already have a gs bucket and the file path

WeightedRandomSampler for custom image dataloader pytorch

I am trying to solve class imbalance by using Weighted Random Sampler on a custom data loader. I can't seem to find the best way to implement this. The images a

GPU memory is empty, but CUDA out of memory error occurs

During training this code with ray tune(1 gpu for 1 trial), after few hours of training (about 20 trials) CUDA out of memory error occurred from GPU:0,1. And ev

Torchtext 0.7 shows Field is being deprecated. What is the alternative?

Looks like the previous paradigm of declaring Fields, Examples and using BucketIterator is deprecated and will move to legacy in 0.8. However, I don't seem to b

How to get time taken for each layer in Pytorch?

I want to know the inference time of a layer in Alexnet. And I have a few questions about this. Is it possible to measure the inference time accurately with the

Training loss for Faster-RCNN either becoming Nan or infinity

I want to implement Pytorch Faster-RCNN module on a custom dataset that I curated and labelled. The implementation detail looks straightforward, there was a dem

No module named "Torch"

I successfully installed pytorch via conda: conda install pytorch-cpu torchvision-cpu -c pytorch I also successfully installed pytorch via pip: pip3 install ht

No module named "Torch"

I successfully installed pytorch via conda: conda install pytorch-cpu torchvision-cpu -c pytorch I also successfully installed pytorch via pip: pip3 install ht

How to do gradient clipping in pytorch?

What is the correct way to perform gradient clipping in pytorch? I have an exploding gradients problem.

How to convert road lane coordinates to tensors in Python?

I am trying to develop a Lane Detector using PyTorch. Basically, I'm reading the video frame by frame using cv2, then finding edges using Canny Edge Detector an

Mobilenet as feature backbone to use Resnet18 pretrained model using Pytorch

I have a resnet18 pretrained model, now I want to change as feature backbone into MobileNet using pytorch , please suggest any optimal way is available or not

pytorch CUDA version vs. Nvidia CUDA version

Till Apr26th, 2022, CUDA has updated to version 11.6, which can be installed by Nvidia Instruction: wget https://developer.download.nvidia.com/compute/cuda/11.6

Hugginface transformers module not recognized by anaconda

I am using Anaconda, python 3.7, windows 10. I tried to install transformers by https://huggingface.co/transformers/ on my env. I am aware that I must have eith

Efficiently get first N numbers that satisfy a condition in each row in a pytorch/numpy tensor

Given a tensor b, and I would like to extract N elements in each row that satisfy a specific condition. For example, suppose a is a matrix that indicates whethe

TypeError: __call__() takes 2 positional arguments but 3 were given. To train Raccoon prediction model using FastRCNN through Transfer Learning

from torchvision.models.detection.faster_rcnn import FastRCNNPredictor from engine import train_one_epoch, evaluate import utils import torchvision.transfor

Why does torch.scatter requires a smaller shape for indices than values?

A similar question was already asked here, but I think the solution is not suited for my case. I just wonder why it is not possible to do a torch.scatter operat

CUDA error: device-side assert triggered on Colab

I am trying to initialize a tensor on Google Colab with GPU enabled. device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') t = torch.tensor([1,

fp16 inference on cpu Pytorch

I have a pretrained pytorch model I want to inference on fp16 instead of fp32, I have already tried this while using the gpu but when I try it on cpu I get: "su

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use tor

Google Colab GPU RAM depletes quickly on test data but not so on training data

I am training my neural network built with PyTorch under Google Colab Pro+ (Tesla P100-PCIE GPU) but encounters the following strange phenomenon: The amount of