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
4
votes
1answer
116 views

Is there a reason to use TensorFlow over PyTorch for research purposes?

I've been using PyTorch to do research for a while and it seems to be quite easy to implement new things with. Also, it is easy to learn and I didn't have any problem with following other researchers ...
4
votes
1answer
108 views

What are the differences between TensorFlow and PyTorch? [closed]

What are the differences between TensorFlow and PyTorch, both in terms of performance and functionality?
3
votes
1answer
61 views

Training network with 4 GPUs performance is not exactly 4 times over one GPU why?

Training neural network with 4 GPUs using pyTorch, performance is not even 2 times (btw 1 & 2 times) compare to using one GPU. From Nvidia-smi we see GPU usage is for few milliseconds and next 5-...
3
votes
1answer
67 views

Mnist CNN Architecture

In this tutorial from Jeremy Howard: What is torch.nn really? he has an example towards the end where he creates a CNN for mnist. In nn.Conv2d he makes the ...
3
votes
1answer
87 views

Issue at training simple RNN for word generation

After completing Coursera course from Andrew Ng, I wanted to implement again simple RNN for generating dinosaurs name based on a text file containing around 800 dinosaurs name. This is done with ...
2
votes
2answers
173 views

Advantage computed the wrong way?

Here is the code written by Maxim Lapan. I am reading his book (Deep Reinforcement Learning Hands-on). I have seen a line in his code which is really weird. In the accumulation of the policy gradient $...
2
votes
1answer
263 views

Why isn't my implementation of A2C for the the atari pong game converging?

I have two different implementations with PyTorch of the Atari Pong game using A2C algorithm. Both implementations are similar, but some portion are different. https://colab.research.google.com/drive/...
2
votes
1answer
189 views

Heavy loss and inaccurate answer in pytorch

As my first AI model I have decided to make an AI model to predict multiplication of two numbers EX - [2,4] = [8]. I wrote the following code, but the loss is very high, around thousands, and it's ...
2
votes
1answer
420 views

Are the training loss and validation loss plotted per sample or per batch?

I am using a CNN to train on some data, where training size = 21700 samples, and test size is 653 samples, and say I am using a batch_size of 500 (I am accounting for samples out of batch size as well)...
2
votes
1answer
56 views

How to add some data input in a CNN?

There is this problem I have encountered, I was trying to classify the pixels from input image into classes, sort of like segmentation, using a encoder-decoder CNN. The “interested” pixels usually ...
2
votes
1answer
1k views

How to export Pytorch Deep Neural Networks trained model to C++ program to use it from C++? [closed]

I want to build a DNN model that I will later integrate into a C++ program. I heard that PyTorch model is hard to load it on C++ and the integration requires extra code, and it's complicated. I have ...
2
votes
1answer
474 views

Why isn't my model learning satisfactorily?

The problem to solve is non-linear regression of a non-linear function. My actual problem is to model the function "find the max over many quadratic forms": ...
2
votes
0answers
46 views

Why does GAN loss converge to log(2) and not -log(2)?

In Goodfellow's paper, he says: Hence, by inspecting Eq. 4 at $D^*_G (\mathbf{x}) = \frac{1}{2}$, we find $C(G) = \log \frac{1}{2}+ \log \frac{1}{2} = − \log 4$. To see that this is the best ...
2
votes
0answers
68 views

What is the equivalent PyTorch version of tensorflow lite

Update Checked the PyTorch Mobile which is designed to Android and iOS. Although according to the document, it says it can build for ARM CPUs, but there isn't any documentation mention about how to ...
2
votes
0answers
46 views

Why does the BatchNormalization layer produce different outputs during training and inference?

I modified resnet50 architecture to get a regression network. I just add batchnorm1d and ReLU layers just before the fully connected layer. During the training, the output of batchnorm1d layer is ...
2
votes
0answers
236 views

How can I train YOLO with the COCO dataset?

I am trying to implement the original YOLO architecture for object detection, but I am using the COCO dataset. However, I am a bit confused about the image sizes of COCO. The original YOLO was trained ...
2
votes
0answers
883 views

How to transfer learn Darknet YOLOv3

