torch

Floating point exception (core dumped) for UNet implementation

Floating point exception (core dumped) for UNet implementation Question: I am trying to do an implementation of KiuNet ( https://github.com/jeya-maria-jose/KiU-Net-pytorch ). But when I am executing the train command like so: python train.py –train_dataset "KiuNet/Train Folder/" –val_dataset "KiuNet/Validation Folder/" –direc ‘KiuNet/Results/’ –batch_size 1 –epoch 200 –save_freq 10 –modelname "kiunet" –learning_rate 0.0001 I am getting the …

Total answers: 1

Cannot create .exe with pyinstaller from .py with torchaudio (CPU): AttributeError: '_OpNamespace' 'torchaudio' object has no attribute 'cuda_version'

Cannot create .exe with pyinstaller from .py with torchaudio (CPU): AttributeError: '_OpNamespace' 'torchaudio' object has no attribute 'cuda_version' Question: I have a .py script that uses torchaudio (without GPU) to process some sound in Windows. To distribute it, I’ve used pyinstaller to turn it into a .exe. You can reproduce the issue with this simple …

Total answers: 2

AttributeError: '_MultiProcessingDataLoaderIter' object has no attribute 'next'

AttributeError: '_MultiProcessingDataLoaderIter' object has no attribute 'next' Question: I am trying to load the dataset using Torch Dataset and DataLoader, but I got the following error: AttributeError: ‘_MultiProcessingDataLoaderIter’ object has no attribute ‘next’ the code I use is: class WineDataset(Dataset): def __init__(self): # Initialize data, download, etc. # read with numpy or pandas xy = …

Total answers: 3

ModuleNotFoundError: No module named 'torch' in ubuntu

ModuleNotFoundError: No module named 'torch' in ubuntu Question: When I want use torch in jupyter, I got this error ModuleNotFoundError: No module named ‘torch’ but I check that torch is installed already. following: >>> python -c "import torch; print(torch.__version__)" 1.10.2+cu102 It is confirmed in Ubuntu CLI, but there is an error in jupyter only. How …

Total answers: 2

PytorchLightning : Model calls order

PytorchLightning : Model calls order Question: I’m trying to reimplement a training pipeline on top of pytorch Lightning. In the documentation they explain that training/validation loops are executed this way : My understanding was that the order was : train_step() train_epoch_end() val_step() val_epoch_end() I’ve implemented a dummy code in order to check this : import …

Total answers: 2

Why couldn't I feed a 4-tuple to nn.ReplicationPad2d()?

Why couldn't I feed a 4-tuple to nn.ReplicationPad2d()? Question: I’m applying yolov5 on kitti raw image [C, H, W] = [3, 375, 1242]. Therefore I need to pad the image so that the H and W being dividable by 32. I’m using nn.ReplicationPad2d to do the padding: [3, 375, 1242] -> [3, 384, 1248]. In …

Total answers: 2

How to apply function element wise to 2D tensor

How to apply function element wise to 2D tensor Question: Very simple question but I have been struggling with this forever now. import torch t = torch.tensor([[2,3],[4,6]]) overlap = [2, 6] f = lambda x: x in overlap I want: torch.tensor([[True,False],[False,True]]) Both the tensor and overlap are very big, so efficiency is wished here. Asked …

Total answers: 2

Mapping 3D tensor according to a rank tensor

Mapping 3D tensor according to a rank tensor Question: I have a tensor called rank which is of shape 2×3 as follows: tensor([[ 0, 1, 2], [ 2, 0, 1]) I want to construct a 2X3x3 matrix where the inner matrix is populated initially to all zeros using torch.zeros(2,3,3). I want to update the last …

Total answers: 1

Use torch.gather to select images from tensor

Use torch.gather to select images from tensor Question: I have a tensor of images of size (3600, 32, 32, 3) and I have a multi hot tensor [0, 1, 1, 0, …] of size (3600, 1). I am looking to basically selecting images that correspond to a 1 in the multi hot tensor. I am …

Total answers: 1

TorchServe: How to convert bytes output to tensors

TorchServe: How to convert bytes output to tensors Question: I have a model that is served using TorchServe. I’m communicating with the TorchServe server using gRPC. The final postprocess method of the custom handler defined returns a list which is converted into bytes for transfer over the network. The post process method def postprocess(self, data): …

Total answers: 1