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
2 views

not able to show evaluation metrics for object detection on MSCOCO like dataset using FASTAI

I want to show evaluation metrics for coco object detection,I have saved my learner in .pth file and I have data in variable data(databunch type fastai) , I have the code from the notebook finding ...
user avatar
0 votes
0 answers
9 views

Train a unique model over multiple time series

I'm currently working in a project involving time series. I have nearly 100 univariate time series (representing the performance of an engine of cars between 2018 and 2022). My goal is to forecast the ...
user avatar
1 vote
1 answer
14 views

Understand the reason of embedding and the size inside it in Pytorch

I'm very new to pytorch - taking a course in udemy. There is something I find hard to understand and would like to get explaination about, in a bit simpler words than what I can find in the ...
user avatar
  • 349
0 votes
0 answers
3 views

What happens in a transposed convolution when the stride is bigger than the kernel width/height?

In Pytorch's transposed convolution API, you can specify a stride that is larger than the kernel_size. For example: Input image of size 2x2 Kernel of size 2x2 ...
user avatar
  • 115
1 vote
1 answer
16 views

In LSTM why h_t output twice?

According the LSTM design: The hidden state (ht) is output twice (1 and 2 in the picture). If they are the same, why we need them twice ? Is there a different use for each one of them ? According to ...
user avatar
0 votes
0 answers
11 views

nn.NLLLoss() gives negative result - what it's mean?

I saw code which use nn.NLLLoss() (negative log likelihood loss). I looked on the results and some loss results (result of ...
user avatar
0 votes
1 answer
22 views

How to reduce the size of Bert model(checkpoint/model_state.bin) using pytorch

I used torch.quantization.quantize_dynamic to reduce the model size but it is reducing my prediction Accuracy score. I'm using that model file inside the Flask and ...
user avatar
0 votes
1 answer
24 views

What is the right Pytorch RNN implementation?

I read about RNN in pytorch: RNN — PyTorch 1.12 documentation. According to the document the RNN run the following function: I looked on another RNN example (from pytorch tutorial): NLP FROM SCRATCH: ...
user avatar
0 votes
0 answers
9 views

Retraining Single Shot MultiBox Detector model on a custom data set?

Has anyone had any success retraining one of pytorch's saved SSD models using a custom dataset? I'm having a hard time finding documentation about what the input images need to look like, target ...
user avatar
0 votes
0 answers
20 views

Are there examples of quantization aware neural networks

I'm looking for examples of Machine Learning / Neural Networks examples that work with quantized weights, activation functions,.... The simple approach of training with floating point parameters and ...
user avatar
  • 101
0 votes
0 answers
10 views

How can we determine if the model does require an image or not while predicting?

I've this sentiment analysis task, where the dataset comprises an image and a comment for prediction. I want to determine if the image is really necessary for the task or not, is there any way I can ...
user avatar
1 vote
1 answer
18 views

BertTokenizer Loading Problem

I loaded this BertTokenizer previously, but now it is showing, I have to make sure I don't have a local directory. In my kaggle kernel, I don't have this local directory. How to solve it? ...
user avatar
0 votes
0 answers
7 views

Need help in intepreting the output of plot_prediction_actual_by_variable() in Temporal Fusion Transformer [closed]

I would need some help to interpret the plot produced by plot_prediction_actual_by_variable() in TFT. See tutorial here: https://pytorch-forecasting.readthedocs.io/en/stable/tutorials/stallion.html I ...
user avatar
0 votes
0 answers
14 views

Learning Rate Finder doesn't work with Tversky Loss, any idea?

I'm working with a UNet on a binary segmentation problem. As my dataset is extremely imbalanced (sometimes the objects I'm trying to segment are really, really small) I'd like to use the Tversky Loss ...
user avatar
0 votes
0 answers
24 views

Do I need to install apex for fairseq if I have pytorch >= 1.10?

In installation section of fairseq toolkit there are instructions "For faster training install NVIDIA's apex library", but in we have torch.cuda.amp already added into pytorch. So my ...
user avatar
0 votes
0 answers
39 views

Temporal Fusion Transformer from PyTorch-Forecasting with Multiple Targets - 'list' error

