Questions tagged [pytorch]

Pytorch is an open source library for Tensors and Dynamic neural networks in Python with strong GPU acceleration. For details, see https://pytorch.org.

Filter by
Sorted by
Tagged with
0 votes
0 answers
39 views

Is this the appropriate way to calculate a multiclass reliability diagram for model calibration?

I'm trying to generalize reliability diagrams [1] to a multiclass classifier and implement that using pytorch and pytorch-metrics. So far so good but I'm somewhat confused about the definition of ...
Nirro's user avatar
  • 101
0 votes
0 answers
47 views

How to get Audio embeddings using Hubert model

Example code: ...
Pulkit Mehta's user avatar
0 votes
0 answers
31 views

PyTorch input shape for text classification using LSTM

I have three sentiment classes: POSITIVE, NEGATIVE, and NEUTRAL, along with a dataset consisting of 3000 sentences and their corresponding sentiment labels (POSITIVE, NEGATIVE, or NEUTRAL). Each ...
PatelisGM's user avatar
0 votes
0 answers
116 views

Runtime Error: one of the variables needed for gradient computation has been modified by an inplace operation:

I have the following code for a reinforcement learning using proximal policy optimization. It gives the following run time error. ...
heyula's user avatar
  • 37
0 votes
1 answer
16 views

Images used in training CNN model

I am training a CNN with RGB images, however, when i plot them, they display in a bluish color. How can I have these display in RGB. Also do you think this affects the model accuracy? The code i am ...
Se Rai's user avatar
  • 1
0 votes
0 answers
35 views

How can I read hdf5 files stored as 1-D array. and view them as images?

I have a large image classification dataset stored in the format .hdf5. The dataset has the labels and the images stored in the ...
Aleph's user avatar
  • 123
0 votes
0 answers
10 views

How to selectively train a deep model based on the unavailability of a subset of the feature set

I am creating a deep learning binary classification model. Each sample in the dataset contains two mutually exclusive feature sets X and Y. Feature set X is present in all samples; however, there are ...
flamingo_stark's user avatar
0 votes
0 answers
71 views

Saving and Loading PyTorch Models for Inference without Model Definition

I'm working on a PyTorch project where I need to save and then later load a model for inference in an environment where the model definition is not available. Essentially, I want to load the model (...
Carpediem's user avatar
0 votes
0 answers
30 views

Assign layers and weights in BERT

I print the weight names and shape of the BERT transformer. Now, I want to assign the printed weight to the layers in the transformers architecture: In the following, I can assign query, key and ...
Christian01's user avatar
0 votes
0 answers
13 views

Pytorch resume model training

I've preserved the model's state_dict(), but unfortunately, the optimizer's state_dict() is lost. Can I still continue training the PyTorch model from the last checkpoint? Please confirm any ...
vipin bansal's user avatar
  • 1,262
0 votes
0 answers
13 views

How can I set two anchors with different widths and the same height using PyTorch’s AnchorGenerator module?

I’m trying to use the AnchorGenerator module in PyTorch, but I’m having trouble setting up two anchors with different widths and the same height. Specifically, I want one anchor to have a height of 43 ...
roei shlezinger's user avatar
1 vote
1 answer
98 views

Neural Net not able to learn simple analytical equation

