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

Semantic segmentation sometimes give bad result

I'm training Unet+MobileNetV3 for semantic segmentation objects on real photos using custom dataset and get strange results. I have already accumulated pretty big dataset and constantly improve it by ...
Vladislav D's user avatar
0 votes
0 answers
5 views

Seeking ML Model Recommendations for Enhancing OCR on Corrupted Text Images

I am working on a project where I need to perform Optical Character Recognition (OCR) on text-based images. However, these images are corrupted in various ways (e.g., blurred, distorted, low ...
Nurbek Ss's user avatar
0 votes
0 answers
5 views

Safetensors are slower than torch.load. Why?

Lately, I have been testing safetensors. It claims that the safetensors are faster and safer than pickle. So I did my own comparison with the code below: ...
mark's user avatar
  • 103
0 votes
0 answers
23 views

Is creating a new model through the weighted average of the best models in hyperparameter-tuning a (good) thing?

I'm currently working on a forecasting project with python/pytorch, I coded a very simple hyperparameter-tuner that randomly picks hyperparameters and saves the model and performance stats. I'm ...
M Splett's user avatar
1 vote
0 answers
22 views

How to apply this schematic of a CNN?

I'm trying to apply a model from a paper to my problem, however I get very poor results (R² = 0.1 for regression). I think I don't understand the schematic drawing of the CNN used in the paper. Could ...
YPOC's user avatar
  • 111
1 vote
1 answer
15 views

Extraction of name from phonetic transcription

I have a use case where I want to extract the name from the phonetic transcription. For example if the phonetic transcription is - “m a j n e j m ɪ z s ʌ m i ɹ z o w ʃ i”, the output should be the ...
Sameer Joshi's user avatar
0 votes
0 answers
36 views

reverse summary matching

How can we develop a model to assess the relationship between a summary and a text, enabling it to determine their coherence but in reverse? Also, how to make an inference We have list of texts (2000) ...
whoopdedoo's user avatar
-1 votes
0 answers
20 views

Environment setup advice [closed]

For frameworks, PyTorch and TensorFlow seem like the go-to choices. Which one would you recommend for ST-GNNs, and are there any specific libraries (like PyTorch Geometric) that are particularly ...
SpooningSea's user avatar
-1 votes
1 answer
51 views

Why is my NN model's prediciton for y= sinc(x) function showing symmetric?

...
RimaMonica's user avatar
0 votes
1 answer
20 views

How to get the closest samples to time series dataset?

I have a deep learning time series classification model. I want to understand if the model failed to classify, due to missing or incorrupt training inputs. For simplicity let's say we have a training ...
user3668129's user avatar
1 vote
1 answer
27 views

How to add a new item in the embeddings vocabulary?

Imagine you have trained a model containing an Embedding layer. Your model performs well and you're happy with your embedding. Then, suddenly, you want to add a new item in your vocabulary. In other ...
MarcoM's user avatar
  • 111
0 votes
0 answers
16 views

Custom loss function for collinearity of 3 embeddings

I am trying to implement a loss function that takes as input 3 embeddings and output a value that is proportional to the collinearity of the embeddings. This is to shape the latent space of a ...
vlc's user avatar
  • 1
0 votes
0 answers
14 views

How to detect abnormal fetal head size with image classification?

I'm writing Python code to predict fetal head circumference 10mm range using classification. The model will train to classify a fetal head image into a range (e.g., 50–60 mm) representing its ...
NiStack's user avatar
0 votes
1 answer
23 views

Performance difference between two equivalent ML codes

Using the two Python libraries GPyTorch and scikit-learn to perform Gaussian Process Regression (GPR) for a machine learning task, I have encountered a problem I failed to solve during the last days. ...
C_Swann22's user avatar
  • 111
0 votes
0 answers
9 views

Help with a MaNet finetuning (binary semantic segmentation task)

Introduction: I am currently working on a computer vision problem, I have satellite images and I have to detect a particular archeological structure (Tell). I have access to the previously made ...
Alessandro Pistola's user avatar
1 vote
2 answers
28 views

Image segmentations vs image detection

If I need to detect on an image some objects and we are only interested in counting them, between image segmentation and object detection which one would you think would yield best results in terms of ...
Dinu Mihai's user avatar
0 votes
0 answers
6 views

Is it fair to say that Hausdorff Distance (HD) focuses on low level details while dice score (DSC) high level

I wonder if its make sense to say that Hausdorff Distance (HD) measures low-level details while dice score (DSC) focuses on high levels. If you could cite a paper, I would appreciate it.
user836026's user avatar
0 votes
0 answers
25 views

CNN segmentation models: class weights specification on IoU metric

I am building a MANet model using pytorch lightning. For getting the model I use the library segmentation models. As my objective is to do binary semantic segmentation, during the test phase I ...
Alessandro Pistola's user avatar
0 votes
0 answers
22 views

why does my multi-modal model can not learn anything?

I have a multi-modal model. I want to train it using the Pytorch Framework. I have a balanced dataset. I have approximately 150 samples for each client. (I had preprocessed my text data.) when I train ...
arcane_data's user avatar
0 votes
0 answers
9 views

Relationship among different classifiers of a model in multiclass problems

Suppose we are fitting a LogisticRegression model with scikit-learn, or the same model with pytorch. In multiclass problems, the strategy OneVsRest will fit a different classifier for each of the ...
CasellaJr's user avatar
  • 229
0 votes
1 answer
108 views

Transformers Trainer: "RuntimeError: module must have its parameters ... on device cuda:6 (device_ids[0]) but found one of them on device: cuda:0"

I ask this since I could not fix it with the help of: Stack Overflow RuntimeError: module must have its parameters and buffers on device cuda:1 (device_ids[0]) but found one of them on device: cuda:2 ...
questionto42's user avatar
1 vote
1 answer
56 views

"model.to('cuda:6')" becomes (nvidia-smi) GPU 4, same with any other "cuda:MY_GPU", only "cuda:0" becomes GPU 0. How do I get rid of this mapping?

Strange mapping: example In the following example, the first column is chosen in the code, second column is the one that does the work instead: 0:0 1234 MiB 1:2 1234 MiB 2:7 1234 MiB 3:5 2341 MiB 4:1 ...
questionto42's user avatar
0 votes
0 answers
21 views

Why does Mistral model or in general Large language models have very low percentage of trainable parameters compared to total number of parameters of?

I am using the below function to print the trainable parameters. I am getting this output: trainable params: 262410240 || all params: 7241732096 || trainable%: 3.6235839233122604 ...
SRIVATSA KULKARNI's user avatar
0 votes
0 answers
10 views

Why do all the resulting curves from my function combining N-many random ReLUs look like quadratics?

I've written a function that generates a sum of N-many RelU functions, with random slopes and activation points. I was expecting these resulting functions to be arbitrary, random curves, but for some ...
Marco Acea's user avatar
1 vote
1 answer
68 views

Is this the correct way to calculate word embeddings using Roberta?

I'm trying to write a program that using Roberta to calculate word embeddings: ...
David's user avatar
  • 13
0 votes
1 answer
35 views

How to prevent update a pretrained model if a model is optimized with backpropagation in Pytorch?

I use Pytorch exclusively to develop my model, and these are components in my model and how it works: A generator An encoder: a pretrained, and should not updated. A loss function. Input is passed to ...
Jesse's user avatar
  • 1
0 votes
0 answers
26 views

Loss Function does not decrease when positivity constraint is added

I have tried coding up an autograd program in Pytorch to perform a reconstruction of an complex valued image. When I run the autograd normally, it produces a semi-accurate reconstruction of the image ...
yes's user avatar
  • 1
0 votes
2 answers
37 views

How can I use a model trained with batches to make predictions with single sample?

I'm training a PyTorch model with batches of 128 images, and after going through multiple convolutions, they're flattened (with .flatten) before being passed to a ...
Jake's user avatar
  • 1
0 votes
0 answers
23 views

Can't show images outputted by a VAE with pyplot.imshow - wrong dimensions

I'm trying to show images generated by a variational autoencoder using pyplot.imshow and make_grid. I can't show them, though, with the following error: "TypeError: Invalid shape (64, 530, 42) ...
avpol's user avatar
  • 11
0 votes
0 answers
26 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
26 views

How to get Audio embeddings using Hubert model

Example code: ...
Pulkit Mehta's user avatar
0 votes
0 answers
27 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
93 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
  • 21
0 votes
1 answer
14 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
32 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
  • 111
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
50 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
29 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
95 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
61 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
14 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
78 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
30 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
50 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
10 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

1
2 3 4 5
15