I've started getting into object detection in image. I have YOLOv3 neural network with Darknet framework. The network is pre-trained from COCO data set. Now I need to do some transfer learning in ...
1
vote
1answer
91 views

How does the policy gradient's derivative work?

I am trying to understand the policy gradient method using a PyTorch implementation and this tutorial. My first question is about the end result of this gradient derivation, \begin{aligned} \nabla \...
1
vote
1answer
57 views

Why is the policy loss the mean of $-Q(s, \mu(s))$ in the DDPG algorithm?

I am trying to implement the DDPG algorithm based on this paper. The part that confuses me is the actor network's update. I don't understand why the policy loss is simply the mean of $-Q(s, \mu(s))$, ...
1
vote
1answer
90 views

What does the notation $\partial \theta_{\pi}$ mean in this actor-critic update rule?

One of the steps in the actor-critic algorithm is $$\partial \theta_{\pi} \gets \partial \theta_{\pi} + \nabla_{\theta}\log\pi_{\theta} (a_i | s_i) (R - V_{\theta}(s_i))$$ For me, $\theta$ are just ...
1
vote
1answer
35 views

Why are the rewards of my RL agent for the Atari Breakout game decreasing after a certain number of episodes?

The agent is trying to master the Atari Breakout game. Here is my code Is that normal that reward_100 decreased that much after it hits 4.5? Is there a way to ...
1
vote
1answer
76 views

Is this learning rate schedule increasing the learning rate?

I was reading a PyTorch code then I saw this learning rate scheduler: ...
1
vote
1answer
283 views

LSTM is not converging