New to PyTorch and the PyTorch Forecasting library and trying to predict multiple targets using the Temporal Fusion Transformer model. I have 7 targets in a list as my targets variable. I'm using ...
user avatar
0 votes
0 answers
49 views

Input type (MPSFloatType) and weight type (torch.FloatTensor) should be the same

I am trying to run this notebook on Apple M1 (1st gen) running MacOS 12.4, libs freeze: ...
user avatar
0 votes
0 answers
21 views

extract features from parts of one image

I have several parts of one image that have one caption... I need to do image captioning by evaluating every part of the image to which the caption will belong so do I need to extract the features ...
user avatar
  • 1
0 votes
0 answers
18 views

Neural Network Stuck at Low Accuracy

I am new to deep learning so forgive me if this is an obvious mistake, I have tried to find similar questions online yet none seem relevant to my problem. I am using pytorch for image classification ...
user avatar
0 votes
0 answers
13 views

Initialization of VGG layer weights in pytorch

In config file, VGG layer weights are initialized using this way: ...
user avatar
0 votes
0 answers
50 views

Pretrain RoBERTa model with new data using PyTorch library

I've pretrained the RoBERTa model with new data using a 'simpletransformers' library: ...
user avatar
  • 105
0 votes
0 answers
10 views

Understanding nn.Conv2D in pytorch

I am trying to learn the basic of pytorch so I can assemble my own CNN's. One thing I am also trying to learn is navigating the API documentation. Specifically at the moment I am trying to read ...
user avatar
0 votes
0 answers
16 views

How to train ML model for time series data

I am trying to build a machine learning model in python. I used pytorch and sklearn to make the model. My model is a bit ...
user avatar
  • 101
1 vote
1 answer
39 views

What is the purpose of Sequence Length parameter in RNN (specifically on PyTorch)?

I am trying to understand RNN. I got a good sense of how it works on theory. But then on PyTorch you have two extra dimensions to your input data: batch size (number of batches) and sequence length. ...
user avatar
  • 13
1 vote
0 answers
35 views

Accuracy drops when adding a fully connected layer for dimensionality reduction to a ResNet50

I'm training a ResNet50 for image classification and I'm interested in decreasing the dimensionality of the embedded layer, in order to apply some clustering techniques. The suggested dimension is ...
user avatar
  • 61
0 votes
0 answers
21 views

dimension of input image for pyTorch VGG16

I have implemented the codes: https://towardsdatascience.com/image-feature-extraction-using-pytorch-e3b327c3607a?gi=7b5fd7b03ed1 for image feature extraction. But it is confusing that both 224*224 ...
user avatar
0 votes
1 answer
10 views

expanding 1x1xn global average pooling output to the size of the input map HxWxn

I am trying to recreate the model in this paper : BiSeNetV2 There is one module called Context Embedding Block, in which Global Average Pooling is used to embed global information into the feature ...
user avatar
0 votes
0 answers
33 views

pytorch resize and pad image

Does torch have the same functionality as tf.image.resize_with_pad? I need to resize a picture and pad it with zeros to a wanted size. E.g: ...
user avatar
0 votes
0 answers
4 views

At the first epochs, what will segmentation model get?

