Questions tagged [pytorch]

PyTorch is an open-source deep learning framework and API that creates a Dynamic Computational Graph, which allows you to flexibly change the way your neural network behaves on the fly and capable is of performing automatic backward differentiation.

0 votes
0 answers
9 views

No NVIDIA GPU found error, even though I defined Torch to use CPU

I have tried running Stable Diffusion, the new text2image model. The Problem is: I don´t have a NVIDIA GPU... After a bit of research, I found out you can "force" PyTorch to run on your CPU, ...
user avatar
  • 3
0 votes
0 answers
15 views

Local maximums of sub-tensors by index tensor

I have a tensor x of shape (1,n), and another index tensor d of shape (1,k). I’m trying to find the maximums of k sub-tensors x[0:d[0]], x[d[0]:d[1]], x[d[1]:d[2]], ..., x[d[-2]: d[-1]]. So the output ...
user avatar
0 votes
1 answer
12 views

ModuleNotFoundError: No module named 'torch'(on vscode only)

When I ran my program on vscode, I encountered this problem. But I had already installed pytorch on my conda environment before. What's more, the program executed successfully on pycharm. Any ...
user avatar
0 votes
0 answers
8 views

PyG: RuntimeError: Tensors must have same number of dimensions: got 2 and 3

I am using TransformerConv and encountered this error: Traceback (most recent call last): File "pipeline_model_gat.py", line 1018, in <module> output = model( File"/mount/...
user avatar
0 votes
0 answers
21 views

Error trying to convert pytorch regression model to a classification model

I have a GNN that works for regression however I have changed the nature of the task from regression to classification. I thought it would be as simple as converting the loss functions and output size ...
user avatar
0 votes
1 answer
12 views

error in using k-fold cross validation (pytorch tabular)

I am using the k-fold cross validation method but I am getting an error. The full code is available below : here I split data into train, test and also validation: # set aside 20% of train and test ...
user avatar
  • 1
0 votes
1 answer
20 views

PyTorch Tensor methods to nn.Modules?

I'm programming some callable custom modules in PyTorch and I wanted to know if I'm doing it correctly. Here's an example scenario where I want to construct a module that takes a torch.Tensor as input,...
user avatar
  • 21
0 votes
1 answer
13 views

How to get a specif parameter matrix (tensor) of a model by its name in pytorch?

I have trained my model in pytorch. Now I want to extract a specific parameters tensor by its name (not all tensors). How can I do that? print(myModel.parameters) OUTPUT: <bound method Module....
user avatar
0 votes
0 answers
15 views

RuntimeError: mat1 and mat2 shapes cannot be multiplied (119x4 and 119x4) while creating an artificial neural network with PyTorch

I'm trying to make an artificial neural network from scratch, using as dataset the famous iris dataset. However, when I run the code it returns this error: RuntimeError: mat1 and mat2 shapes cannot be ...
user avatar
2 votes
0 answers
19 views

Constant loss and accuracy in pytorch

I am training a model whose output and ground truth should be binary. It's an inception based two stream models. Inception architecture is used as an encoder and for decoder a custom based model is ...
user avatar
  • 63
0 votes
0 answers
13 views

Error importing LayoutLMv2ForTokenClassification from HuggingFace

I am trying to run this demo notebook on colab and I am getting the following pytorch error when importing LayoutLMv2ForTokenClassification: from transformers import LayoutLMv2ForTokenClassification ...
user avatar
0 votes
0 answers
26 views

HuggingFace Trainer() does nothing - only on Vertex AI workbench, works on colab

I am having issues getting the Trainer() function in huggingface to actually do anything on Vertex AI workbench notebooks. I'm totally stumped and have no idea how to even begin to try debug this. I ...
user avatar
  • 1,352
-1 votes
1 answer
17 views

Why is the instance of DataLoader a global variable in pytorch

I was debugging my pytorch code and found that an instance of the class DataLoader seems to be a global variable by default. I don't understand why this is the case but I've set up a minimum working ...
user avatar
0 votes
0 answers
13 views

Try to use Matlab CNN Resnet50 pre-trained model to convert ONNX to use in Pytorch

I first use onnx2pytorch to convert onnx to pytorch, and then use it to use the test set to get the accuracy. model = torch.load("") model.eval() for epoch in range(1) : testing_loss = 0....
user avatar
  • 1
0 votes
0 answers
25 views

Error: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!"

I'm running this code on Azure machine learning notebook. import os import torch import gradio as gr from vilmedic import AutoModel from vilmedic.blocks.scorers import RadGraph import glob model, ...
user avatar

15 30 50 per page
1
2 3 4 5
1227