I am writing my first LSTM network and I would really appreciate if someone can tell me if it is right (the loss seems to go down very slowly and before playing around with hyper parameters I want to ...
1
vote
0answers
24 views

Pytorch Deep q network not learning and step not stepping towards target

I am trying to create a simple deep q network for rl with conv2d layers. I can’t figure out what I am doing wrong, and the only thing I can see that doesn’t seem right is when I get the model ...
1
vote
0answers
14 views

is it ok to take random actions while training a3c as in below code

i am trying to train an A3C algorithm but I am getting same output in the multinomial function. can I train the A3C with random actions as in below code. can someone expert comment. ...
1
vote
0answers
44 views

Is it good practice to save NLP Transformer based pre-trained models into file system in production environment

I have developed a multi label classifier using BERT. I'm leveraging Hugging Face Pytorch implementation for transformers. I have saved the pretrained model into the file directory in dev environment. ...
1
vote
0answers
45 views

Classification or regression for deep Q learning

DQN implemented at https://github.com/PacktPublishing/PyTorch-1.x-Reinforcement-Learning-Cookbook/blob/master/Chapter07/chapter7/dqn.py uses the mean square error loss function for the neural network ...
1
vote
0answers
40 views

In layman's terms, what is stochastic computation graph?

I'm going through the distributions package on PyTorch's documentation and came across the term stochastic computation graph. In layman's terms, what is it?
1
vote
0answers
44 views

Policy Gradient on Tic-Tac-Toe not working

I wanted to implement the Policy Gradient on Tic-Tac-Toe. I tried to use the code that worked for any environment like CartPole-v0 to my Tic-Tac-To game. But it is not learning. There are no errors. ...
1
vote
0answers
40 views

Benchmarking SAC on Pybullet

So far I have seen TD3 and DDPG benchmarks on Pybullet environments, but I am looking for SAC benchmarks on Pybullet too, anyone can help?
1
vote
0answers
37 views

What are the procedures to get RL paper results? [closed]

I finished working on a new algorithm in Reinforcement Learning, I need to compare it to some well-known algorithms. That's why I need to know the step-by-step procedures that RL researchers usually ...
1
vote
1answer
115 views

Once the environments are vectorized, how do I have to gather immediate experiences for the agent?

My main purpose right now is to train an agent using the A2C algorithm to solve the Atari Breakout game. So far I have succeeded to create that code with a single agent and environment. To break the ...
1
vote
0answers
32 views

What is the difference between FC and MLP in as used in PointNet?

I am trying to understand the PointNet network for dealing with point clouds and struggling with understanding the difference between FC and MLP: "FC is fully connected layer operating on each ...
1
vote
0answers
23 views

How can I use GPT-2 to modify seed text of one form into a different form (LENGTH INVARIANT) whilst retaining meaning?

I am currently starting a research project whereby I am trying to convert text of one form into another. i.e. If I were to write a seed sentance of the form "Scientists have finally achieved the ...
1
vote
0answers
153 views

Replace epsilon greedy action selection and the standard DQN by an Independent Gaussian Noise Network Model

Here is my code Recently, I solved the game of Atari Breakout using a classic DQN model. The convergence of the mean reward slowly improved during three days. I was interested in learning a method ...
1
vote
1answer
40 views
1
vote
0answers
35 views

Is it possible to do token classification using a model such as GPT-2?

I am trying to use PyTorch's transformers as a part of a research project to do sentiment analysis of several types of review data (laptop and restaurant). To do this, my team is taking a token-...
1
vote
1answer
44 views

time-series prediction : loss going down, then stagnates with very high variance

I am trying to design a model based on LSTM cells to do time-series prediction. The ouput value is an integer in [0,13]. I have noticed that one-hot encoding it and ...
1
vote
0answers
47 views

What are the pros and cons of Keras, PyTorch and Caffe for computer vision?

I have tried to get the basic grasp of the following deep learning frameworks with python: Keras Pytorch Caffe However, I have lately noticed that people in the computer vision community care less ...
1
vote
0answers
30 views

Pytorch deep learning models and tabular data representation

I have quite a naive question regarding Pytorch deep learning models and tabular data representation. So, assume I have a dictionary of tables. Each table has some number of columns: categorical and ...
1
vote
1answer
53 views

RealNVP gives wrong probabilities

I am trying to use RealNVP with some data I have (the input size is a 1D vector of size 22). Here is the link to the RealNVP paper and here is a nice, short explanation of it (the paper is pretty long)...
1
vote
1answer
45 views

Why does PyTorch use a different formula for the cross-entropy?

In my understanding, the formula to calculate the cross-entropy is $$ H(p,q) = - \sum p_i \log(q_i) $$ But in PyTorch nn.CrossEntropyLoss is calculated using this ...
1
vote
0answers
62 views

FastAi How to turn off crop in ImageDataBunch

I just trained my birds model. It works fine when I was testing it with close pictures. But when I moved the pictures further away my camera, the model was not able to detect birds. My guess is in ...
1
vote
0answers
39 views

Why is my variational auto-encoder generating random noise?

This is my first variational autoencoder. Background info: I am using the MNIST digits dataset. The model is created and trained in PyTorch. The model is able to get a reasonably low loss, but the ...
1
vote
0answers
26 views

How can I train a neural network to find the hyper-parameters with which the data was generated?

I have 10000 tuples of numbers (x1, x2, y) generated from the equation: y = np.cos(0.583 * x1) + np.exp(0.112 * x2). I want to ...
1
vote
0answers
46 views

Why are the current means and the old ones the same in this implementation of Elastic Weight Consolidation?

I'm trying to re-implement Elastic Weight Consolidation (EWC) as outlined in this paper. As a reference, I am also using this Github repository (another implementation). My model/idea is pretty ...
1
vote
0answers
12 views

Can Grad CAM feature maps be used for Training?

I am trying to recreate the architecture of the following paper: https://arxiv.org/pdf/1807.03058.pdf Can someone help me in explaining how are the feature maps coming out of the output of GradCam ...
1
vote
0answers
63 views

Focal loss for imbalanced multi class classification in Pytorch

I want an example code for Focal loss in PyTorch for a model with three class prediction. My model outputs 3 probabilities. ...
1
vote
0answers
53 views

How to train LSTM score prediction with very little data? (Bounty to be added)

I am trying to make a text score prediction network, and my dataset have 500 samples only. I know there is a public dataset called the ASAP Dataset. I have tested my model ...
1
vote
0answers
42 views

Initial LSTM hidden state and cell

If we use LSTMCell from torch: The initial hidden and cell layers should be CONSTANT (from the first time you run the program) and saved right? Like random seeds? ...