I am working at a semantic segmentation problem now, with 5-classes task. But when I running on validation function and output my probablities map. I found that with the background class (the extra ...
user avatar
0 votes
0 answers
82 views

Should batch normalization make my eval inference so dependent on the batch size?

I am using pytorch, and the relevant piece of code is below, from my .forward call: ...
user avatar
0 votes
1 answer
22 views

How do i generate text from ids in Torchtext's sentencepiece_numericalizer?

The torchtext sentencepiece_numericalizer() outputs a generator with indices SentencePiece model corresponding to token in the input sentence. From the generator, I ...
user avatar
  • 17
0 votes
0 answers
14 views

How to vectorize this loop process

Hi guys I want to ask if anyone knows how to vectorize this code to make it more optimal and faster. ...
user avatar
0 votes
0 answers
29 views

Training using a dataset on NAS server

I have 2 questions: how would you approach the storage of datasets (with millions of small files) on local network? And how would you take that into account in pytorch code? Hello, I need to store ...
user avatar
0 votes
1 answer
85 views

How to make an ensemble model for classification with pytorch using trained models?

I am trying to make an ensemble model composed of two pre-trained models, using torch, in order to classify an image. Below is some code, based on this post. ...
user avatar
  • 121
0 votes
0 answers
12 views

Dimensionality of CNN and a linear function

Hi I need help understanding how the nn.linear can be implemented in a neural network without problems dimensionality. EDIT I think my problem relates to understanding the relationship between in and ...
user avatar
0 votes
0 answers
17 views

From what function do come the gradients that I use to adjust weights?

I have a question about the loss function and the gradient. So I'm following the fastai (https://github.com/fastai/fastbook) course and at the end of 4th chapter, I got myself wondering. From what ...
user avatar
0 votes
0 answers
12 views

Should Grad-Cam attributions be greater than 1?

I'm using the captum library to calculate LayerGradCam. layer_gc = LayerGradCam(model, model.layer4) attr = layer_gc.attribute(x, class_idx, relu_attributions=True) ...
user avatar
  • 33
0 votes
0 answers
7 views

Unable to debug where torch Adam optimiser is going wrong

I was implementing a training loop in vscode. I have created a Adam optimizer using XLM-Roberta model as follows: ...
user avatar
  • 137
0 votes
0 answers
94 views

While training BERT variant, getting IndexError: index out of range in self

While training XLMRobertaForSequenceClassification: ...
user avatar
  • 137
0 votes
0 answers
8 views

LSTM Auto-encoder Implementation

I'm trying to implement an LSTM auto-encoder in PyTorch for time-series data (univariate and/or multi-variate). Initially, I assumed it would be fairly easy but I realised there are a few ...
user avatar
0 votes
0 answers
34 views

Loss stuck for regression model

I'm training a model that returns 2 parameters. These two parameters are used for classical image processing: a threshold for the kirsch-operator the number of iterations for billateral filter. The ...
user avatar
  • 11
0 votes
0 answers
34 views

Keras vs PyTorch vs Tensorflow

I would like to get started in deep learning but I don't know which framework to start with. Which one do you advise me? More power? Easier to learn? thanks and best regards.
user avatar
  • 302
0 votes
0 answers
26 views

While doing inference with a Transformer-Decoder in batches, how can I stop each sequence separately (if possible)?

So my decoder is a transformer-decoder and in training I don't have any issue. I have all the input from the beggining and correctly masked. However, in inference I have to get a new token at a time ...
user avatar
0 votes
0 answers
15 views

How to produce these tensors efficiently/fast?

I would like to produce the following tensor of size (N*N) where the ones (D) appear as follows: ...
user avatar
1 vote
0 answers
23 views

How to train a Task Specific Knowledge Distillation model using Hugging face model

I was referring to this code: https://github.com/philschmid/knowledge-distillation-transformers-pytorch-sagemaker/blob/master/knowledge-distillation.ipynb From @philschmid I could follow most of the ...
user avatar
  • 257
1 vote
0 answers
17 views

How does bert produce variable output shape?

Suppose if I provide a list of sentences: ['I like python', 'I am learning python', # longest sentence of length 4 tokens 'Python is simple'] Bert will produce ...
user avatar
1 vote
0 answers
154 views

How to save hugging face fine tuned model using pytorch and distributed training

I am fine tuning masked language model from XLM Roberta large on google machine specs. When I copy the model using gsutil and subprocess from container to GCP ...
user avatar
  • 257
0 votes
0 answers
35 views

Complex balanced dataloading from multiple imbalanced datasets?

The Setting Let's suppose that I have an imbalanced dataset. For training purposes, I want to implement a dataloading scheme that samples from this dataset in a more balanced way. I want to leverage ...
user avatar
0 votes
0 answers
57 views

Do the multiple heads in Multi head attention actually lead to more parameters or different outputs?

I am trying to understand Transformers. While I understand the concept of the encoder-decoder structure and the idea behind self-attention what I am stuck at is the "multi head part" of the &...
user avatar
0 votes
0 answers
52 views

When would I use model.to("cuda:1") as opposed to model.to("cuda:0")?

I have a user with two GPU's; the first one is AMD which can't run CUDA, and the second one is a cuda-capable NVIDIA GPU. I am using the code ...
user avatar
  • 101

1
2 3 4 5
12