Questions tagged [pytorch]

For conceptual questions that somehow involve the PyTorch library, but note that programming questions are off-topic here.

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

How to get optimal Scaling with raw PyTorch+DDP?

I'm trying to install a distributed training environment on a compute cluster that I have. I happen to know from previous experience that often scaling up the batch size "naively" isn't very ...
  • 306
0 votes
1 answer
20 views

Which loss / activation function with 2 classes that do not occur often and do not sum to one?

I have a neural network that predicts 2 classes of a time series (bottom and top). Currenlty my Y labels are size 2: [1 0] for bottom and [0 1] for top. The NN has 2 output nodes. Of course not every ...
  • 206
2 votes
0 answers
74 views
+100

Reverse Process in Diffusion Model Doesn't Return Original Image

I am attempting to program a Denoising Diffusion Model based on the one introduced in the article by Ho et al. (2020). However, I have run into issues while testing the reverse diffusion process. ...
0 votes
0 answers
23 views

Reinforcement Learning (gymnasium's FrozenLake-v1) using Spiking Neural Networks (BindsNet)

I'm new to reinforcement learning. I'm trying to solve the FrozenLake-v1 game using OpenAI's gymnasium learning environment and BindsNet, which is a library to simulate Spiking Neural Networks using ...
0 votes
0 answers
8 views

Exponentiation immediately after log softmax

In an AlphaZero repo's implementation of Othello game, I see: At one line: F.log_softmax here Next line of the control flow: ...
0 votes
0 answers
27 views

Training a neural network to produce a one-hot encoding vector out of a single feature

I would like to build a neural network that takes a natural number and generates a one-hot encoding vector corresponding to that number. Example: $2 \rightarrow (0,0,1,0,\dots)$ More formally, I ...
0 votes
0 answers
14 views

How to add a neural network to a direct optimization algorithm

I want to improve a direct optimization algorithm with neural network. The original algorithm is called LIVE, as follows: ...
0 votes
0 answers
15 views

Best model for a puzzle, when solving using reinforcement learning

i am using DRQNs to solve the eternity 2 puzzle. The concept is quite simple: you have a square board filled with pieces that are 4-sided. Each piece can be swapped with others or rotated, and the ...
0 votes
0 answers
7 views

How to create/train a binary classification model for checking candidate phrases?

Let's say I have sentences like "He called me a silly sausage when I made a stupid joke", and I want to identify/extract all swear words and the like (here: "silly sausage"). I ...
  • 101
0 votes
0 answers
22 views

How to use a framework for NLP such as transformers with pytorch or tensorflow to generate statistics based on prompt messages about a dataset?

Is there a way to achieve this or do I have to go in other direction? It should answer questions such as which order in the last year took the longest time to complete and why. For instance, with a ...
  • 101
0 votes
1 answer
31 views

flops do not change when pruning

I prune a neural network using torch.nn.utils.prune, the calculation of the sparsity as well as the accuracy of the model shows that the pruning has taken place and that the model is more spars. But ...
  • 1
0 votes
0 answers
18 views

DRQNs for puzzle solving

I am currently trying to create a solver for the eternity 2 puzzle. You basically have to reduce the number of color conflicts (2 adjecent sides of different color) in a 16*16 grid where each cell's ...
0 votes
1 answer
23 views

Changing the number of epochs change the loss at the the `x`th epoch

During a training of a neural network, the test loss was reached the minimum at the x-th epoch, after which I reran the training with the maximum epoch set as ...
0 votes
0 answers
7 views

I created joint embeddings by training a NN with contrastive loss. Why are my resulting embeddings so sparse?

Using BERT and Word2Vec word embeddings as two inputs, I trained a small neural network using Contrastive loss. The NN looks like this: Net( (fcin1): Linear(in_features=768, out_features=500, bias=...
0 votes
0 answers
147 views

YOLOv7 fine tuning with unbalanced dataset

I have a question about training object detection models especially using the YOLOv7 algorithm. I use a Soccer Players Dataset from the Roboflow. The dataset is very unbalanced. I trained the model ...
  • 1
1 vote
1 answer
40 views

How does the memory augmented neural network work, and how to make a simple implementation?

How does the memory augmented neural network (MANN) work? How can I make a simple MANN with a vanilla neural network especially without a recurrent network?
  • 1,006
0 votes
0 answers
14 views

Problem on evaluating DQN, on a Vehicle Routing Problem (VRP)

I am running this DQN algorithm that is trying to minimize the total distance traveled by a vehicle (VRP). In the training, as you can see in the images, everything works fine: the loss is decreasing, ...
1 vote
0 answers
74 views

What is wrong with my PyTorch model training on CIFAR10?

I am training a ResNet model on CIFAR10 dataset. For the training subset, I selected a random 1% of the train data from the default train/test split. For the test subset I used the whole default test ...
  • 11
0 votes
1 answer
58 views

How to speed up my neural network?

I would like to train an LSTM-based variational autoencoder on a large dataset (37 million sentences). However, I have calculated that my training speed as of now is too slow (on Google Colab). I am ...
0 votes
2 answers
168 views

How "exactly" are AI-accelerator chip ASICs built differently than GPUs as GPU seem to lead for many AI workloads on performance

There is a lot of discussion on google search about AI-custom-accelerators (like Intel's Gaudi) and GPUs. Almost all of them say generic things like, a) AI Accelerator chip is for specialized AI ...
  • 171
0 votes
1 answer
70 views

How do I use ResNet for text processing?

I need to implement a deep neural network [residual neural network (ResNet)] that takes some text as an input [length M x N] and then processes it. Now as far as my understanding goes, ResNet is used ...
  • 1
2 votes
1 answer
190 views

Pytorch's Actor-critic implementation seems to be implemented in a Monte-Carlo fashion - why?

In the Actor-Critic example, provided by PyTorch, it seems that the update rule only occurs when the episode ends (like in a Monte-Carlo process). Specifically, in their ...
0 votes
0 answers
20 views

How is padding masking considered in the Attention Head of a Transformer?

For purely educational purposes, my goal is to implement basic Transformer architecture from scratch. So far I focused on the encoder for classification tasks and assumed that all samples in a batch ...
  • 101
0 votes
1 answer
32 views

Keep weights of output layer in transfer learning?

I'm seeing conflicting info on what to do with the fully-connected output layer of a pre-trained network when it's used in transfer learning. A previous answer seems to imply that the network is kept ...
0 votes
0 answers
24 views

FFJORD: Free-form Continuous Dynamics for Scalable Reversible Generative Models

I am trying to understand this paper and the github code given with it, specifically the CNF script: in the loss function (compute_bits_per_dim) the Normalizing Flow is run forward to retrieve the ...
0 votes
0 answers
18 views

Resources and papers about Graph Neural Networks and molecular predictions?

What are some famous papers or techniques related to the use of Graph Neural Networks (GNNs) for predicting molecular properties? For example, I know of a common convolutional layer that has obtained ...
0 votes
0 answers
26 views

agent based DNN with a loopback

I have a data problem with no direct reward mechanism,(test/train) good and fault solutions. Though over a long time period good decisions might be made. I've been searching for days now for an agent ...
  • 101
0 votes
0 answers
122 views

How to change anchor Box sizes Faster RCNN?

I have a dataset where I have to find just the bigger objects so I think I can try changing the anchor box sizes from the default. I am using pytroch and more ...
  • 253
0 votes
0 answers
39 views

Turn 3D Embedding into 2D for classification in PyTorch

I am building a pytorch transformer model that shall perform text classification I have a batch size B, a sequence length T, and an embedding size D So first my input (B, T) is passed into an ...
0 votes
0 answers
68 views

Optimal weight decay value in Adam

Is there any rule of thumb while assigning the weight_decay parameter in Adam optimizer? As in, is it somehow related to (smaller or larger than) the learning rate ...
0 votes
0 answers
52 views

Gumbel Softmax- Hard vs Soft backprop significance

For gumbel-softmax in pytorch, can the choice of the "hard" parameter have an effect on backprop?
2 votes
2 answers
371 views

Val loss doesn’t decrease after a certain number of epochs

I’m working on a classification problem (500 classes). My NN has 3 fully connected layers, followed by an LSTM layer. I use nn.CrossEntropyLoss() as my loss ...
1 vote
1 answer
17 views

Unexpected behaviour on using class weights in loss

I’m working on a classification problem (500 classes). My NN has 3 fully connected layers, followed by an LSTM layer. I use nn.CrossEntropyLoss() as my loss function. To tackle the problem of class ...
1 vote
0 answers
81 views

Higher validation loss after using Dropout

I’m working on a classification problem (500 classes). My NN has 3 fully connected layers, followed by an LSTM layer. I use nn.CrossEntropyLoss() as my loss ...
0 votes
1 answer
235 views

Why does a zero-input network initialize all bias terms to 0? (pytorch)

I'm following https://pytorch.org/docs/stable/generated/torch.nn.Linear.html?highlight=nn%20linear#torch.nn.Linear Documentation allows for bias=True term, but they ...
1 vote
1 answer
96 views

Batching together similar length sequences to avoid padding and packing

I am training an RNN in PyTorch to produce captions for images. It's a pretty standard architecture – the image is processed by a pre-trained InceptionV3 to extract features, the recurrent module ...
  • 111
1 vote
0 answers
160 views

Where can I get Imagenet test dataset labels for evaluation

I have the imagenet train, validation and test set. I have been able to assign each image in the validation set into its respective class folders with the help of some online resources. However, for ...
0 votes
1 answer
303 views

How can I use larger input images when using a pre-trained CNN without resizing?

I have a ResNet18 model trained on the Places365 image dataset, and I'd like to use this pre-trained model to expedite the training needed to identify distressed houses. My dataset is images of size ...
1 vote
1 answer
73 views

Similarities between 2d-vectors. (to flatten or to not)

I have this scenario where I need to measure the similarity between a 2d tensor t1: (100,8) and 61 tensors of the same shape(100,8). 100 represent time-steps and 8 is the no. of options. I first tried ...
0 votes
1 answer
54 views

How to use Categorical Cross Entropy for Multi-Label Classification?

Say my target with classes A, B, C, D, E is [0, 1, 1, 0, 0]. And my output layer is of B x N where N is the number of classes. ...
0 votes
0 answers
29 views

Matrix Dot Product of and [B, N] and [N x N] in Tensor

I have a pre-computed co-occurence matrix in shape of [NxN] I want to utilize this info on the last layer of my multi-label classification of [B, N]. Is dot product the best way to do it? How do I use ...
0 votes
1 answer
217 views

Whats wrong with my resnet50 training on CIFAR10 pytorch?

I've been trying to construct resnet50 architecture from scratch using pytorch for classification. After construction I've run training job on CIFAR10 torchvision dataset, in 20 epochs with lr of 0.01 ...
  • 3
0 votes
1 answer
85 views

Help on Deep Sarsa algorithm that work with pytorch (Adam optimiser) but not with keras/Tensorflow (Adam optimiser)

I have a deep sarsa algorithm wich work great on Pytorch on lunar-lander-v2 and I would use with Keras/Tensorflow. It use mini-batch of size 64 wich are used 128 time to train at each episode. There ...
  • 1
0 votes
1 answer
51 views

How do I implement the 'gradient clipping' in the Neural Replicator Dynamics paper?

The paper is here https://arxiv.org/pdf/1906.00190.pdf and the relevant paragraph where they explain their method is below: It's still not clear to me how this is meant to work exactly. In the pseudo-...
0 votes
1 answer
52 views

How to improve the performance when no shuffling of dataloader is needed?

I'm currently doing some researches on video recognition. What I'm trying to do is like this paper. The idea is that: for processing a specific input video clip (shape: [T, C, H, W]), it needs ...
  • 1
3 votes
1 answer
61 views

Why might my policy gradient agent appear to maximize the absolute value of rewards?

I have a toy policy gradient RL algorithm using REINFORCE (aka monte carlo policy gradients) that involves bots moving on a grid attempting to "acquire" targets in Pytorch. The bots receive +...
  • 89
0 votes
0 answers
5 views

Do ML Models with sparsely accessed layers in the middle or end exist?

I am currently researching ML training, specifically if layers are accessed in a sparse or dense fashion. A linear layer an example for dense access, as all parameters are required during the forward ...
  • 1
0 votes
0 answers
268 views

how to appy action mask

I'm trying to figure out how action masking works and the closest workaround i get is following the hanabi environment example and then write my own custom version ...
0 votes
0 answers
358 views

IndexError: tensors used as indices must be long, byte or bool tensors

I want to implement a dueling double DQN algorithm for selecting multiple discrete actions. Since the existing codes available on Github are for choosing a single action, I should modify them. But ...
0 votes
1 answer
250 views

Is there a way to freeze training for weights, but not biases in PyTorch? [closed]

I'm constructing a neural network where the weights of my first hidden layer (connected to the input) are all 1 (identity matrix), but the biases are variable. Is there a way to "freeze" any ...
  • 133