I am currently making my first attempts with Pytorch. I am trying to solve a simple equation with a neural net. Analytically solved, the result of my neural net shall look like this: $$ y = \frac{x_5}{...
Ripleys's user avatar
  • 11
1 vote
0 answers
76 views

Pytorch Transformer only generating NaN when using mask

When I generate a src_mask like this ...
kot's user avatar
  • 11
0 votes
0 answers
16 views

Is there any advantage to providing multi-dimensional input to torch modules?

Most layer types in torch.nn such as torch.nn.Linear accept input with more than one dimension. Is there any advantage in doing so if you can shape your data to represent a certain arrangement in ...
kot's user avatar
  • 11
0 votes
0 answers
97 views

Can't overfit Transformer Encoder

In the below code I am trying to train a very simple Transformer Encoder model to basically do nothing with its input. Giving some arbitrary input vector x, the aim of the model is then to output that ...
SeñorDavid's user avatar
0 votes
0 answers
34 views

Should non-trainable functions be part of a nn model?

Some explanation for the somewhat obscure title: I want to train a model which can produce images given some input data. However, actually I want the model to learn some abstract representation which ...
Roland Deschain's user avatar
0 votes
1 answer
12 views

Transforms applied by DataLoader in PyTorch

I've noticed that PyTorch's DataLoader is applying scaling to the input data with the MNIST dataset. I'm guessing its some sort of normalisation or scaling, but how do I actually find what transform ...
oweydd's user avatar
  • 101
0 votes
0 answers
18 views

Loss MAE when estimating the angle of rotation of an object in an image is stuck at about 90

I am dealing with the problem of estimating the angle of rotation of objects in images. The problem is that the network gets stuck when training at a loss level of about 90. Below is the code for my ...
DamianSz's user avatar
0 votes
1 answer
52 views

PyTorch ResNet implementation's Training Loss increasing with every Epochs

I'm implementing a ResNet network from scratch using PyTorch. This network is unique to my requirements, since I need to perform Image Classification for Satellite Imagery with 14 different channels ...
Gamma-ray-burst's user avatar
0 votes
0 answers
11 views

Pretrained computer vision models that accept as input a segmented image and the original image

My data is a set of segmented images with extra details: there is 30 object classes each object is labeled with its state (very old, old-fashion, modern) and each object is also labeled with a second ...
Karim-53's user avatar
0 votes
0 answers
10 views

How do we modify the early stopping procedure to account for better losses after initial rise in losses?

I have a question regarding the usage of early stopping in the training of my forecasting model. Curious about how the training would go without early stopping, I observed that the test loss seems to ...
Zezimabig's user avatar
0 votes
0 answers
106 views

Generator loss not decreasing while training GAN

I’ve been attempting to create a basic GAN to generate images using this database of flowers (https://www.robots.ox.ac.uk/~vgg/data/flowers/102/). I’ve spent a few days on this, and largely based my ...
Hozaifa Bhutta's user avatar
0 votes
0 answers
41 views

Improving Wake-Word Detection Model Performance: Seeking Advice and Suggestions

I was assigned a task to train a wake-word detection model. Basically, it's a binary sequence classification model on audio samples where it should be 1 if it recognizes the wake word being said (e.g. ...
Ícaro Lorran's user avatar
0 votes
0 answers
37 views

Avoid killing learnable parameters when transforming input into intervals

I'm trying to make a model using Pytorch which is training and transforming a set of coordinates, and then is downsampled using the model below. However, when I'm making the input coordinates into ...
An alien's user avatar
0 votes
0 answers
17 views

Validation loss hump in LSTM

I'm using PyTorch to fit an LSTM to a binary time series dataset which has about 300 time series of about 20 items. I am using 15% of the time series as a validation set. I then have an MLP on top of ...
Mark C.'s user avatar
  • 101
0 votes
0 answers
213 views

PlotNeuralNet plot interpretation

I am new to machine learning, I know how to build a simple neural network, but I don't know how to visualize my model accurately. PlotNeuralNet is really an amazing ...
Tianjian Qin's user avatar
1 vote
1 answer
108 views

What're the standard ways of padding data for GNNs?

I am working on materials property prediction using GNNs with torch_geometric. Each data in my dataset has different number of feature vectors x, edge_index vectors ...
user174967's user avatar
0 votes
1 answer
253 views

Training ResNet50 model for binary classification

I want to use ResNet50 model to perform binary classification on a dataset spectrogram dataset. In order to do that I had to make a couple of modifications to the model's architecture: Modified the ...
leapofFaith's user avatar
0 votes
0 answers
28 views

Discrepancy in the measured metrics in my segmentation models

I’ve trained my image segmentation models using SegmentationModelsPytorch. Three annotators marked up objects. All pixels that were voted as an object pixel by two annotators were marked as the pixels ...
sixtytrees's user avatar
0 votes
1 answer
96 views

how to define a linear function WX+b in pytorch?

I am practicing pytorch. I want to define a linear function Y=WX+B for inputs shape as (3,32,32) and output, the same shape i.e. (3, 32, 32). I defined m network as: ...
Ali.A's user avatar
  • 71
0 votes
0 answers
60 views

How to use Bertweet model for topic modeling

The problem is implementation of Bertweet in a topic-modeling project with understandable output like BERTopic, i want to use it on a relatively large (20k tweets) unlabelled dataset to segment it ...
Rossin's user avatar
  • 1
1 vote
1 answer
819 views

issue loading the ckpt file PytorchStreamReader failed reading zip archive: failed finding central directory

I am trying to load the ckpt file and getting error PytorchStreamReader failed reading zip archive: failed finding central directory Here is the code ...
Shruti's user avatar
  • 35
1 vote
0 answers
835 views

How to implement 2d Rotary Position Embedding in PyTorch?

The original RoPE paper suggests that the Rotary Position Embedding it describes can easily be extended to two or more dimensions: 3.2.2 in https://arxiv.org/abs/2104.09864 . I'm trying to find a ...
LogicChains's user avatar
0 votes
1 answer
807 views

why I got TypeError: linear(): argument 'input' (position 1) must be Tensor, not int in NN?

I am writing a NN in pytorch. I have a list of tensors as input i.e. I created a list Y by appending 1000 tensor vectors(linear tensors) of size 3072. So, each Y[i] is a linear tensor of size 3072. ...
Ali.A's user avatar
  • 71
0 votes
0 answers
18 views

How to define a DataLoader or Loss for a e.g. multivariable functions?

I am trying to write a NN for estimating a f:R^n --> R^m. My problem is how to train network. I mean if I want to define a dataloader, how to attach X \in R^n to its related Y \in R^m ? Because ...
Ali.A's user avatar
  • 71
2 votes
3 answers
1k views

torch cuda not able to identify gpu on aws g4dn.xlarge

I have created an EC2 instance with GPU g4dn.xlarge and launched it. I want to run some ...
Shruti's user avatar
  • 35
0 votes
0 answers
13 views

Deep Learning Methods for Video Classification

I'm working on a dataset with ~300 videos that last from 9 to 13-minute interviews of each subject and it has all the personality-related metadata that was collected during initial surveys. Which Deep ...
TheBiometricsGuy's user avatar
0 votes
0 answers
18 views

How to autosave a mode parameters during training neural network?

I am still new to python and NN. As NNs trainings is done for example 500 epochs, how I can auto-save the model so that if my connection gets lost or ran out of google GPU, next time I do not start ...
Ali.A's user avatar
  • 71
0 votes
0 answers
82 views

Can we show only results of some epochs in tqdm?

I am training a NN and use tqdm for showing the results. However, the bad thing is that it shows the results for every epoch. This is too many as I want to train NN for atleast 500 epochs. Is there ...
Ali.A's user avatar
  • 71
0 votes
0 answers
28 views

Errors in results after saving model vs using directly from memory

I am trying to save a Fine Tuned model using trainer.save_model() but after I load the saved_model it just responds with the input back again and does not give any ...
Nikhil Verma's user avatar
0 votes
0 answers
7 views

Parametrizing a decreasing curve

I am trying to estimate a curve that by construction has to start from (0,0) and be decreasing. My current approach is to predict 20 numbers $d_i$ on [0, 10) as the differences between values on the ...
Mark C.'s user avatar
  • 101
0 votes
0 answers
21 views

Expanding torch dataLoader by repeating elements (or something equivlent)

I have a pytorch classifier with stochastic elements. For each MNIST minibatch, I would like to feed it in K times (from the same starting state), and then average the resulting weight updates in ...
Ari Herman's user avatar
0 votes
2 answers
305 views

How to add multiple embeddings (layers) to LSTM layer

The similar question was asked before here https://stackoverflow.com/questions/52627739/how-to-merge-numerical-and-embedding-sequential-models-to-treat-categories-in-rn/52629902#...
Любовь Пономарева's user avatar
1 vote
1 answer
397 views

How to Use Multiple Adapters with a Pretrained Model in Hugging Face Transformers for Inference?

I have a pretrained Llama-2 model in the models_hf directory and two fine-tuned adapters: a summarization adapter in ...
Aun Zaidi's user avatar
0 votes
0 answers
16 views

2 regression models giving same performance

I have 2 regression models (1 is deeplearning based) and another is SVR both trained on the embeddings obtained from the last FC layer of ResNet50. Output variables are min-max normalized to get in ...
codingbugs's user avatar
0 votes
0 answers
66 views

Why I am getting error in dataloader in defining a NN?

I am trying to write a NN. However I am getting error. Here is my Code: ...
Ali.A's user avatar
  • 71
0 votes
0 answers
45 views

What is wrong with my Torch HMDB51 Dataloader?

I'm trying to prepare a HMDB51 dataset for some image classification tasks. Have done this many times before in TF but this time I am working in PyTorch. Running into this strange problem when ...
Franklin's user avatar
0 votes
0 answers
53 views

Flickr8k+PyTorch, CNN+LSTM predicts always same words during model testing

I'm a beginner in Machine Learning and I'm working with the Flickr8k dataset (it contains ~8000 images, every image has 5 captions: ~40000 pairs). I splitted the dataset in training (70%) and ...
lampaDT's user avatar
1 vote
0 answers
72 views

Swin Transformer Relative Position Biases

I was reading the swin transformer paper and looking at the github implementation, i noticed that when calculating the relative position bias the input to the log function before the CPB MLP is scaled ...
jack's user avatar
  • 11
0 votes
1 answer
156 views

Appropriate input size for nn.Embedding

I’m quite new to using Pytorch and deep learning. What size of unique categories of a categorical variable is appropriate for applying the nn.Embedding ideally (best practices)? for example, if a ...
Любовь Пономарева's user avatar

1
2
3 4 5
15