Questions tagged [pytorch]
For conceptual questions that somehow involve the PyTorch library, but note that programming questions are off-topic here.
269
questions
1
vote
1
answer
18
views
"Window Pane" pattern when training CycleGAN
I've implemented a CycleGAN in Pytorch for style transfer between images. However, I've noticed during training that a distinct "window pane" pattern emerges, regardless of how I tweak ...
0
votes
0
answers
8
views
What is the best architecture for multi-target text regression?
I'm building an AI model using Google's 'Civil-Comments' dataset. It has 7 different labels, each a float than can be anywhere from 0 to 1. Embedding Bags, which I have read about. do not perform well....
0
votes
1
answer
34
views
Loss Function not Decreasing
To practice what I learned about PyTorch, I gave myself the following problem:
Create a model that given a vector, predicts what the 2nd largest number in it is.
For example, ...
0
votes
0
answers
22
views
How can you solve a machine-learning linear-regression problem for a curvilinear relationship?
I'm aghast at how difficult of a problem it is for me to solve the function f(x) = x^2 with a linear-regression multi-layer-perceptron approach with PyTorch.
I'm ...
0
votes
0
answers
32
views
YOLOv1 - Why do we predict multiple bounding boxes?
When you look at the YOLOv1 paper and corresponding implementations it is always mentioned that
for every grid cell, we predict B bounding boxes (usually two).
Then we use IoU to choose the ...
1
vote
1
answer
91
views
Custom Loss Function Traps Network in Local Optima
I am working with a feedforward neural network to fit the following simple function:
N(1) = -1
N(2) = -1
N(3) = 1
N(4) = -1
But I don't want to use the Mean-...
1
vote
0
answers
20
views
Any tutorials/courses to learn variational autoencoders on tabular data?
I aim to use variational autoencoders (VAE) to find interpretable latent spaces for genetic data. So, I need to understand how they work, what activation function to use, etc. But all tutorials and ...
0
votes
0
answers
18
views
How to implement differentiable sinusoidal basis functions for a convolutional FFT module in torch
I currently have made a convolutional network module in torch that makes the basis functions in the usual way fourier_basis = np.fft.fft(np.eye(frame_size)) and I ...
0
votes
0
answers
31
views
How can I change the tokens BERT uses so that each digit is a separate token?
Rather than have the tokenizer generate this sort of thing:
"$1009 Dollars" => ["$", "100#", "9", "Dollars"]
I'...
0
votes
0
answers
23
views
PPO with multiple actions per action vector
I would like to have the following vector for example [0.2,0.6,0.3,0.4,0.8] end up looking like this after training [0,1,0,0,1].
In other words , rather than choosing one action, I'm choosing more ...
0
votes
0
answers
21
views
PyTorch and Opacus for Differential Privacy
When testing an example code from the TensorFlow website using Jupyter Notebook, which is available at the following link: [LINK_1], I encountered an error. You can find my question about that error ...
0
votes
0
answers
14
views
Spikes in Loss During Training both train/val datasets with LSTM
I'm seeing good results I think, but I want to understand why these spikes in loss are occuring.
As you can see, it would appear that my training is working as it should, but every 200 or so epochs ...
0
votes
0
answers
22
views
Transformer Loss Function for Music Generation
I am working on a Midi Generation project that takes tracks as inputs, and outputs a complimentary track of notes.
The tracks are basically a list of notes created of:
Time
Duration
Pitch
Velocity
I ...
0
votes
0
answers
12
views
What is the reason for the difference between the expected input tensor order for LSTM and Conv1d?
What is the reason for the difference between the expected input tensor order for LSTM and Conv1d?
Say I have an input tensor for time series data of shape ...
0
votes
0
answers
15
views
(distributed) DataLoader when batches are correlated, pitfals?
I know how to implement Datasets and Dataloaders in pytorch.
However, when it comes to distributed and correlated batch generation, I need advise.
Background
I have a network that generates a new ...
0
votes
0
answers
39
views
SSIM in validation higher then SSIM in training for image denoising
I'm working to denoise microscopy images using a 2D U-Net. I'm training my network on images taken at different z-levels, and these images have ground truth, which is the mean of the images in z. ...
1
vote
1
answer
42
views
How to calculate the gradient for the output with respect to the input pixels
Hi for my project I'm using a somewhat simple CNN consisting of several convolution layers and pooling layers. Essentially the model is trained to perform a blur of sorts on an input image.
For my ...
1
vote
0
answers
42
views
Memory consumption issues during the validation phase/loop [closed]
Context:
I am trying to fine-tune codet5-base model for a use-case on AWS's g5.2xlarge instance, and the following were my ...
2
votes
1
answer
67
views
Why are all the gradients values 0 except for the first iteration?
I am fine-tuning a mistral-7b with Hugging Face peft and quantization. In my training loop, I am printing the gradient values ...
-1
votes
1
answer
479
views
Difference between .pt and .pth extensions in PyTorch model saving [closed]
I'm working on developing models using PyTorch and frequently experiment with pre-trained models. 've read through the PyTorch documentation.
When saving models, I've noticed that sometimes the files ...
0
votes
0
answers
28
views
CNN: Accuracy gap of 5-7 % between accuracy computed on-the-fly and separate model evaluation on the training set
I am training a CNN for some basic classification task. During training, I compute the training accuracy after every epoch. After the training has finished, I evaluate the model again on the entire ...
0
votes
2
answers
80
views
Does 1-bit quantization (layers with boolean tensors) machine learning exist?
Does 1-bit quantization machine learning exist?
Pytorch's docs on "Quantization" define it as:
techniques for performing computations and storing tensors at lower bitwidths than floating ...
-1
votes
1
answer
53
views
Pytorch Encoder not working [closed]
I have a problem understanding how Pytorch and Pytorch-Lightning work. I'm trying to build a toy Autoencoder and it giving me the typical mat1 and mat2 error. My code is:
...
1
vote
0
answers
33
views
Proper way to load a RL (reinforcement learning) model (pytorch) for "testing"...?
I'm working on a RL problem where, in a nutshell, an agent has to go from point A to point B, in that order, with as few steps as possible, using DQN with PyTorch, to train the agent.
During training, ...
1
vote
0
answers
36
views
What’s more efficient in multihead attention: multiply QKV by $W_i$ then split or linearly project QKV $h$ times into dimensions $d_k$?
I’m looking to bridge two implementations of multihead attention.
Approach 1: Multiply and Split
Each of the queries, keys, and values is multiplied by a separate square weight matrix of size (...
0
votes
0
answers
11
views
Incredibly High CrossEntropyLoss in Sequence-to-Sequence Generation
I'm trying to do SMILES chemical representation prediction from a large dataset (Around 5M Samples) to teach it do predict another downstream task. The model's part responsible for generating the data ...
0
votes
0
answers
26
views
Reinforcement Learning Gymnasium ValueError
I am testing out reinforcement learning for the first time with gymnasium. I am following a youtube tutorial.
I am getting the following error when I run the training loop:
ValueError: setting an ...
0
votes
0
answers
74
views
Any reasons LSTM does not pick up any patterns?
I'm trying to teach an LSTM to predict the next values in 3 related series. (Financial data)
Unfortunately, it looks like I made some basic mistake and this network never gets past just returning ...
1
vote
0
answers
26
views
Why completely two different algorithms are being used in Deep Q Learning?
I'm a new student in reinforcement learning. Recently, I've been studying about different algorithms of RL. But I'm quite surprized that there are some algorithms which are named as "same" ...
0
votes
2
answers
39
views
Neural network for specific numbers from a range (Q learning)
PROBLEM AT HAND: I have a resource (Bandwidth) of B Hz. I have to distribute the bandwidth B to users as per their requirements. For instance, voice calls would require some amount of bandwidth while ...
0
votes
0
answers
54
views
Graph-Level Regression Task
I'm currently working on a system that predicts energy consumption of a set of buildings using graph convolutionals networks (GCN), which is a Graph-Level regression task (1 prediction for every ...
0
votes
0
answers
42
views
Advice on Moving Object Segmentation with U-Net where the target is small
I have a problem I'm trying to solve. I'd like to spot a moving object in a video sequence. "Moving Object" is very vague, but it can be roughly defined as 'here is a bright point that seems ...
0
votes
0
answers
26
views
Why the architeture of Resnet18 is suitable to images classification?
I am studying convolutional networks and in particular I have focused on the ResNet18 network. I've been studying ResNet18 and understand the purpose of skip connections and residual network. However,...
0
votes
1
answer
58
views
Why does SSIM in pytorch-mssim need the data range to be specified?
The SSIM metric (https://en.wikipedia.org/wiki/Structural_similarity_index_measure) formulas do not seem to depend on the range of the values the pixel have (from 0 to 1, from 0 to 255, or any other ...
0
votes
0
answers
12
views
Trying to use my first created Knowledge graph embeddings model
I'm trying to learn about creating and using knowledge graph embeddings models, I got a code, adapted it until I got no compiling or executing errors but now the predictions it mades are wrong. This ...
0
votes
0
answers
24
views
Multimodal architecture: how to train it
I have a set of graphs, a set of sequences and a set of summary stats, the elements in the three sets correspond to each other. I am not satisfied with the regression performance from one single ...
0
votes
0
answers
24
views
Influence of Unused FFN on Model Accuracy in PyTorch
I am encountering a peculiar issue with my PyTorch model where the presence of an initialized but unused FeedForward Network (FFN) affects the model's accuracy. Specifically, when the FFN is ...
0
votes
0
answers
59
views
Yolov8 object detection model visualization in Netron
I trained a YOLOv8 nano detection model with imgsz=320 and 36 classes. When I conver it to ONNX, I get the following message:
...
0
votes
0
answers
31
views
What are some good resources to understand the code for 3D Gaussian Splatting?
I am looking for some good resources like videos or blogs (or other githubs!) that go through the code of Gaussian Splatting and explain the major components and how they are working. Haven't found ...
0
votes
0
answers
36
views
What is the input size and sequence length for lstm when the input is audio data where each audio file is sampled at the rate of 3000hz?
I have music data which contains raw vocals of some indian classical and devotional songs and I have segmented each file into 20 seconds files. I have used librosa.load function with a sample rate of ...
1
vote
0
answers
18
views
re-use D(fake) for optimizing both, G and D when training GANs
When training GANs, I can do this:
pseudo code
opt_g = Optimizer(G.params)
opt_d = Optimizer(D.params)
...
0
votes
0
answers
17
views
Video Summary generation using DL models [video summarization]
I have asked the question here previously but no one asked so, here I am reposting the question.
I am trying to summarize videos based on some Deep-learning models. On doing research, the best I found ...
0
votes
0
answers
40
views
How to generate an image of clothing based on the image of this clothing on some model (person) while preserving details
I have a task to generate an image of clothing based on the image of this clothing on some model (person). I tried different variations of diffusion models to reach the goal, but all of them had ...
0
votes
1
answer
171
views
How do I code so that the embedding output and input share the same weight matrices?
I am trying to implement the Attention is All You Need paper from scratch. The authors mentioned in section 3.4 that "In
our model, we share the same weight matrix between the two embedding ...
1
vote
0
answers
48
views
How to fine-tune pre-trained model? [closed]
I'm trying to classify a data set of medical images with a pre-trained model EfficientNetB0. I've written a code in Python with Pytorch to train my model and fine-tune it but I would like to know if ...
0
votes
0
answers
21
views
How to structure encoder and decoder input sequences when building transformers model from scratch
I built a transformers model from scratch in PyTorch. I trained it on a novel in the public domain. My sequences are 30 tokens and the first encoder and decoder sequences, for example, are tokens 0-...
0
votes
0
answers
55
views
What best practices for VAE do you know?
The data is binary voxel data of shape (60, 36, 60). I want to compress such data into ...
0
votes
1
answer
684
views
Why does the latent space in Stable Diffusion have a shape of 64x64x3?
Since the encoding is performed by a Variational Autoencoder, the VAE encoder must output some mean and log variance that we can ...
0
votes
1
answer
53
views
3D Unet gives "output size is too small" error [closed]
I wrote simple 3D-Unet arch in pytorch to do segmentation on 3D images.
...
1
vote
1
answer
217
views
Batch wise Inference to speed up Muzero's MCTS
Context:
I've implemented Muzero for the game Tic-tac-toe.
Unfortunately, the self-play and training is very slow (like 10 hours until it plays quite well).
I ran the python profiler to find the ...