name
stringlengths
15
255
question
stringlengths
20
1.77k
questionUpvotes
int64
0
23
timeCreated
stringlengths
24
24
answer
stringlengths
9
1.09k
answerUpvotes
int64
0
75
timeAnswered
stringlengths
24
24
answerURL
stringlengths
50
285
context
stringlengths
244
1.73k
answer_start
int64
0
3.45k
answers
stringlengths
46
1.14k
Constant Prediction in CNN
Ok, so I have a model to predict the class of image, cat or dog. I receive %95 accuracy in training. But for some reason, I stuck with constant output when I try to predict single image. I read similar topics from forum but that hasn’t contributed much in my case. Below, you can find all info. Pls…
0
2020-07-19T02:51:06.473Z
Hey, problem was, when I predicting on single image, I did not scale the image, which is nothing but a single line code: x= x/255.0 Now, this works fantastic! Thanks a lot for your instructions too ^^.
1
2020-07-20T18:20:38.221Z
https://discuss.pytorch.org/t/constant-prediction-in-cnn/89745/8
Yes, resizing in general changes the pixel values. For resizing targets (e.g. segmentation masks) we usually apply “nearest” interpolation mode. In this mode, resizing is approx equivalent to removing columns and lines => that new pixels are exactly the same to the source. For other modes, new pixel… It seems...
613
{'text': ['Hey, problem was, when I predicting on single image, I did not scale the image, which is nothing but a single line code: x= x/255.0\n\nNow, this works fantastic! Thanks a lot for your instructions too ^^.'], 'answer_start': [613]}
Get encoder from trained UNet
Hi, I have a trained a UNet model on some images but now, I want to extract the encoder part of the model. My UNet has the following architecture: UNet( (conv_final): Conv2d(8, 1, kernel_size=(1, 1), stride=(1, 1)) (down_convs): ModuleList( (0): DownConv( (conv1): Conv2d(1, 8, kernel…
0
2020-09-03T11:31:59.573Z
Thanks for the notebook. The DownConv layer returns a tuple in <a href="https://github.com/Flock1/solar/blob/6545a8165e622f5dc27ce34f8b3cece9b7eb832f/model.py#L70">this line of code</a>, which doesn’t work in an nn.Sequential container and standard layers. If you want to accept the tuple in the next layer, you could ...
1
2020-09-21T05:57:09.251Z
https://discuss.pytorch.org/t/get-encoder-from-trained-unet/95053/21
Thanks for the notebook. The DownConv layer returns a tuple in <a href="https://github.com/Flock1/solar/blob/6545a8165e622f5dc27ce34f8b3cece9b7eb832f/model.py#L70">this line of code</a>, which doesn’t work in an nn.Sequential container and standard layers. If you want to accept the tuple in the next layer, you could ...
1,630
{'text': ['Thanks for the notebook.\n\nThe DownConv layer returns a tuple in <a href="https://github.com/Flock1/solar/blob/6545a8165e622f5dc27ce34f8b3cece9b7eb832f/model.py#L70">this line of code</a>, which doesn’t work in an nn.Sequential container and standard layers.\n\nIf you want to accept the tuple in the next la...
Can someone provide the steps to upload my pytorch project on Google Colab?
Hi all, I want to run my project on google colab, as dnt have GPU facility. Uptill now I have uploaded the complete project file in my drive. What should be next, Plz give me a step wise process . My project has several parts (.py files) and dataset too. Regards
0
2020-11-02T08:25:56.158Z
Sorry for the late reply :pray: I don’t know about you but when I program, I like to run my code on the terminal of the operating system I’m using windows or Linux and not on the IDE (this is just my preference) So it’s kinda similar to colab. Colab uses Linux as it’s operating system and the a p&hellip;
1
2020-11-04T13:45:21.505Z
https://discuss.pytorch.org/t/can-someone-provide-the-steps-to-upload-my-pytorch-project-on-google-colab/101324/9
Thanks for the notebook. The DownConv layer returns a tuple in <a href="https://github.com/Flock1/solar/blob/6545a8165e622f5dc27ce34f8b3cece9b7eb832f/model.py#L70">this line of code</a>, which doesn’t work in an nn.Sequential container and standard layers. If you want to accept the tuple in the next layer, you could ...
1,198
{'text': ['Sorry for the late reply :pray:\n\nI don’t know about you but when I program, I like to run my code on the terminal of the operating system I’m using windows or Linux and not on the IDE (this is just my preference)\n\nSo it’s kinda similar to colab.\n\nColab uses Linux as it’s operating system and the a p&he...
Self-defined function for data augmentation
I define a image flipping class. I am wondering whether this class will realize image flipping during training #flip image class HorizontallyFlipline(object): def __call__(self, img, xx3,xx4): if abs(xx3[-1]-0.5)&gt;0.1 or abs(xx4[-1]-0.5)&gt;0.1: return img.transpose(Image.FLIP_LEFT_RIGH&hellip;
0
2018-10-11T14:07:22.560Z
[image] woaichipinngguo: if self.mirror: Assuming that you set self.mirror only during training, the code looks alright to me.
0
2018-10-12T05:53:33.929Z
https://discuss.pytorch.org/t/self-defined-function-for-data-augmentation/27055/4
Thanks for the notebook. The DownConv layer returns a tuple in <a href="https://github.com/Flock1/solar/blob/6545a8165e622f5dc27ce34f8b3cece9b7eb832f/model.py#L70">this line of code</a>, which doesn’t work in an nn.Sequential container and standard layers. If you want to accept the tuple in the next layer, you could ...
692
{'text': ['[image] woaichipinngguo:\n\nif self.mirror:\n\nAssuming that you set self.mirror only during training, the code looks alright to me.'], 'answer_start': [692]}
How partially load big tensor from file?
I can load a tensor from file like this: X = torch.load(filename) This tensor has a shape torch.Size([30000000]). But I can’t load dataset fully due to memory limits. How can I load only first 3000 numbers from file? And then second portion of 3000 numbers without full load?
0
2020-06-19T16:06:12.828Z
the tricky part about reading your data as a byte stream is that there is no data structure. let say x = (BxCxWxH), then your bytes stream has a size of x = (B * C *W * H). Then you must know the type of your data, i.e int, float, double …etc, and figure out of many bytes each type are to read cor&hellip;
2
2020-06-23T17:27:48.425Z
https://discuss.pytorch.org/t/how-partially-load-big-tensor-from-file/86088/4
the tricky part about reading your data as a byte stream is that there is no data structure. let say x = (BxCxWxH), then your bytes stream has a size of x = (B * C *W * H). Then you must know the type of your data, i.e int, float, double …etc, and figure out of many bytes each type are to read cor&hellip; Didn’t you ...
1,640
{'text': ['the tricky part about reading your data as a byte stream is that there is no data structure.\n\nlet say x = (BxCxWxH), then your bytes stream has a size of x = (B * C *W * H). Then you must know the type of your data, i.e int, float, double …etc, and figure out of many bytes each type are to read cor&hellip...
I'm not getting the correct output from model
Hello. I trained an autoencoder/decoder and saved the model. I loaded the model and took the decoder portion off, in order to extract the features from the middle of the encoder. But when i run the encoder, it states the following error; AttributeError: ‘tuple’ object has no attribute ‘dim’ I &hellip;
0
2019-11-08T19:00:23.786Z
Didn’t you just said that you removed the encoder? So you removed the unpooling layer no? You can see examples of this reshaping in any cnn example, <a href="https://github.com/pytorch/examples/blob/60108edfa3838a823220e16428cb5f98e8e88d53/mnist/main.py#L23" rel="nofollow noopener">this one</a> for example.
0
2019-11-08T21:31:03.511Z
https://discuss.pytorch.org/t/im-not-getting-the-correct-output-from-model/60409/6
the tricky part about reading your data as a byte stream is that there is no data structure. let say x = (BxCxWxH), then your bytes stream has a size of x = (B * C *W * H). Then you must know the type of your data, i.e int, float, double …etc, and figure out of many bytes each type are to read cor&hellip; Didn’t you ...
1,129
{'text': ['Didn’t you just said that you removed the encoder? So you removed the unpooling layer no?\n\nYou can see examples of this reshaping in any cnn example, <a href="https://github.com/pytorch/examples/blob/60108edfa3838a823220e16428cb5f98e8e88d53/mnist/main.py#L23" rel="nofollow noopener">this one</a> for exampl...
Model's parameters update during DDP training
I’m using DDP to train Neural Architecture Search networks which contained a controller and a model network. During training, my controller predictss a model’s architecture that maximize reward. the call looks like this. # both model and controller are torch.nn.DistributedDataParallel arch = contro&hellip;
0
2020-06-23T19:13:02.493Z
IIUC, that will still remove DDP autograd hooks on self._arch. Question, do you need the backward pass to compute the gradients for self._arch? If not, you can explicitly setting self._arch.requires_grad = False before passing the model to DDP ctor to tell DDP to ignore self._arch. Then, the above &hellip;
0
2020-06-24T14:19:13.241Z
https://discuss.pytorch.org/t/models-parameters-update-during-ddp-training/86601/9
the tricky part about reading your data as a byte stream is that there is no data structure. let say x = (BxCxWxH), then your bytes stream has a size of x = (B * C *W * H). Then you must know the type of your data, i.e int, float, double …etc, and figure out of many bytes each type are to read cor&hellip; Didn’t you ...
619
{'text': ['IIUC, that will still remove DDP autograd hooks on self._arch.\n\nQuestion, do you need the backward pass to compute the gradients for self._arch? If not, you can explicitly setting self._arch.requires_grad = False before passing the model to DDP ctor to tell DDP to ignore self._arch. Then, the above &hellip...
Cross Entropy Loss for imbalanced set (binary classification)
Dear community, I am trying to use the weights for the binary classification problem for CrossEntropyLoss and by now I am so lost in it…. In my network I set the output size as 1 and have sigmoid activation function at the end to ensure I get values between 0 and 1. I assume it is probability in m&hellip;
0
2020-12-18T19:43:39.718Z
Hi Alice! Let me answer your question(s) two different ways. [image] Alice_NL: Can I then transform logits to probabilities by a new network model You could, but doing so would be overkill. You can just call the function (or class) version of sigmoid() directly: my_logits = my_model (my_&hellip;
1
2020-12-20T16:36:58.658Z
https://discuss.pytorch.org/t/cross-entropy-loss-for-imbalanced-set-binary-classification/106554/9
Hi Alice! Let me answer your question(s) two different ways. [image] Alice_NL: Can I then transform logits to probabilities by a new network model You could, but doing so would be overkill. You can just call the function (or class) version of sigmoid() directly: my_logits = my_model (my_&hellip; What about havin...
1,854
{'text': ['Hi Alice!\n\nLet me answer your question(s) two different ways.\n\n[image] Alice_NL:\n\nCan I then transform logits to probabilities by a new network model\n\nYou could, but doing so would be overkill. You can just call the\n\nfunction (or class) version of sigmoid() directly:\n\nmy_logits = my_model (my_&h...
Semantic Segmenataion Model Problem
I am working on semantic Segmentation on Pascal VOC 2012 dataset and my model is not working. Please help. My model is like. <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/2X/a/a8e8ffa09e32b959f567d9234fe6d055f59ef44e.jpeg" data-download-href="https://discuss.pytorch.org/uploads/defau...
0
2019-03-23T05:22:09.769Z
What about having some modification on lr_scheduler?
1
2019-03-31T01:24:15.380Z
https://discuss.pytorch.org/t/semantic-segmenataion-model-problem/40678/20
Hi Alice! Let me answer your question(s) two different ways. [image] Alice_NL: Can I then transform logits to probabilities by a new network model You could, but doing so would be overkill. You can just call the function (or class) version of sigmoid() directly: my_logits = my_model (my_&hellip; What about havin...
1,231
{'text': ['What about having some modification on lr_scheduler?'], 'answer_start': [1231]}
Cpu inference - ram increases every iteration
The model I’m running causes memory to increase with every iteration. to load it I do the following: def _load_model(model_path): model = ModelDef(num_classes=35) model.load_state_dict(torch.load(model_path, map_location=&quot;cpu&quot;), strict=False) model.eval() return model to run it I &hellip;
0
2019-11-04T17:46:50.853Z
So after some more debugging I found that if I switch to pytorch cpu the ram stays stable. So it looks like it was a pytorch related bug after all. None the less I loved your keep it simple stupid debugging methods. I think i’ll hang them up on the wall. Thanks, Dan
2
2019-11-05T11:13:39.263Z
https://discuss.pytorch.org/t/cpu-inference-ram-increases-every-iteration/59973/10
Hi Alice! Let me answer your question(s) two different ways. [image] Alice_NL: Can I then transform logits to probabilities by a new network model You could, but doing so would be overkill. You can just call the function (or class) version of sigmoid() directly: my_logits = my_model (my_&hellip; What about havin...
357
{'text': ['So after some more debugging I found that if I switch to pytorch cpu the ram stays stable.\n\nSo it looks like it was a pytorch related bug after all. None the less I loved your keep it simple stupid debugging methods. I think i’ll hang them up on the wall.\n\nThanks,\n\nDan'], 'answer_start': [357]}
Properly implementing DDP in training loop with cleanup, barrier, and its expected output
Hi, I’m currently trying to figure out how to properly implement DDP with cleanup, barrier, and its expected output. While I think gives the dpp tutorial <a href="https://pytorch.org/tutorials/intermediate/ddp_tutorial.html" class="inline-onebox" rel="noopener nofollow ugc">Getting Started with Distributed Data Parall...
0
2022-03-15T08:44:38.155Z
Thanks <a class="mention" href="/u/dmack">@dmack</a> for trying out DDP! Here is my understanding: One way to think about data parallel training is that it increases the effective batch size. If each worker in a world of size W operates on a batch size B, then the effective batch size is W * B. DDP computes the loss ...
1
2022-03-16T16:24:12.926Z
https://discuss.pytorch.org/t/properly-implementing-ddp-in-training-loop-with-cleanup-barrier-and-its-expected-output/146465/4
Thanks <a class="mention" href="/u/dmack">@dmack</a> for trying out DDP! Here is my understanding: One way to think about data parallel training is that it increases the effective batch size. If each worker in a world of size W operates on a batch size B, then the effective batch size is W * B. DDP computes the loss ...
1,252
{'text': ['Thanks <a class="mention" href="/u/dmack">@dmack</a> for trying out DDP! Here is my understanding:\n\nOne way to think about data parallel training is that it increases the effective batch size. If each worker in a world of size W operates on a batch size B, then the effective batch size is W * B.\n\nDDP com...
IndexError: pop from empty list in grad_sample_module.py for opacus version > 0.9
Hi, Im using Opacus to make CT-GAN (<a href="https://github.com/sdv-dev/CTGAN" class="inline-onebox" rel="noopener nofollow ugc">GitHub - sdv-dev/CTGAN: Conditional GAN for generating synthetic tabular data.</a>) differntial private. There is already an implementation who does this: (<a href="https://github.com/open...
0
2021-08-07T18:38:25.754Z
<a class="mention" href="/u/shaanchandra">@shaanchandra</a> From the discussion above, it seems that there are two potential solutions: As <a class="mention" href="/u/knilox">@knilox</a> mentioned above, remove the gradient regularization loss entirely - this may seem that we are not faithfully reproducing the origina...
2
2021-08-26T16:48:29.167Z
https://discuss.pytorch.org/t/indexerror-pop-from-empty-list-in-grad-sample-module-py-for-opacus-version-0-9/128843/12
Thanks <a class="mention" href="/u/dmack">@dmack</a> for trying out DDP! Here is my understanding: One way to think about data parallel training is that it increases the effective batch size. If each worker in a world of size W operates on a batch size B, then the effective batch size is W * B. DDP computes the loss ...
973
{'text': ['<a class="mention" href="/u/shaanchandra">@shaanchandra</a> From the discussion above, it seems that there are two potential solutions:\n\nAs <a class="mention" href="/u/knilox">@knilox</a> mentioned above, remove the gradient regularization loss entirely - this may seem that we are not faithfully reproducin...
Getting Runtime error: element 0 of tensors does not require grad and does not have a grad_fn
Hi there! I am trying to run a simple CNN2LSTM model and facing this error: RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn. The strange part is that the current model is a simpler version of my previous model which worked absolutely fine. To solve this err&hellip;
0
2022-03-25T23:39:06.812Z
The point of initialization wouldn’t matter since you are currently not using outputs at all. I assume you would like to assign some computed values to it at one point, but this code seems to be missing.
1
2022-03-29T17:24:42.588Z
https://discuss.pytorch.org/t/getting-runtime-error-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-grad-fn/147459/10
Thanks <a class="mention" href="/u/dmack">@dmack</a> for trying out DDP! Here is my understanding: One way to think about data parallel training is that it increases the effective batch size. If each worker in a world of size W operates on a batch size B, then the effective batch size is W * B. DDP computes the loss ...
741
{'text': ['The point of initialization wouldn’t matter since you are currently not using outputs at all.\n\nI assume you would like to assign some computed values to it at one point, but this code seems to be missing.'], 'answer_start': [741]}
Error in loss function
Hello, i’m making some changes on a normal CNN, to be compatible with other model, that i create. I get the following error: File “C:/Users/user/.spyder-py3/cnn.py”, line 105, in loss = criterion(output,img) RuntimeError: The size of tensor a (10) must match the size of tensor b (28) at non-sin&hellip;
0
2020-05-14T15:52:14.948Z
I modified your code to this in the for loop: label=torch.tensor([[0, 0, 0], [0, 1, 0], [0, 0, 2]]) output=torch.randn(3, 3, requires_grad=True) loss=criterion(output, label.float()) And it works. If you want to do classification you need to use cross entropy loss. Remember to check s&hellip;
0
2020-05-18T04:53:24.771Z
https://discuss.pytorch.org/t/error-in-loss-function/81228/20
I modified your code to this in the for loop: label=torch.tensor([[0, 0, 0], [0, 1, 0], [0, 0, 2]]) output=torch.randn(3, 3, requires_grad=True) loss=criterion(output, label.float()) And it works. If you want to do classification you need to use cross entropy loss. Remember to check s&hellip; So: tested h5 dataset...
1,890
{'text': ['I modified your code to this in the for loop:\n\nlabel=torch.tensor([[0, 0, 0], [0, 1, 0], [0, 0, 2]])\n\noutput=torch.randn(3, 3, requires_grad=True)\n\nloss=criterion(output, label.float())\n\nAnd it works.\n\nIf you want to do classification you need to use cross entropy loss. Remember to check s&hellip;'...
Dataloader eating ram
I have a dataset of 9 gigs of wav files for music synthesis, and to manage batches across different files i load each file into custom WavFileDataset which i then combine in ConcatDataset to use as a dataset for dataloader. Problems begin when i try to sample from dataloader, even with batch_size = &hellip;
0
2020-03-22T22:22:00.031Z
So: tested h5 dataset, dataloader still crashed my session Turns out, dataset shuffling needs ram, and it needs a lot of it in my case By turning it off it successfully next(iter(dataloader))&#39;s new batches of data Gotta figure out how to do shuffling But at least it is working now
0
2020-03-28T20:07:20.710Z
https://discuss.pytorch.org/t/dataloader-eating-ram/74064/6
I modified your code to this in the for loop: label=torch.tensor([[0, 0, 0], [0, 1, 0], [0, 0, 2]]) output=torch.randn(3, 3, requires_grad=True) loss=criterion(output, label.float()) And it works. If you want to do classification you need to use cross entropy loss. Remember to check s&hellip; So: tested h5 dataset...
1,244
{'text': ['So: tested h5 dataset, dataloader still crashed my session\n\nTurns out, dataset shuffling needs ram, and it needs a lot of it in my case\n\nBy turning it off it successfully next(iter(dataloader))&#39;s new batches of data\n\nGotta figure out how to do shuffling\n\nBut at least it is working now'], 'answer_...
MobileNetV2 + SSDLite quantization results in different model definition
I’m trying to quantize a mobilenetv2 + SSDLite model from https://github.com/qfgaohao/pytorch-ssd I followed the tutorial here https://pytorch.org/tutorials/advanced/static_quantization_tutorial.html doing Post-training static quantization Before quantizing the model definition looks like this S&hellip;
0
2020-03-22T18:16:27.184Z
yeah, you’ll need to quantize lq_model after lq_model = create_mobilenetv2_ssd_lite(len(class_names), is_test=True) before you load from the quantized model
0
2020-03-27T23:26:37.720Z
https://discuss.pytorch.org/t/mobilenetv2-ssdlite-quantization-results-in-different-model-definition/74056/3
I modified your code to this in the for loop: label=torch.tensor([[0, 0, 0], [0, 1, 0], [0, 0, 2]]) output=torch.randn(3, 3, requires_grad=True) loss=criterion(output, label.float()) And it works. If you want to do classification you need to use cross entropy loss. Remember to check s&hellip; So: tested h5 dataset...
589
{'text': ['yeah, you’ll need to quantize lq_model after lq_model = create_mobilenetv2_ssd_lite(len(class_names), is_test=True) before you load from the quantized model'], 'answer_start': [589]}
Laptop shuts down while trainining
My laptop automatically shuts without warning (sometimes) during training. Machine config - Lenovo y540, RTX 2060, Ubuntu 18.04, PyTorch 1.4. I tried training a simple binary image classification model (4 conv layers with batchnorm and Dropout). The model trained for 20 epochs (batch size = 8) and &hellip;
0
2020-03-10T12:25:14.301Z
Hello Mr. Air! [image] theairbend3r: Mar 10 17:10:11 maverick kernel: [ 319.690728] mce: CPU11: Core temperature above threshold, cpu clock throttled (total events = 75) ... Mar 10 17:10:11 maverick kernel: [ 319.690730] mce: CPU11: Package temperature above threshold, cpu clock throttled (to&hellip;
2
2020-03-10T13:46:17.462Z
https://discuss.pytorch.org/t/laptop-shuts-down-while-trainining/72711/2
Hello Mr. Air! [image] theairbend3r: Mar 10 17:10:11 maverick kernel: [ 319.690728] mce: CPU11: Core temperature above threshold, cpu clock throttled (total events = 75) ... Mar 10 17:10:11 maverick kernel: [ 319.690730] mce: CPU11: Package temperature above threshold, cpu clock throttled (to&hellip; Yo, so I’ve ...
1,492
{'text': ['Hello Mr. Air!\n\n[image] theairbend3r:\n\nMar 10 17:10:11 maverick kernel: [ 319.690728] mce: CPU11: Core temperature above threshold, cpu clock throttled (total events = 75)\n\n...\n\nMar 10 17:10:11 maverick kernel: [ 319.690730] mce: CPU11: Package temperature above threshold, cpu clock throttled (to&h...
Accuracy of signal prediction model stuck at 51% after few epochs
So, I’m training a neural network architecture on a particular wave signal detection. the raw data are in .npy files and contains the time domain signal. I did some feature extraction on the time domain signal like: Discrete Fourier Transform to convert the time domain signal to frequency domain &hellip;
0
2021-08-23T19:53:24.809Z
Yo, so I’ve fixed the problem finally The issue was that the NNModel.train() was outside the epoch loop, and in the epoch loop, the testing function is called at the 0th epoch and it toggles the NNModel.train() to NNModel.eval(). So since the NNModel.train() was outside the loop, after the 0th epo&hellip;
1
2021-08-24T16:18:53.437Z
https://discuss.pytorch.org/t/accuracy-of-signal-prediction-model-stuck-at-51-after-few-epochs/130082/27
Hello Mr. Air! [image] theairbend3r: Mar 10 17:10:11 maverick kernel: [ 319.690728] mce: CPU11: Core temperature above threshold, cpu clock throttled (total events = 75) ... Mar 10 17:10:11 maverick kernel: [ 319.690730] mce: CPU11: Package temperature above threshold, cpu clock throttled (to&hellip; Yo, so I’ve ...
1,054
{'text': ['Yo, so I’ve fixed the problem finally\n\nThe issue was that the NNModel.train() was outside the epoch loop, and in the epoch loop, the testing function is called at the 0th epoch and it toggles the NNModel.train() to NNModel.eval().\n\nSo since the NNModel.train() was outside the loop, after the 0th epo&hell...
Issue using ._parameters internal method
I’m trying to access model parameters using the internal ._parameters method. When I define the model as below, I get model parameters without any issue model = nn.Linear(10, 10) print(model._parameters) However, when I use this method to get parameters of a model defined as a class, I get an empt&hellip;
0
2021-10-18T15:55:41.362Z
This is indeed unrelated. If you enable anomaly mode, you will see that the problem is that some of the params are saved for backward but modified inplace. The fix is to make sure they are not: for i in range(epochs): model.train() train_loss = 0 params = dict(model.named_parameters())&hellip;
1
2021-10-21T16:03:38.506Z
https://discuss.pytorch.org/t/issue-using-parameters-internal-method/134549/12
Hello Mr. Air! [image] theairbend3r: Mar 10 17:10:11 maverick kernel: [ 319.690728] mce: CPU11: Core temperature above threshold, cpu clock throttled (total events = 75) ... Mar 10 17:10:11 maverick kernel: [ 319.690730] mce: CPU11: Package temperature above threshold, cpu clock throttled (to&hellip; Yo, so I’ve ...
617
{'text': ['This is indeed unrelated.\n\nIf you enable anomaly mode, you will see that the problem is that some of the params are saved for backward but modified inplace. The fix is to make sure they are not:\n\nfor i in range(epochs):\n\nmodel.train()\n\ntrain_loss = 0\n\nparams = dict(model.named_parameters())&hellip;...
nn.BatchNorm vs MyBatchNorm
I have reimplemented BatchNorm1D based on the implementation provided by <a class="mention" href="/u/ptrblck">@ptrblck</a> (greatly appreciated!), here: <a href="https://github.com/ptrblck/pytorch_misc/blob/master/batch_norm_manual.py" rel="nofollow noopener">https://github.com/ptrblck/pytorch_misc/blob/master/batch_no...
0
2020-05-24T12:07:16.735Z
Ah OK. The backward pass of repeat_interleave is not deterministic as explained in the linked docs: Additionally, the backward path for repeat_interleave() operates nondeterministically on the CUDA backend because repeat_interleave() is implemented using index_select() , the backward path fo&hellip;
1
2020-05-26T21:26:01.317Z
https://discuss.pytorch.org/t/nn-batchnorm-vs-mybatchnorm/82682/9
Ah OK. The backward pass of repeat_interleave is not deterministic as explained in the linked docs: Additionally, the backward path for repeat_interleave() operates nondeterministically on the CUDA backend because repeat_interleave() is implemented using index_select() , the backward path fo&hellip; you could sp...
1,832
{'text': ['Ah OK.\n\nThe backward pass of repeat_interleave is not deterministic as explained in the linked docs:\n\nAdditionally, the backward path for repeat_interleave() operates nondeterministically on the CUDA backend because repeat_interleave() is implemented using index_select() , the backward path fo&helli...
Changing DataLoader to include a FITS class
I’m wondering if there’s a way to alter the torch.utils.data.DataLoader so that one could import FITS files into Pytorch as tensors with labels? I’m intending to load in Astronomical images from FITS format (<a href="http://docs.astropy.org/en/stable/index.html" rel="nofollow noopener">http://docs.astropy.org/en/stabl...
0
2018-05-04T08:46:58.698Z
you could specify your own folder as shown in <a href="https://discuss.pytorch.org/t/imagefolder-data-shuffle/17731/5?u=justusschock">this post</a>
0
2018-05-08T12:39:12.314Z
https://discuss.pytorch.org/t/changing-dataloader-to-include-a-fits-class/17495/3
Ah OK. The backward pass of repeat_interleave is not deterministic as explained in the linked docs: Additionally, the backward path for repeat_interleave() operates nondeterministically on the CUDA backend because repeat_interleave() is implemented using index_select() , the backward path fo&hellip; you could sp...
1,224
{'text': ['you could specify your own folder as shown in <a href="https://discuss.pytorch.org/t/imagefolder-data-shuffle/17731/5?u=justusschock">this post</a>'], 'answer_start': [1224]}
Reliably measure module latency + Repeatability
For NAS (Network Architecture Search) I need to measure the latency of operation that are present in my search space. Therefore, I tried different approaches to measure the latency of a nn.Module: pytorch autograd profiler “normal” time.time() measurements cuda events Of course I used torch.cuda&hellip;
0
2020-03-05T10:11:24.702Z
Hi themozel! Unfortunately I didn’t find a solution for measuring cells with small tensors. A “hacky solution” was to just multiply H and W with a constant factor of e.g. 8. Although this leads to “correct” (i.e. expected) latency differences between operations of different complexity, it can also &hellip;
0
2020-06-25T09:37:37.502Z
https://discuss.pytorch.org/t/reliably-measure-module-latency-repeatability/72126/9
Ah OK. The backward pass of repeat_interleave is not deterministic as explained in the linked docs: Additionally, the backward path for repeat_interleave() operates nondeterministically on the CUDA backend because repeat_interleave() is implemented using index_select() , the backward path fo&hellip; you could sp...
456
{'text': ['Hi themozel!\n\nUnfortunately I didn’t find a solution for measuring cells with small tensors. A “hacky solution” was to just multiply H and W with a constant factor of e.g. 8. Although this leads to “correct” (i.e. expected) latency differences between operations of different complexity, it can also &hellip...
Weights disconnection implementation
I try to implement the disconnection of weights, i.e., the specific connection is always 0. It sounds like masked_scatter_, but I found it could not be autograded. Here is my code: import torch import numpy as np x = torch.rand((3, 1)) # tensor([[ 0.8525], # [ 0.1509], # [ 0.9724]&hellip;
0
2018-06-07T04:11:31.167Z
While I am not clear about the picture you have posted - (why is the shape of x (3,2) if there are just three input nodes). One clear issue with your code though is that none of the variables have a requires_grad=True. For autograd to track stuff at least one of the inputs should have requires_grad=&hellip;
0
2018-06-07T07:48:04.980Z
https://discuss.pytorch.org/t/weights-disconnection-implementation/19314/5
While I am not clear about the picture you have posted - (why is the shape of x (3,2) if there are just three input nodes). One clear issue with your code though is that none of the variables have a requires_grad=True. For autograd to track stuff at least one of the inputs should have requires_grad=&hellip; You need to...
1,528
{'text': ['While I am not clear about the picture you have posted - (why is the shape of x (3,2) if there are just three input nodes). One clear issue with your code though is that none of the variables have a requires_grad=True. For autograd to track stuff at least one of the inputs should have requires_grad=&hellip;'...
Move tensor failed?
my code looks like this, i write a forward hook,and try to move ‘QPs’ to the ‘output’ tensor device then do some operations, but my ‘assert’ code failed , because two tensor are not on the same device, i am confused…BTY,i use dataparallel but i think it doesn’t matter… so what happens? def layer1_h&hellip;
0
2019-11-07T08:06:04.174Z
You need to do QPs = QPs.to(output.device) for it to work as to does not change the Tensor inplace. Also you can try QPs = output.new(QPs, device=output.device).
1
2019-11-07T15:07:26.248Z
https://discuss.pytorch.org/t/move-tensor-failed/60248/2
While I am not clear about the picture you have posted - (why is the shape of x (3,2) if there are just three input nodes). One clear issue with your code though is that none of the variables have a requires_grad=True. For autograd to track stuff at least one of the inputs should have requires_grad=&hellip; You need to...
1,073
{'text': ['You need to do QPs = QPs.to(output.device) for it to work as to does not change the Tensor inplace.\n\nAlso you can try QPs = output.new(QPs, device=output.device).'], 'answer_start': [1073]}
Using feature extraction layers from pre-trained FRCNN
Hi all, I have trained FRCNN using torchvision.models.detection.fasterrcnn_resnet50_fpn and now I want to use it’s feature extraction layers for something else. To do so I first printed frcnn.modules() and see that the model has 4 major components: 0) GeneralizedRCNNTransform BackboneWithFPN RP&hellip;
0
2020-01-25T11:29:43.906Z
You don’t necessarily need to wrap it in an nn.Sequential module, as it is already a working module. However, since the FeaturePyramidNetwork is used internally, you will get the OrderedDict as the output as seen in <a href="https://github.com/pytorch/vision/blob/bb5af1d77658133af8be8c9b1a13139722315c3a/torchvision/op...
0
2020-01-26T08:35:07.531Z
https://discuss.pytorch.org/t/using-feature-extraction-layers-from-pre-trained-frcnn/67621/8
While I am not clear about the picture you have posted - (why is the shape of x (3,2) if there are just three input nodes). One clear issue with your code though is that none of the variables have a requires_grad=True. For autograd to track stuff at least one of the inputs should have requires_grad=&hellip; You need to...
472
{'text': ['You don’t necessarily need to wrap it in an nn.Sequential module, as it is already a working module.\n\nHowever, since the FeaturePyramidNetwork is used internally, you will get the OrderedDict as the output as seen in <a href="https://github.com/pytorch/vision/blob/bb5af1d77658133af8be8c9b1a13139722315c3a/t...
AttributeError: 'GradSampleModule' object has no attribute for method
Hello, I am using the flower as an FL framework and I am trying to put DP support by using Opacus. Here is the problem I meet: I am using a very common MNIST model and inherited to get a new class: # https://github.com/pytorch/examples/blob/main/mnist/main.py class Net(nn.Module): def __ini&hellip;
1
2022-07-21T04:30:17.619Z
<a class="mention" href="/u/leonmac">@Leonmac</a> The problem here is that privacy_engine.make_private wraps your model object with GradSampleModule(model). The latter is an instance of nn.Module which can do forward/backward passes. The difference from the original model is that 1) it computes per-sample gradients (th...
0
2022-07-27T15:47:24.898Z
https://discuss.pytorch.org/t/attributeerror-gradsamplemodule-object-has-no-attribute-for-method/157135/8
<a class="mention" href="/u/leonmac">@Leonmac</a> The problem here is that privacy_engine.make_private wraps your model object with GradSampleModule(model). The latter is an instance of nn.Module which can do forward/backward passes. The difference from the original model is that 1) it computes per-sample gradients (th...
1,826
{'text': ['<a class="mention" href="/u/leonmac">@Leonmac</a> The problem here is that privacy_engine.make_private wraps your model object with GradSampleModule(model). The latter is an instance of nn.Module which can do forward/backward passes. The difference from the original model is that 1) it computes per-sample gr...
Pytorch uses wrong cuda version
Hello everybody, PyTorch seems to use the wrong cuda version. I create a fresh conda environment with conda create -n myenv Then in this environment I install torch via conda install pytorch torchvision torchaudio cudatoolkit=11.6 -c pytorch -c conda-forge Afterwards if I start python in this &hellip;
0
2022-07-19T08:52:40.440Z
Thanks for the update. So the install command seems to work as conda list shows the right binary: pytorch 1.12.0 py3.9_cuda11.6_cudnn8.3.2_0 but you have multiple PyTorch binaries installed where the one installed via pip seems to use the CUDA 10.2 runtime and is an old&hellip;
1
2022-07-19T09:06:35.610Z
https://discuss.pytorch.org/t/pytorch-uses-wrong-cuda-version/156954/4
<a class="mention" href="/u/leonmac">@Leonmac</a> The problem here is that privacy_engine.make_private wraps your model object with GradSampleModule(model). The latter is an instance of nn.Module which can do forward/backward passes. The difference from the original model is that 1) it computes per-sample gradients (th...
1,263
{'text': ['Thanks for the update.\n\nSo the install command seems to work as conda list shows the right binary:\n\npytorch 1.12.0 py3.9_cuda11.6_cudnn8.3.2_0\n\nbut you have multiple PyTorch binaries installed where the one installed via pip seems to use the CUDA 10.2 runtime and is an old&he...
Learning Translation with Kornia
Hi, I have been trying to learn translation (x, y) parameters with Kornia in the following manner: class DTranslation(nn.Module): def __init__(self, x_translation, y_translation): super(DTranslation, self).__init__() self.translations = torch.stack([x_translation, y_translation&hellip;
0
2020-09-15T06:52:09.733Z
The issue is solved, with both the kind help from <a class="mention" href="/u/juanfmontesinos">@JuanFMontesinos</a> and at <a href="https://github.com/kornia/kornia/issues/682" rel="nofollow noopener">https://github.com/kornia/kornia/issues/682</a> <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/...
0
2020-09-21T15:00:36.336Z
https://discuss.pytorch.org/t/learning-translation-with-kornia/96314/12
<a class="mention" href="/u/leonmac">@Leonmac</a> The problem here is that privacy_engine.make_private wraps your model object with GradSampleModule(model). The latter is an instance of nn.Module which can do forward/backward passes. The difference from the original model is that 1) it computes per-sample gradients (th...
659
{'text': ['The issue is solved, with both the kind help from <a class="mention" href="/u/juanfmontesinos">@JuanFMontesinos</a> and at <a href="https://github.com/kornia/kornia/issues/682" rel="nofollow noopener">https://github.com/kornia/kornia/issues/682</a>\n\n<a class="lightbox" href="https://discuss.pytorch.org/upl...
Gradient Doesn't Compute Backward
I want to make a custom loss function of MSE Loss by doing GMM computation for the result. The MSE Loss will be computed using the GMM result and target value. Here is my code class StyleLoss(nn.Module): def __init__(self, target_feature, ncomp, initial_mus, initial_covs, initial_priors): &hellip;
0
2020-03-11T07:32:14.056Z
self.input_gmm was also detached in the line before. The general rule is, as long as you use PyTorch functions, don’t detach the tensors (via recreating new tensors, calling .detach() or item()), Autograd will be able to track the computation graph and calculate the gradients.
0
2020-03-11T08:42:30.916Z
https://discuss.pytorch.org/t/gradient-doesnt-compute-backward/72831/4
self.input_gmm was also detached in the line before. The general rule is, as long as you use PyTorch functions, don’t detach the tensors (via recreating new tensors, calling .detach() or item()), Autograd will be able to track the computation graph and calculate the gradients. I’m not sure I understand what you mean b...
2,882
{'text': ['self.input_gmm was also detached in the line before.\n\nThe general rule is, as long as you use PyTorch functions, don’t detach the tensors (via recreating new tensors, calling .detach() or item()), Autograd will be able to track the computation graph and calculate the gradients.'], 'answer_start': [2882]}
How dataloader shuffled with enumerate()?
Hello. I am coding for training loop with dataloader which is flagged shuffle=True. to my knowledge, people usually coding epoch and iteration for dataloader as follows: for epoch in epochs: for iter, (input, target) in enumerate(dataloader): &quot;&quot;&quot;Do Training&quot;&quot;&quot; With this commonsense, ...
0
2020-07-23T10:47:37.632Z
I’m not sure I understand what you mean by [image] GB_K: and the loader will shuffle if it reaches to the end by enumerate. but the data is already shuffled at the time you call enumerate() on the dataloader. The dataloader first shuffles the data and puts it into batches. When you call enu&hellip;
1
2020-07-23T11:31:28.483Z
https://discuss.pytorch.org/t/how-dataloader-shuffled-with-enumerate/90264/5
self.input_gmm was also detached in the line before. The general rule is, as long as you use PyTorch functions, don’t detach the tensors (via recreating new tensors, calling .detach() or item()), Autograd will be able to track the computation graph and calculate the gradients. I’m not sure I understand what you mean b...
1,720
{'text': ['I’m not sure I understand what you mean by\n\n[image] GB_K:\n\nand the loader will shuffle if it reaches to the end by enumerate.\n\nbut the data is already shuffled at the time you call enumerate() on the dataloader.\n\nThe dataloader first shuffles the data and puts it into batches. When you call enu&helli...
Single Machine DDP Issue on A6000 GPU
Hi, I’ve recently gotten access to some A6000 GPUs. The machine has CUDA11.3 installed, and my environment has the latest PyTorch release (1.10.0) with the CUDA11.3 build: torch==1.10.0+cu113. It seems like single GPU training works well, but as soon as I switch to DDP (initiated when torch.cuda.d&hellip;
0
2021-10-22T14:52:37.188Z
Upon cancelling the hang, I get a timeout error: fd_event_list = self._selector.poll(timeout) It seems like the processes can’t communicate with each other. So I’ve tried wrapping the training loop with model.no_sync(), and the code progresses well. As you mentioned, this definitely does look lik&hellip;
0
2021-10-23T12:12:49.967Z
https://discuss.pytorch.org/t/single-machine-ddp-issue-on-a6000-gpu/134869/7
self.input_gmm was also detached in the line before. The general rule is, as long as you use PyTorch functions, don’t detach the tensors (via recreating new tensors, calling .detach() or item()), Autograd will be able to track the computation graph and calculate the gradients. I’m not sure I understand what you mean b...
583
{'text': ['Upon cancelling the hang, I get a timeout error:\n\nfd_event_list = self._selector.poll(timeout)\n\nIt seems like the processes can’t communicate with each other. So I’ve tried wrapping the training loop with model.no_sync(), and the code progresses well.\n\nAs you mentioned, this definitely does look lik&he...
ResNet reproducibility
Hi everyone :slight_smile: I have two models that are essentially the same (same architecture, same number of parameters) but they yield different results. The first model is one from the PyTorch model selection (a ResNet18 without pretrained weights) and the other one is essentially copy pasted co&hellip;
0
2020-11-17T12:44:37.349Z
I get the same results, if I try to make sure to use the same calls into the PRNG: torch.manual_seed(2809) modelA = ResNet(BasicBlock, [2, 2, 2, 2], 1000) in_ = modelA.fc.in_features classes = 10 modelA.fc = nn.Linear(in_features=in_, out_features=classes) torch.manual_seed(2809) modelB = ResNet(Ba&hellip;
3
2020-11-19T10:57:05.255Z
https://discuss.pytorch.org/t/resnet-reproducibility/103113/13
I get the same results, if I try to make sure to use the same calls into the PRNG: torch.manual_seed(2809) modelA = ResNet(BasicBlock, [2, 2, 2, 2], 1000) in_ = modelA.fc.in_features classes = 10 modelA.fc = nn.Linear(in_features=in_, out_features=classes) torch.manual_seed(2809) modelB = ResNet(Ba&hellip; Hi, ...
1,782
{'text': ['I get the same results, if I try to make sure to use the same calls into the PRNG:\n\ntorch.manual_seed(2809)\n\nmodelA = ResNet(BasicBlock, [2, 2, 2, 2], 1000)\n\nin_ = modelA.fc.in_features\n\nclasses = 10\n\nmodelA.fc = nn.Linear(in_features=in_, out_features=classes)\n\ntorch.manual_seed(2809)\n\nmodelB ...
requires_grad=True for two variables
Hi all, I have a model that has multiple inputs, and I was wondering if it is possible to find the gradients of the output with respect to the inputs. The layout is as follows: output = f(inp1, inp2, …) To do so, we minimize the loss: Solve MSE optimization problem loss ||output-target|| Then a&hellip;
0
2020-04-23T19:39:16.609Z
Hi, First, make sure your inputs require gradients: If they don’t, just call requires_grad_() on them before giving them to your net If they do and are leaf (inp1.is_leaf()) then you’re good to go If they do but are not leafs, you can do inp1.retain_grad() to make sure the .grad field will be pop&hellip;
3
2020-04-23T19:47:12.077Z
https://discuss.pytorch.org/t/requires-grad-true-for-two-variables/78119/2
I get the same results, if I try to make sure to use the same calls into the PRNG: torch.manual_seed(2809) modelA = ResNet(BasicBlock, [2, 2, 2, 2], 1000) in_ = modelA.fc.in_features classes = 10 modelA.fc = nn.Linear(in_features=in_, out_features=classes) torch.manual_seed(2809) modelB = ResNet(Ba&hellip; Hi, ...
1,206
{'text': ['Hi,\n\nFirst, make sure your inputs require gradients:\n\nIf they don’t, just call requires_grad_() on them before giving them to your net\n\nIf they do and are leaf (inp1.is_leaf()) then you’re good to go\n\nIf they do but are not leafs, you can do inp1.retain_grad() to make sure the .grad field will be pop...
Can pytorch provide some sample code on training ResNet?
I recently need to train ResNet50 and do some experiments, I know there are bunch of pretrained models on github, but I feel more interested on the training process(like how to preprocess, set the LR and so on)… The dataset I am using is standard CIFAR100. On github, few repo claim that they can ac&hellip;
0
2019-12-14T14:02:19.671Z
Review the <a href="https://arxiv.org/abs/1812.01187" rel="nofollow noopener">Bag of Tricks for Image Classification with Convolutional Neural Networks</a> for some pointers. Preprocessing: Zeros padding with value=4 and then randomly crop a 32x32 image. For normalization use mean=[0.491, 0.482, 0.447] and std=[0.247,...
2
2019-12-14T14:15:24.562Z
https://discuss.pytorch.org/t/can-pytorch-provide-some-sample-code-on-training-resnet/64051/5
I get the same results, if I try to make sure to use the same calls into the PRNG: torch.manual_seed(2809) modelA = ResNet(BasicBlock, [2, 2, 2, 2], 1000) in_ = modelA.fc.in_features classes = 10 modelA.fc = nn.Linear(in_features=in_, out_features=classes) torch.manual_seed(2809) modelB = ResNet(Ba&hellip; Hi, ...
625
{'text': ['Review the <a href="https://arxiv.org/abs/1812.01187" rel="nofollow noopener">Bag of Tricks for Image Classification with Convolutional Neural Networks</a> for some pointers.\n\nPreprocessing: Zeros padding with value=4 and then randomly crop a 32x32 image. For normalization use mean=[0.491, 0.482, 0.447] an...
Torch_dir not found
I use the cmaker and the cmakerlists.txt and I do the configuration but an error which appears to me is torch_dir not found. what am i doing?
0
2020-06-20T17:35:55.511Z
Is this the output of the command? If yes, then it is an empty folder, please download the LibTorch binary at <a href="https://pytorch.org/" rel="nofollow noopener">https://pytorch.org/</a> and extract them into this folder.
0
2020-06-22T17:36:21.191Z
https://discuss.pytorch.org/t/torch-dir-not-found/86208/15
Is this the output of the command? If yes, then it is an empty folder, please download the LibTorch binary at <a href="https://pytorch.org/" rel="nofollow noopener">https://pytorch.org/</a> and extract them into this folder. checkpoint is for cases where at least one argument has requires_grad=True, using it like that ...
2,008
{'text': ['Is this the output of the command? If yes, then it is an empty folder, please download the LibTorch binary at <a href="https://pytorch.org/" rel="nofollow noopener">https://pytorch.org/</a> and extract them into this folder.'], 'answer_start': [2008]}
Trying to understand torch.utils.checkpoint
I am trying to understand how to use checkpoints to optimize my training. My basic understanding was that it trades increased compute for a lower memory footprint (by re-computing instead of storing data for the backward pass). Naively then I would assume that any time I use it I should decrease mem&hellip;
0
2020-09-04T19:29:36.506Z
checkpoint is for cases where at least one argument has requires_grad=True, using it like that skips self.model(i.e. resnet) training.
2
2020-09-05T03:00:38.974Z
https://discuss.pytorch.org/t/trying-to-understand-torch-utils-checkpoint/95224/6
Is this the output of the command? If yes, then it is an empty folder, please download the LibTorch binary at <a href="https://pytorch.org/" rel="nofollow noopener">https://pytorch.org/</a> and extract them into this folder. checkpoint is for cases where at least one argument has requires_grad=True, using it like that ...
1,229
{'text': ['checkpoint is for cases where at least one argument has requires_grad=True, using it like that skips self.model(i.e. resnet) training.'], 'answer_start': [1229]}
Segmentation Fault bias initialisation Conv2d
Hi!, I face a problem using pytorch 1.3.0 on Cuda V100. Here the code originating from <a href="https://github.com/cszn/DnCNN/blob/master/TrainingCodes/dncnn_pytorch/main_train.py" target="_blank" rel="nofollow noopener">cszn/DnCNN/blob/master/TrainingCodes/dncnn_pytorch/main_train.py</a> # -*- coding: utf-8 -*- # ...
0
2019-12-16T15:05:01.493Z
Interesting. So I guess the pip-version linked to a wrong mkl version. Hence causing the issue ! In general, I would advise to use the conda install of pytorch if you’re in a conda environment. That will make sure you don’t have such issues ! Happy this is fixed.
0
2019-12-17T16:42:42.866Z
https://discuss.pytorch.org/t/segmentation-fault-bias-initialisation-conv2d/64227/17
Is this the output of the command? If yes, then it is an empty folder, please download the LibTorch binary at <a href="https://pytorch.org/" rel="nofollow noopener">https://pytorch.org/</a> and extract them into this folder. checkpoint is for cases where at least one argument has requires_grad=True, using it like that ...
360
{'text': ['Interesting. So I guess the pip-version linked to a wrong mkl version. Hence causing the issue !\n\nIn general, I would advise to use the conda install of pytorch if you’re in a conda environment. That will make sure you don’t have such issues !\n\nHappy this is fixed.'], 'answer_start': [360]}
Why doesnt these variables get updated?
Hello all, I created a simple network where a convolutional layers weight matrix is altered by a custom function. I came up with this : class snet(nn.Module): def __init__(self, num_classes=3): super().__init__() self.conv1 = nn.Conv2d(3, 6, 2, 1, 0) shape = self.conv&hellip;
0
2019-07-21T07:54:12.892Z
Had a missing line of code above. This def forward(self, x): self.some_function() ... The values of kernel won’t be optimised directly, instead the optimizer will optimise values of var1 and var2 only as they are the parameters. You can check that out by tracing the grad_fn backwards (tedious&hellip;
1
2019-07-22T16:32:13.716Z
https://discuss.pytorch.org/t/why-doesnt-these-variables-get-updated/51187/8
Had a missing line of code above. This def forward(self, x): self.some_function() ... The values of kernel won’t be optimised directly, instead the optimizer will optimise values of var1 and var2 only as they are the parameters. You can check that out by tracing the grad_fn backwards (tedious&hellip; You can retur...
1,250
{'text': ['Had a missing line of code above. This\n\ndef forward(self, x):\n\nself.some_function()\n\n...\n\nThe values of kernel won’t be optimised directly, instead the optimizer will optimise values of var1 and var2 only as they are the parameters.\n\nYou can check that out by tracing the grad_fn backwards (tedious&...
Is it professional when dealing with the softmax layer in mobile
Is it possible to do the task of softmax layer in pytorch, I know Tensorflow can do it
0
2019-12-31T02:15:00.295Z
You can return dicts in your forward method: class MyModel(nn.Module): def __init__(self): super(MyModel, self).__init__() self.fc1 = nn.Linear(1, 1) self.fc2 = nn.Linear(1, 1) def forward(self, x): x1 = self.fc1(x) x2 = self.fc2(x) r&hellip;
0
2020-01-07T04:01:41.709Z
https://discuss.pytorch.org/t/is-it-professional-when-dealing-with-the-softmax-layer-in-mobile/65424/19
Had a missing line of code above. This def forward(self, x): self.some_function() ... The values of kernel won’t be optimised directly, instead the optimizer will optimise values of var1 and var2 only as they are the parameters. You can check that out by tracing the grad_fn backwards (tedious&hellip; You can retur...
932
{'text': ['You can return dicts in your forward method:\n\nclass MyModel(nn.Module):\n\ndef __init__(self):\n\nsuper(MyModel, self).__init__()\n\nself.fc1 = nn.Linear(1, 1)\n\nself.fc2 = nn.Linear(1, 1)\n\ndef forward(self, x):\n\nx1 = self.fc1(x)\n\nx2 = self.fc2(x)\n\nr&hellip;'], 'answer_start': [932]}
Training process is terminated when node fails for torch elastic
Hi! I am recently using torch elastic with c10d and min_nodes=1. I have succeeded in joining the existing training from other nodes dynamically. The training process blocks for rendezvous and restarts from the latest checkpoint with a new remaining iteration number (because of the updated world siz&hellip;
0
2021-11-01T05:53:57.974Z
I can confirm this is indeed a bug. Please track the progress of the fix: <a href="https://github.com/pytorch/pytorch/issues/67742" class="inline-onebox" rel="noopener nofollow ugc">[torch/elastic] Scale down does not work correctly when agent is killed with SIGINT, SIGTERM · Issue #67742 · pytorch/pytorch · GitHub</a>...
0
2021-11-03T03:41:21.593Z
https://discuss.pytorch.org/t/training-process-is-terminated-when-node-fails-for-torch-elastic/135580/8
Had a missing line of code above. This def forward(self, x): self.some_function() ... The values of kernel won’t be optimised directly, instead the optimizer will optimise values of var1 and var2 only as they are the parameters. You can check that out by tracing the grad_fn backwards (tedious&hellip; You can retur...
559
{'text': ['I can confirm this is indeed a bug. Please track the progress of the fix: <a href="https://github.com/pytorch/pytorch/issues/67742" class="inline-onebox" rel="noopener nofollow ugc">[torch/elastic] Scale down does not work correctly when agent is killed with SIGINT, SIGTERM · Issue #67742 · pytorch/pytorch ·...
Problems iterating through loader when using sampler
**Hi there! ** I have a custom dataset in which (even though I have more or less the same number of samples for each class) it missclassified some of the data for some specific classes. So what I’m trying to do is oversample by using “sampler” in the dataloader and WeightedRandomSampler as follows: &hellip;
0
2021-02-17T12:21:54.132Z
Which sklearn version are you using, as I’m getting an error running your code with random target data: targets = np.random.randint(0, 100, (100,)) class_weights = compute_class_weight(&#39;balanced&#39;, np.unique(targets), targets,classes=np.arange(NUM_POSITIONS)) &gt; TypeError: compute_class_weight() got &hellip...
0
2021-02-19T08:41:44.255Z
https://discuss.pytorch.org/t/problems-iterating-through-loader-when-using-sampler/112157/9
Which sklearn version are you using, as I’m getting an error running your code with random target data: targets = np.random.randint(0, 100, (100,)) class_weights = compute_class_weight(&#39;balanced&#39;, np.unique(targets), targets,classes=np.arange(NUM_POSITIONS)) &gt; TypeError: compute_class_weight() got &hellip...
1,824
{'text': ['Which sklearn version are you using, as I’m getting an error running your code with random target data:\n\ntargets = np.random.randint(0, 100, (100,))\n\nclass_weights = compute_class_weight(&#39;balanced&#39;, np.unique(targets), targets,classes=np.arange(NUM_POSITIONS))\n\n&gt; TypeError: compute_class_wei...
How to dropout with non zero value?
I want to use feature dropout like dropout2d and fill it with mean value (or Gaussian noise for example) instead of zeros. How to do so? Easiest thing to do is runing dropout2d and fill zeros, but i have zeros in data.
0
2020-05-03T18:18:28.109Z
It depends, what you want to achieve. The original mask before the unsqueeze and expand operations can be used to index x directly, which would yield: x = torch.ones([1, 167, 128]) batch_size, length, features = x.size() p = 0.5 mask = torch.distributions.Bernoulli( probs=(1 - p)).sample((batc&hellip;
0
2020-10-20T19:26:36.995Z
https://discuss.pytorch.org/t/how-to-dropout-with-non-zero-value/79561/10
Which sklearn version are you using, as I’m getting an error running your code with random target data: targets = np.random.randint(0, 100, (100,)) class_weights = compute_class_weight(&#39;balanced&#39;, np.unique(targets), targets,classes=np.arange(NUM_POSITIONS)) &gt; TypeError: compute_class_weight() got &hellip...
1,234
{'text': ['It depends, what you want to achieve.\n\nThe original mask before the unsqueeze and expand operations can be used to index x directly, which would yield:\n\nx = torch.ones([1, 167, 128])\n\nbatch_size, length, features = x.size()\n\np = 0.5\n\nmask = torch.distributions.Bernoulli(\n\nprobs=(1 - p)).sample((b...
Saving and Loading Optimizer Params
Hi, I’m trying to save and load optimizer params as we do for a model, but although i tried in many different ways, still i couldn’t work it. Here is the code: best_model_wts = copy.deepcopy(model.state_dict()) best_optim_pars = copy.deepcopy(optimizer.state_dict()) for epoch in range(num_epochs)&hellip;
0
2020-11-30T07:44:59.432Z
Did you try not to use deepcopy at all in your code? Also, did you check if your code updating or reassigning a model parameters somewhere (as in linked thread I posted before)? Can you update to a current pytorch version?
1
2020-11-30T12:07:46.670Z
https://discuss.pytorch.org/t/saving-and-loading-optimizer-params/104594/12
Which sklearn version are you using, as I’m getting an error running your code with random target data: targets = np.random.randint(0, 100, (100,)) class_weights = compute_class_weight(&#39;balanced&#39;, np.unique(targets), targets,classes=np.arange(NUM_POSITIONS)) &gt; TypeError: compute_class_weight() got &hellip...
631
{'text': ['Did you try not to use deepcopy at all in your code?\n\nAlso, did you check if your code updating or reassigning a model parameters somewhere (as in linked thread I posted before)?\n\nCan you update to a current pytorch version?'], 'answer_start': [631]}
Pytorch - lstm yields retain_graph error - how do I get around this?
I am training a simple LSTM model however pytorch gives me an error saying that I need to set retain_graph=True. However this takes the model longer to train and I do not think I need to do this. class SequenceModel(nn.Module): def __init__(self): super().__init__() self.lstm =&hellip;
0
2020-03-03T12:19:46.566Z
If you want to learn the hidden layer initial state, starting from 0: class SequenceModel(nn.Module): def __init__(self): super().__init__() self.lstm = nn.LSTM(input_size = 3, hidden_size = 3, bidirectional=False) self.hidden = nn.ParameterList((nn.Parameter(torch.zero&hellip;
3
2020-03-03T15:22:30.270Z
https://discuss.pytorch.org/t/pytorch-lstm-yields-retain-graph-error-how-do-i-get-around-this/71837/8
If you want to learn the hidden layer initial state, starting from 0: class SequenceModel(nn.Module): def __init__(self): super().__init__() self.lstm = nn.LSTM(input_size = 3, hidden_size = 3, bidirectional=False) self.hidden = nn.ParameterList((nn.Parameter(torch.zero&hellip; Yes you are right, but if that happe...
1,710
{'text': ['If you want to learn the hidden layer initial state, starting from 0:\n\nclass SequenceModel(nn.Module):\n\ndef __init__(self):\n\nsuper().__init__()\n\nself.lstm = nn.LSTM(input_size = 3, hidden_size = 3, bidirectional=False)\n\nself.hidden = nn.ParameterList((nn.Parameter(torch.zero&hellip;'], 'answer_star...
Loss is 1 but gradients are zero
I am facing this issue of gradient being 0 even though the loss is not zero. loss stays at 1 while gradients are 0. I’m using the MSE loss function. Can anyone please help me here in debugging this? Training code snippet: # Train network max_epochs = max_epochs+1 epoch = 1 last_acc = 0&hellip;
0
2022-04-16T06:03:04.191Z
Yes you are right, but if that happens, then the loss itself will become zero which is not the case here. Using regularization helped here to make sure layer_and_weights doesn’t become zero by default. And gradient started flowing again. So I guess this solves the problem for now. Thanks
0
2022-04-21T15:05:23.530Z
https://discuss.pytorch.org/t/loss-is-1-but-gradients-are-zero/149296/22
If you want to learn the hidden layer initial state, starting from 0: class SequenceModel(nn.Module): def __init__(self): super().__init__() self.lstm = nn.LSTM(input_size = 3, hidden_size = 3, bidirectional=False) self.hidden = nn.ParameterList((nn.Parameter(torch.zero&hellip; Yes you are right, but if that happe...
1,139
{'text': ['Yes you are right, but if that happens, then the loss itself will become zero which is not the case here.\n\nUsing regularization helped here to make sure layer_and_weights doesn’t become zero by default. And gradient started flowing again. So I guess this solves the problem for now.\n\nThanks'], 'answer_sta...
RuntimeError: Calculated padded input size per channel: (1 x 1). Kernel size: (4 x 4). Kernel size can't be greater than actual input size
I am trying to train GAN to transfer style. I am getting error when passing images through discriminator for epoch in range(epochs): #code for stats for real_images in tqdm(t_dl): optimizer[&quot;discriminator&quot;].zero_grad() real_preds = model[&quot;discriminator&quot;](re&hellip;
0
2022-08-27T17:31:16.040Z
Thanks for help <a class="mention" href="/u/ptrblck">@ptrblck</a>! [image] ptrblck: Based on the updated code I would start with checking fake_images. I checked it and it was the problem.Generator generated images of wrong shape,so discriminator was getting 112*112.
0
2022-08-28T11:51:21.132Z
https://discuss.pytorch.org/t/runtimeerror-calculated-padded-input-size-per-channel-1-x-1-kernel-size-4-x-4-kernel-size-cant-be-greater-than-actual-input-size/160184/11
If you want to learn the hidden layer initial state, starting from 0: class SequenceModel(nn.Module): def __init__(self): super().__init__() self.lstm = nn.LSTM(input_size = 3, hidden_size = 3, bidirectional=False) self.hidden = nn.ParameterList((nn.Parameter(torch.zero&hellip; Yes you are right, but if that happe...
575
{'text': ['Thanks for help <a class="mention" href="/u/ptrblck">@ptrblck</a>!\n\n[image] ptrblck:\n\nBased on the updated code I would start with checking fake_images.\n\nI checked it and it was the problem.Generator generated images of wrong shape,so discriminator was getting 112*112.'], 'answer_start': [575]}
Image Sizing Is too large when trying to display image from deep learning pipeline
thanks so much for this forum, its helping me to learn so much! I will try to answer a few questions as well. Still being a newbie my question is below. I am trying to display an image from a deep learning pipeline with the associated label. The error I am getting is that the image is too large &hellip;
1
2021-06-29T20:31:05.790Z
I see, right before show(org_image, title=sentence) inside load_image_and_predict: Do you printing out the org_image size by adding org_image.size before the show(org_image, title=sentence) line? As well as print the sentence if possible! print(org_image.size, sentence) (What if the caption is so&hellip;
0
2021-06-29T21:00:36.201Z
https://discuss.pytorch.org/t/image-sizing-is-too-large-when-trying-to-display-image-from-deep-learning-pipeline/125399/10
I see, right before show(org_image, title=sentence) inside load_image_and_predict: Do you printing out the org_image size by adding org_image.size before the show(org_image, title=sentence) line? As well as print the sentence if possible! print(org_image.size, sentence) (What if the caption is so&hellip; If you are ...
1,688
{'text': ['I see, right before show(org_image, title=sentence) inside load_image_and_predict:\n\nDo you printing out the org_image size by adding org_image.size before the show(org_image, title=sentence) line? As well as print the sentence if possible!\n\nprint(org_image.size, sentence)\n\n(What if the caption is so&he...
Understanding tensor.backwards()
Hello, so I don’t really get why it is that we need to give a grad tensor to tensor.backwards(). They say the grad should be the gradient of the tensor w.r.t itself but wouldn’t that just be a tensor of all ones? If not could you please give an example where the gradient wouldn’t be all ones? I fe&hellip;
0
2020-06-12T20:56:38.683Z
If you are trying to calculate the dLoss/dLoss, then it would be torch.ones, that’s correct. For other use cases it might be different. Recently such a use case was described <a href="https://discuss.pytorch.org/t/propagate-manually-computed-gradients/85884">here</a>.
1
2020-06-20T07:35:40.853Z
https://discuss.pytorch.org/t/understanding-tensor-backwards/85269/6
I see, right before show(org_image, title=sentence) inside load_image_and_predict: Do you printing out the org_image size by adding org_image.size before the show(org_image, title=sentence) line? As well as print the sentence if possible! print(org_image.size, sentence) (What if the caption is so&hellip; If you are ...
1,153
{'text': ['If you are trying to calculate the dLoss/dLoss, then it would be torch.ones, that’s correct.\n\nFor other use cases it might be different. Recently such a use case was described <a href="https://discuss.pytorch.org/t/propagate-manually-computed-gradients/85884">here</a>.'], 'answer_start': [1153]}
Why this convnet with SGD (batch size 1) fail?
I’d like to understand why this script: <a href="https://github.com/pytorch/examples/blob/master/mnist/main.py" target="_blank" rel="nofollow noopener">pytorch/examples/blob/master/mnist/main.py</a> from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional...
0
2018-01-04T22:03:26.864Z
Well, as you can see the network architecture in Keras is quite different from the example in Pytorch. Anyway, lower the learning rate to 0.001 and you should be fine with batch_size=1.
0
2018-01-04T23:26:43.873Z
https://discuss.pytorch.org/t/why-this-convnet-with-sgd-batch-size-1-fail/11887/7
I see, right before show(org_image, title=sentence) inside load_image_and_predict: Do you printing out the org_image size by adding org_image.size before the show(org_image, title=sentence) line? As well as print the sentence if possible! print(org_image.size, sentence) (What if the caption is so&hellip; If you are ...
579
{'text': ['Well, as you can see the network architecture in Keras is quite different from the example in Pytorch. Anyway, lower the learning rate to 0.001 and you should be fine with batch_size=1.'], 'answer_start': [579]}
Problems with LAPACK on iOS
Hello! I’m trying to run my model on iOS and encounter a problem with LibTorch. The problem is in the call of SVD function. The following code: #import &lt;torch/script.h&gt; #import &lt;ATen/Functions.h&gt; at::Tensor tensor = torch::ones({3,3}); auto result = at::svd(tensor); crushes with error as executi&hell...
0
2020-02-10T16:01:53.440Z
Hi <a class="mention" href="/u/kulikovv">@kulikovv</a>, We didn’t compile LAPACK into our binary. However, since LAPCK is supported by the Accelerate.framework on iOS. You can manually enable it by following the steps below Add a compiler flag - CMAKE_ARGS+=(&quot;-DUSE_LAPACK=ON&quot;) in build_ios.sh to tell cmake ...
5
2020-02-10T18:34:46.810Z
https://discuss.pytorch.org/t/problems-with-lapack-on-ios/69240/5
Hi <a class="mention" href="/u/kulikovv">@kulikovv</a>, We didn’t compile LAPACK into our binary. However, since LAPCK is supported by the Accelerate.framework on iOS. You can manually enable it by following the steps below Add a compiler flag - CMAKE_ARGS+=(&quot;-DUSE_LAPACK=ON&quot;) in build_ios.sh to tell cmake ...
1,528
{'text': ['Hi <a class="mention" href="/u/kulikovv">@kulikovv</a>,\n\nWe didn’t compile LAPACK into our binary. However, since LAPCK is supported by the Accelerate.framework on iOS. You can manually enable it by following the steps below\n\nAdd a compiler flag - CMAKE_ARGS+=(&quot;-DUSE_LAPACK=ON&quot;) in build_ios.sh...
How to fix size mismatch pretrained model for large input image sizes?
Hi, So I understand that pretrained models WITH dense layers require the exact image size the network was originally trained on for input. I know you can feed in different image sizes provided you add additional layers but I was wondering what is the best/optimal way. Currently, I have input sizes&hellip;
0
2022-02-13T02:09:07.702Z
So the main difference here is that your feature extraction is using average pooling, while the torchvision implementations of models e.g., DenseNet use adaptive average pooling (in this case also referred to as &quot;global average pooling) to guarantee the output spatial dimensions are reduced to [1,1]&hellip;
1
2022-02-14T00:59:16.240Z
https://discuss.pytorch.org/t/how-to-fix-size-mismatch-pretrained-model-for-large-input-image-sizes/144025/4
Hi <a class="mention" href="/u/kulikovv">@kulikovv</a>, We didn’t compile LAPACK into our binary. However, since LAPCK is supported by the Accelerate.framework on iOS. You can manually enable it by following the steps below Add a compiler flag - CMAKE_ARGS+=(&quot;-DUSE_LAPACK=ON&quot;) in build_ios.sh to tell cmake ...
1,125
{'text': ['So the main difference here is that your feature extraction is using average pooling, while the torchvision implementations of models e.g., DenseNet use adaptive average pooling (in this case also referred to as &quot;global average pooling) to guarantee the output spatial dimensions are reduced to [1,1]&hel...
Swap axes in pytorch?
Hi, in tensorflow, we have data_format option in tf.nn.conv2d which could specify the data format as NHWC or NCHW. Is there equivalent operation in pytorch? If not, should we convert Variable to numpy.array, use np.swapaxes and convert it back into Variable? And under such circumstances, will the&hellip;
6
2017-03-09T13:08:30.505Z
<a class="mention" href="/u/veril">@Veril</a> transpose only applies to 2 axis, while permute can be applied to all the axes at the same time. For example a = torch.rand(1,2,3,4) print(a.transpose(0,3).transpose(1,2).size()) print(a.permute(3,2,1,0).size()) BTW, <a href="https://github.com/pytorch/pytorch/blob/mas...
24
2017-03-09T14:37:12.290Z
https://discuss.pytorch.org/t/swap-axes-in-pytorch/970/5
Hi <a class="mention" href="/u/kulikovv">@kulikovv</a>, We didn’t compile LAPACK into our binary. However, since LAPCK is supported by the Accelerate.framework on iOS. You can manually enable it by following the steps below Add a compiler flag - CMAKE_ARGS+=(&quot;-DUSE_LAPACK=ON&quot;) in build_ios.sh to tell cmake ...
675
{'text': ['<a class="mention" href="/u/veril">@Veril</a> transpose only applies to 2 axis, while permute can be applied to all the axes at the same time.\n\nFor example\n\na = torch.rand(1,2,3,4)\n\nprint(a.transpose(0,3).transpose(1,2).size())\n\nprint(a.permute(3,2,1,0).size())\n\nBTW, <a href="https://github.com/pyt...
Resnet is not giving me any accuracy
Well, while using Desnsenet169, I am getting proper accuracies, but in the case of ResNet - 101/50, I am not getting any accuracies. It is printing like this - [image] Deb_Prakash_Chatterj: Well, while using Desnsenet169, I am getting proper accuracies, but in the case of ResNet - 101/50, I am &hellip;
0
2019-02-25T09:08:58.224Z
Sure, maybe this can be best explained by an example: In [1]: import torch In [2]: a = torch.tensor([1, 2, 3]) In [3]: b = a.clone().view(-1, 1) &hellip;
1
2019-02-25T16:13:14.555Z
https://discuss.pytorch.org/t/resnet-is-not-giving-me-any-accuracy/38166/7
Sure, maybe this can be best explained by an example: In [1]: import torch In [2]: a = torch.tensor([1, 2, 3]) In [3]: b = a.clone().view(-1, 1) &hellip; Thanks for the code. Since you are rewrapping some modules and remove the last linear layer, the output shape will be the last activation after the average pooli...
2,154
{'text': ['Sure, maybe this can be best explained by an example:\n\nIn [1]: import torch\n\nIn [2]: a = torch.tensor([1, 2, 3])\n\nIn [3]: b = a.clone().view(-1, 1)\n\n&hellip;'], 'answer_start': [2154]}
Size of extracted feature
Hello, I am new in pytorch and currently I trained mnist data in resnet 34 model. After I extracting my feature the size is [1, 512, 10, 10] which I was expecting [1, 512, 1, 1]. Can someone explain to me what does 10 10 stands for?
0
2020-02-09T12:26:35.458Z
Thanks for the code. Since you are rewrapping some modules and remove the last linear layer, the output shape will be the last activation after the average pooling layer. For your input shape, it’ll be [batch_size, 512, 10, 10]. If you want to get a single pixel in the spatial size, you would hav&hellip;
1
2020-02-13T19:47:58.134Z
https://discuss.pytorch.org/t/size-of-extracted-feature/69126/9
Sure, maybe this can be best explained by an example: In [1]: import torch In [2]: a = torch.tensor([1, 2, 3]) In [3]: b = a.clone().view(-1, 1) &hellip; Thanks for the code. Since you are rewrapping some modules and remove the last linear layer, the output shape will be the last activation after the average pooli...
1,235
{'text': ['Thanks for the code.\n\nSince you are rewrapping some modules and remove the last linear layer, the output shape will be the last activation after the average pooling layer.\n\nFor your input shape, it’ll be [batch_size, 512, 10, 10].\n\nIf you want to get a single pixel in the spatial size, you would hav&he...
4D tensor equivalent neural network layer in PyTorch
Hello, How can I define a layer like below code in pytorch? InputLayer( shape=(None, 1, input_height, input_width), ) (The input is a 4 Dimensional tensor.)
0
2020-06-13T19:10:54.280Z
I do not remember the details of Theano’s memory layout, but I am assuming it uses the NCHW format, which means your input dimensions (10, 1, 20, 224) corresponds to batch size of 10, channel depth of 1, image height of 20 pixels, image width of 224 pixels. (The image height of 20 pixels does see&hellip;
0
2020-06-14T10:36:33.939Z
https://discuss.pytorch.org/t/4d-tensor-equivalent-neural-network-layer-in-pytorch/85360/9
Sure, maybe this can be best explained by an example: In [1]: import torch In [2]: a = torch.tensor([1, 2, 3]) In [3]: b = a.clone().view(-1, 1) &hellip; Thanks for the code. Since you are rewrapping some modules and remove the last linear layer, the output shape will be the last activation after the average pooli...
467
{'text': ['I do not remember the details of Theano’s memory layout, but I am assuming it uses the NCHW format, which means your input dimensions (10, 1, 20, 224) corresponds to\n\nbatch size of 10,\n\nchannel depth of 1,\n\nimage height of 20 pixels,\n\nimage width of 224 pixels.\n\n(The image height of 20 pixels does ...
Cannot calculate second order gradients even though `create_graph=True`
I have a training loop iteration that looks like this… mu, logvar = m(x) alpha = torch.zeros(size, requires_grad=True) loss = alpha * criterion(mu, logvar) loss.backward(retain_graph=True, create_graph=True) for p in m.parameters(): p = p - LR * p.grad x_next, y_next = data[j + 1] mu_next, log&hellip;
0
2020-04-27T19:29:01.287Z
I think the problem in your code is: for p in m.parameters(): p = p - LR * p.grad This does not modify p inplace ! It just assigns the result to a variable name p that you override just after. So you could remove these lines and your code would run the same. This is why you don’t see the link. &hellip;
0
2020-04-30T15:24:09.642Z
https://discuss.pytorch.org/t/cannot-calculate-second-order-gradients-even-though-create-graph-true/78711/12
I think the problem in your code is: for p in m.parameters(): p = p - LR * p.grad This does not modify p inplace ! It just assigns the result to a variable name p that you override just after. So you could remove these lines and your code would run the same. This is why you don’t see the link. &hellip; This seems ...
1,554
{'text': ['I think the problem in your code is:\n\nfor p in m.parameters():\n\np = p - LR * p.grad\n\nThis does not modify p inplace ! It just assigns the result to a variable name p that you override just after. So you could remove these lines and your code would run the same.\n\nThis is why you don’t see the link.\n\...
How to get multi-target NLL in C++? (multi-target not supported at ClassNLLCriterion.c)
In the <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.NLLLoss" rel="nofollow noopener">python API</a>, the NLLLoss is allowed to take a target shape (N, d1, …, dk). However, in the c++ api, the torch::nll_loss will crash with an exception multi-target not supported at C:\w\1\s\windows\pytorch\aten\src\THNN/g...
0
2019-10-22T16:15:10.302Z
This seems to be indeed the right shape and I remembered I’ve seen this issue before! Could you check, if nll_loss2d is defined and if so use it instead of nll_loss (I’m currently not on my machine to check it)?
1
2019-10-22T16:42:46.543Z
https://discuss.pytorch.org/t/how-to-get-multi-target-nll-in-c-multi-target-not-supported-at-classnllcriterion-c/58929/6
I think the problem in your code is: for p in m.parameters(): p = p - LR * p.grad This does not modify p inplace ! It just assigns the result to a variable name p that you override just after. So you could remove these lines and your code would run the same. This is why you don’t see the link. &hellip; This seems ...
1,086
{'text': ['This seems to be indeed the right shape and I remembered I’ve seen this issue before!\n\nCould you check, if nll_loss2d is defined and if so use it instead of nll_loss (I’m currently not on my machine to check it)?'], 'answer_start': [1086]}
Image Classification completely wrong with PyTorch Mobile iOS example
Dear all, My trained/traced model got a good performance on PC. However, when i ship the model.pt to PyTorch Mobile and tested on iOS. the classification of same Image is completely wrong. i have no idea where is the problem and how to solve it. my model.pt is generated using Transfer learning wi&hellip;
0
2020-05-17T01:35:38.133Z
<a class="mention" href="/u/ptrblck">@ptrblck</a> <a class="mention" href="/u/xta0">@xta0</a> I have figured out where is the problem. i double checked the predict output of Desktop and iOS, the torch.max gives the same tensor value(more or less same) But in iOS, the label.txt should be generated along with PyTorch ...
2
2020-05-19T18:58:26.121Z
https://discuss.pytorch.org/t/image-classification-completely-wrong-with-pytorch-mobile-ios-example/81585/9
I think the problem in your code is: for p in m.parameters(): p = p - LR * p.grad This does not modify p inplace ! It just assigns the result to a variable name p that you override just after. So you could remove these lines and your code would run the same. This is why you don’t see the link. &hellip; This seems ...
522
{'text': ['<a class="mention" href="/u/ptrblck">@ptrblck</a> <a class="mention" href="/u/xta0">@xta0</a>\n\nI have figured out where is the problem.\n\ni double checked the predict output of Desktop and iOS, the torch.max gives the same tensor value(more or less same)\n\nBut in iOS, the label.txt should be generated al...
Error in QAT evaluate
When i run QAT, training is normal, but when i want to evaluate the qat model, an error length of scales must equal to channel confuse me. I use pytorch 1.4.0, and my code is # Traing is Normal net = MyQATNet() net.fuse_model() net.qconfig = torch.quantization.get_default_qat_config(&quot;fbgemm&quot;) net_&helli...
0
2020-06-10T12:21:35.850Z
I think somebody have the same error: <a href="https://discuss.pytorch.org/t/issue-with-quantization/67457" class="inline-onebox">Issue with Quantization</a> I think i know the answew: # pytorch 1.4 #save torch.save(net.state_dict(),&#39;xx&#39;) # fp32 model #load model.qconfig = torch.quantization.get_default_q...
1
2020-06-11T08:14:20.200Z
https://discuss.pytorch.org/t/error-in-qat-evaluate/84901/10
I think somebody have the same error: <a href="https://discuss.pytorch.org/t/issue-with-quantization/67457" class="inline-onebox">Issue with Quantization</a> I think i know the answew: # pytorch 1.4 #save torch.save(net.state_dict(),&#39;xx&#39;) # fp32 model #load model.qconfig = torch.quantization.get_default_q...
1,818
{'text': ['I think somebody have the same error: <a href="https://discuss.pytorch.org/t/issue-with-quantization/67457" class="inline-onebox">Issue with Quantization</a>\n\nI think i know the answew:\n\n# pytorch 1.4\n\n#save\n\ntorch.save(net.state_dict(),&#39;xx&#39;) # fp32 model\n\n#load\n\nmodel.qconfig = torch.qua...
Outputs = func(*inputs) TypeError: ‘Tensor’ object is not callable
Hello I aimed to calculate the jacobian of a tensor (n by m) with respect a tensor (m by d) so i tried this code: torch.autograd.functional.jacobian(output,W) where output is the output of my network and gives me the following error outputs = func(*inputs) TypeError: ‘Tensor’ object is not call&hellip;
0
2020-05-17T09:22:27.141Z
You can do that. But if you already have a module, you can do: mod = nn.Linear(10, 10) jacobian(func, x) # To get the jacobian of the output wrt x You should set create_graph=True if you want to backprop through that operation.
1
2020-05-19T19:23:57.675Z
https://discuss.pytorch.org/t/outputs-func-inputs-typeerror-tensor-object-is-not-callable/81620/10
I think somebody have the same error: <a href="https://discuss.pytorch.org/t/issue-with-quantization/67457" class="inline-onebox">Issue with Quantization</a> I think i know the answew: # pytorch 1.4 #save torch.save(net.state_dict(),&#39;xx&#39;) # fp32 model #load model.qconfig = torch.quantization.get_default_q...
1,338
{'text': ['You can do that.\n\nBut if you already have a module, you can do:\n\nmod = nn.Linear(10, 10)\n\njacobian(func, x) # To get the jacobian of the output wrt x\n\nYou should set create_graph=True if you want to backprop through that operation.'], 'answer_start': [1338]}
Shape '[32, 150528]' is invalid for input of size 1492992
Using GPU: True Epoch 1/10 ---------- --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) &lt;ipython-input-13-cd4c03781ec7&gt; in &lt;module&gt;() 8 exp_lr_scheduler = lr_scheduler.StepLR(optimizer, step_&hellip;
0
2020-08-21T14:42:50.803Z
I expect, your problem is when using view x = x.view(x.size(0), 3 * 224 * 224) which is giving error, without providing explicit shape it might be better to use x.view(x.shape[0],-1) Another problem might be in self.fc1 and self.fc2 As we know, torch.nn.Linear(in_features, out_features&hellip;
0
2020-08-21T15:16:05.373Z
https://discuss.pytorch.org/t/shape-32-150528-is-invalid-for-input-of-size-1492992/93641/2
I think somebody have the same error: <a href="https://discuss.pytorch.org/t/issue-with-quantization/67457" class="inline-onebox">Issue with Quantization</a> I think i know the answew: # pytorch 1.4 #save torch.save(net.state_dict(),&#39;xx&#39;) # fp32 model #load model.qconfig = torch.quantization.get_default_q...
661
{'text': ['I expect, your problem is when using view x = x.view(x.size(0), 3 * 224 * 224) which is giving error,\n\nwithout providing explicit shape it might be better to use\n\nx.view(x.shape[0],-1)\n\nAnother problem might be in self.fc1 and self.fc2\n\nAs we know, torch.nn.Linear(in_features, out_features&...
Loss.backward throwing CUDA Errors
Sorry that I am asking this again but I would need a confirmation before I try to switch to the nightly builds for the issue since they seem to be a bit unstable. This is the code:- @staticmethod def backward(ctx, grad_output): grad_label = grad_output.clone() num_ft = grad_ou&hellip;
0
2020-06-12T14:32:05.210Z
Sorry for the delayed reply, but yes it should be fixed by now. Let us know, if you run into this issue again, please.
1
2020-06-12T19:27:03.764Z
https://discuss.pytorch.org/t/loss-backward-throwing-cuda-errors/85221/19
Sorry for the delayed reply, but yes it should be fixed by now. Let us know, if you run into this issue again, please. But for 2D tensors, the transforms.ToPILImage() and transforms.ToTensor() are needed. Yes, I see you point here. Yes, images as tensors should be 3D tensors. In case of 2D tensors, I’d recommend to up...
1,938
{'text': ['Sorry for the delayed reply, but yes it should be fixed by now. Let us know, if you run into this issue again, please.'], 'answer_start': [1938]}
Transformation is reducing the number of channel
from torchvision import transforms M = torch.randint(low=0, high=2, size=(6, 64, 64), dtype = torch.float) N = torch.randint(low=0, high=2, size=(3, 64, 64), dtype = torch.float) gt_trans = transforms.Compose([ transforms.ToPILImage(), transforms.Resize((64, 64)), &hellip;
0
2020-11-17T00:09:19.495Z
But for 2D tensors, the transforms.ToPILImage() and transforms.ToTensor() are needed. Yes, I see you point here. Yes, images as tensors should be 3D tensors. In case of 2D tensors, I’d recommend to update the way to construct the input as 3D tensor, instead of 2D tensor. And in this case, I would&hellip;
1
2020-11-20T09:54:56.272Z
https://discuss.pytorch.org/t/transformation-is-reducing-the-number-of-channel/103033/8
Sorry for the delayed reply, but yes it should be fixed by now. Let us know, if you run into this issue again, please. But for 2D tensors, the transforms.ToPILImage() and transforms.ToTensor() are needed. Yes, I see you point here. Yes, images as tensors should be 3D tensors. In case of 2D tensors, I’d recommend to up...
1,088
{'text': ['But for 2D tensors, the transforms.ToPILImage() and transforms.ToTensor() are needed.\n\nYes, I see you point here. Yes, images as tensors should be 3D tensors. In case of 2D tensors, I’d recommend to update the way to construct the input as 3D tensor, instead of 2D tensor. And in this case, I would&hellip;'...
Constant Segmentation loss
Hey, I am training a simple Unet on dice and BCE loss on the Salt segmentation challenge on Kaggle. My model’s loss is not changing at all. In this example, I pick a dataset of only 5 examples and keep interacting through and get a constant loss. My gradients are not getting backdroped I think, what&hellip;
0
2018-11-17T13:07:31.611Z
Just to make sure, you are running <a href="https://gist.github.com/ptrblck/27b4de4e291ffc0d85b33858d0bc8779">this</a> code and get a constant loss? Which PyTorch version are you using? If you are using an older version (&lt; 0.4.0), could you wrap your tensors into Variables and run it again?
0
2018-11-17T14:01:21.906Z
https://discuss.pytorch.org/t/constant-segmentation-loss/29840/9
Sorry for the delayed reply, but yes it should be fixed by now. Let us know, if you run into this issue again, please. But for 2D tensors, the transforms.ToPILImage() and transforms.ToTensor() are needed. Yes, I see you point here. Yes, images as tensors should be 3D tensors. In case of 2D tensors, I’d recommend to up...
426
{'text': ['Just to make sure, you are running <a href="https://gist.github.com/ptrblck/27b4de4e291ffc0d85b33858d0bc8779">this</a> code and get a constant loss?\n\nWhich PyTorch version are you using? If you are using an older version (&lt; 0.4.0), could you wrap your tensors into Variables and run it again?'], 'answer_...
Pytorch reading tensors from file of tensors
I have some really big input tensors and I was running into memory issues while building them, so I read them one by one into a .pt file. As I run the script that generates and saves the file, the file gets bigger and bigger, so I am assuming that the tensors are saving correctly. Here is that code: &hellip;
0
2020-09-27T04:43:27.046Z
Ho for that, the answer is definitely yes for the first and no for the second. Our dataloaders under the hood do the exact same thing of loading things from the disk actually in some cases. So the fact that memory is in ram or is read on the fly does not change at all how the training is going to &hellip;
1
2020-10-05T22:19:11.017Z
https://discuss.pytorch.org/t/pytorch-reading-tensors-from-file-of-tensors/97579/10
Ho for that, the answer is definitely yes for the first and no for the second. Our dataloaders under the hood do the exact same thing of loading things from the disk actually in some cases. So the fact that memory is in ram or is read on the fly does not change at all how the training is going to &hellip; rand_state ...
1,442
{'text': ['Ho for that, the answer is definitely yes for the first and no for the second.\n\nOur dataloaders under the hood do the exact same thing of loading things from the disk actually in some cases.\n\nSo the fact that memory is in ram or is read on the fly does not change at all how the training is going to &hell...
Multinomial changing seed
I have a pretty standard model. I need it to be reproducible, so I use a random seed. But when I insert a multinomial operation anywhere in the training code, e.g., torch.ones(10).multinomial(num_samples=2, replacement=False) It changes the output/performance of the model.
0
2021-01-01T15:14:46.636Z
rand_state = torch.random.get_rng_state() torch.random.manual_seed(torch.randn(1).data) probas.multinomial(num_samples) # (temporarily) changes seed torch.random.set_rng_state(rand_state)
0
2021-01-04T19:54:58.406Z
https://discuss.pytorch.org/t/multinomial-changing-seed/107663/11
Ho for that, the answer is definitely yes for the first and no for the second. Our dataloaders under the hood do the exact same thing of loading things from the disk actually in some cases. So the fact that memory is in ram or is read on the fly does not change at all how the training is going to &hellip; rand_state ...
1,030
{'text': ['rand_state = torch.random.get_rng_state()\n\ntorch.random.manual_seed(torch.randn(1).data)\n\nprobas.multinomial(num_samples) # (temporarily) changes seed\n\ntorch.random.set_rng_state(rand_state)'], 'answer_start': [1030]}
How do I pass single jpg file as an argument to predicting function in pytorch?
Hello, i have started to work with pytorch in order to use it in my AI classes project. I have been following ‘60 minutes blitz’ tutorial and everything went quite smooth. The only difference is that im using ImageFolder - not the CIFAR10 dataset. Training my model went great but i occured a proble&hellip;
0
2020-05-17T12:22:25.138Z
yes. your image is gray. Maybe you can stack your image three times and feed it into your net.
1
2020-05-17T15:34:46.314Z
https://discuss.pytorch.org/t/how-do-i-pass-single-jpg-file-as-an-argument-to-predicting-function-in-pytorch/81634/10
Ho for that, the answer is definitely yes for the first and no for the second. Our dataloaders under the hood do the exact same thing of loading things from the disk actually in some cases. So the fact that memory is in ram or is read on the fly does not change at all how the training is going to &hellip; rand_state ...
501
{'text': ['yes. your image is gray. Maybe you can stack your image three times and feed it into your net.'], 'answer_start': [501]}
JIT does not support parameter.requires_grad?
Hi, is it a known limitation that jit.trace will ignore temporary requires_grad = False? Here is an example: # EXAMPLE 1 import torch from torch import nn, jit from torch.optim import SGD inputs = torch.tensor([2.0], device=&quot;cuda&quot;) model = nn.Linear(1, 1, bias=False).to(&quot;cuda&quot;) optimizer = ...
0
2021-03-08T00:45:19.344Z
For everyone wondering: requires_grad is not supposed to work. trace only tracks tensor operations, not attributes. See <a href="https://github.com/pytorch/pytorch/issues/53515#issuecomment-793188191" class="inline-onebox" rel="noopener nofollow ugc">[JIT] jit.trace does not support parameter.requires_grad? · Issue #53...
0
2021-03-09T08:21:53.498Z
https://discuss.pytorch.org/t/jit-does-not-support-parameter-requires-grad/113998/3
For everyone wondering: requires_grad is not supposed to work. trace only tracks tensor operations, not attributes. See <a href="https://github.com/pytorch/pytorch/issues/53515#issuecomment-793188191" class="inline-onebox" rel="noopener nofollow ugc">[JIT] jit.trace does not support parameter.requires_grad? · Issue #53...
1,190
{'text': ['For everyone wondering: requires_grad is not supposed to work. trace only tracks tensor operations, not attributes. See <a href="https://github.com/pytorch/pytorch/issues/53515#issuecomment-793188191" class="inline-onebox" rel="noopener nofollow ugc">[JIT] jit.trace does not support parameter.requires_grad? ...
What happens when loss are negative?
Based on my understanding of back prop and gradient descent, Loss is multiplied to gradient when taking a step with gradient descent. So when gradient becomes negative, gradient descent takes a step in the opposite direction. Such idea is well captured when implementing gradient ascent, as it ca&hellip;
8
2019-06-13T17:21:07.732Z
Hello Brandon! [image] ljj7975: Based on my understanding of back prop and gradient descent, Loss is multiplied to gradient when taking a step with gradient descent. So when gradient becomes negative, gradient descent takes a step in the opposite direction. This isn’t true. All common opt&hellip;
16
2019-06-13T17:57:19.787Z
https://discuss.pytorch.org/t/what-happens-when-loss-are-negative/47883/3
For everyone wondering: requires_grad is not supposed to work. trace only tracks tensor operations, not attributes. See <a href="https://github.com/pytorch/pytorch/issues/53515#issuecomment-793188191" class="inline-onebox" rel="noopener nofollow ugc">[JIT] jit.trace does not support parameter.requires_grad? · Issue #53...
1,039
{'text': ['Hello Brandon!\n\n[image] ljj7975:\n\nBased on my understanding of back prop and gradient descent,\n\nLoss is multiplied to gradient when taking a step with gradient descent.\n\nSo when gradient becomes negative, gradient descent takes a step in the opposite direction.\n\nThis isn’t true. All common opt&hel...
Model.eval() giving 'out of bounds' error
Hi everyone! Preparing to deploy a trained model to AWS (code below). Not sure how to configure Model.eval() to take in simulated user-input and provide an output. <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/5/1/519b102a55d65064c9d33d748f938f76cbed34f6.png" data-download-href="htt...
0
2020-03-07T20:30:26.110Z
So, the solution is: came from the shape of your tensors being correct. In order for the tensor to be valid it must have a valid length, and in this case the same columns as the training data. So in our case we would want the tensor for categorical data to be (1,7) and (1,8) for numerical data This&hellip;
0
2020-03-09T04:51:29.085Z
https://discuss.pytorch.org/t/model-eval-giving-out-of-bounds-error/72422/6
For everyone wondering: requires_grad is not supposed to work. trace only tracks tensor operations, not attributes. See <a href="https://github.com/pytorch/pytorch/issues/53515#issuecomment-793188191" class="inline-onebox" rel="noopener nofollow ugc">[JIT] jit.trace does not support parameter.requires_grad? · Issue #53...
748
{'text': ['So, the solution is: came from the shape of your tensors being correct. In order for the tensor to be valid it must have a valid length, and in this case the same columns as the training data. So in our case we would want the tensor for categorical data to be (1,7) and (1,8) for numerical data\n\nThis&hellip...
A100 training slower than V100
I have moved my model from V100 to A100 and instead of seeing an increase in speed these has been a significant slowdown from 14.2 it/sec to 10.06 it/sec. cuda version 11.3 Pytorch version 1.9.0+cu111 I have been specifically using the code from GitHub repository (NLSPN) [image] <a href="https://github.com/zzangji...
0
2021-12-10T11:30:08.975Z
dist.init_process_group(backend=&#39;nccl&#39;, init_method=&#39;env://&#39;, world_size=args.num_gpus, rank=gpu) torch.cuda.set_device(gpu) # Prepare dataset data = get_data(args) data_train = data(args, &#39;train&#39;) data_val = data(args, &#39;val&#39;) sampler_train = Di&hellip;
0
2021-12-11T18:06:45.441Z
https://discuss.pytorch.org/t/a100-training-slower-than-v100/139055/5
dist.init_process_group(backend=&#39;nccl&#39;, init_method=&#39;env://&#39;, world_size=args.num_gpus, rank=gpu) torch.cuda.set_device(gpu) # Prepare dataset data = get_data(args) data_train = data(args, &#39;train&#39;) data_val = data(args, &#39;val&#39;) sampler_train = Di&hellip; Per <a class="mention" href...
2,112
{'text': ['dist.init_process_group(backend=&#39;nccl&#39;, init_method=&#39;env://&#39;,\n\nworld_size=args.num_gpus, rank=gpu)\n\ntorch.cuda.set_device(gpu)\n\n# Prepare dataset\n\ndata = get_data(args)\n\ndata_train = data(args, &#39;train&#39;)\n\ndata_val = data(args, &#39;val&#39;)\n\nsampler_train = Di&hellip;'],...
Weighted BCE loss with logits
I am dealing with imbalanced dataset. I want to use weighted BCE loss with logits. <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.BCEWithLogitsLoss" rel="noopener nofollow ugc">nn.BCEWithLogitsLoss </a> takes pos_weight argument. From the docs: pos_weight (<a href="https://pytorch.org/docs/stable/tensors.h...
0
2022-04-26T14:58:38.285Z
Per <a class="mention" href="/u/kfrank">@KFrank</a>’s insightful observation above, it sounds like what you really have is a single binary classification, whereas an output shaped [16,2] and a pos_weight shaped [2] is meant for a two-class binary classification. In writing this I’m realizing the terminology is confusin...
1
2022-04-27T12:41:52.002Z
https://discuss.pytorch.org/t/weighted-bce-loss-with-logits/150134/8
dist.init_process_group(backend=&#39;nccl&#39;, init_method=&#39;env://&#39;, world_size=args.num_gpus, rank=gpu) torch.cuda.set_device(gpu) # Prepare dataset data = get_data(args) data_train = data(args, &#39;train&#39;) data_val = data(args, &#39;val&#39;) sampler_train = Di&hellip; Per <a class="mention" href...
1,349
{'text': ['Per <a class="mention" href="/u/kfrank">@KFrank</a>’s insightful observation above, it sounds like what you really have is a single binary classification, whereas an output shaped [16,2] and a pos_weight shaped [2] is meant for a two-class binary classification. In writing this I’m realizing the terminology ...
Model training with automatic mixed precision is not learning
Using mix precision, the loss flattens out after the first few iterations. The model trains fine when mix precision is not used. Here is an example of how it’s implemented. I am using a ctc loss function for i, _data in enumerate(train_loader): spectrograms, labels, input_lengths, label_length&hellip;
0
2020-04-07T19:10:37.027Z
Thanks, <a class="mention" href="/u/mcarilli">@mcarilli</a>. A few iterations in this context is about 1000 iterations. And you’re right scaler.scale(loss).backward() should be outside the autocast context. The actual fix was due to how PyTorch did dynamic scaling. For my specific use-case, I had to set the growth_int...
3
2020-04-08T02:50:26.408Z
https://discuss.pytorch.org/t/model-training-with-automatic-mixed-precision-is-not-learning/75756/4
dist.init_process_group(backend=&#39;nccl&#39;, init_method=&#39;env://&#39;, world_size=args.num_gpus, rank=gpu) torch.cuda.set_device(gpu) # Prepare dataset data = get_data(args) data_train = data(args, &#39;train&#39;) data_val = data(args, &#39;val&#39;) sampler_train = Di&hellip; Per <a class="mention" href...
642
{'text': ['Thanks, <a class="mention" href="/u/mcarilli">@mcarilli</a>. A few iterations in this context is about 1000 iterations.\n\nAnd you’re right scaler.scale(loss).backward() should be outside the autocast context. The actual fix was due to how PyTorch did dynamic scaling. For my specific use-case, I had to set t...
Dtype error expected long but got float
Hi I am trying to implement an Classifier but I got the following error. I have no idea why this is happening <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/c/3c02b2121905195874d99bea30466a2804aad5b6.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/3c02b2121905...
0
2020-03-27T11:19:36.339Z
Thank you for the reply. I found the solution on another website. Simply change all the parameters of model to float by using net.float() before loss and convert the input to float.
0
2020-03-28T05:47:26.891Z
https://discuss.pytorch.org/t/dtype-error-expected-long-but-got-float/74521/3
Thank you for the reply. I found the solution on another website. Simply change all the parameters of model to float by using net.float() before loss and convert the input to float. Yeah, that’s it! Thanks a lot for checking it out. I experimented with different settings of cudnn and found that calling torch.backend...
1,984
{'text': ['Thank you for the reply. I found the solution on another website.\n\nSimply change all the parameters of model to float by using net.float() before loss and convert the input to float.'], 'answer_start': [1984]}
Training multiple models with one dataloader
Hi, The bottleneck of my training routine is its data augmentation, which is “sufficiently” optimized. In order to speed-up hyperparameter search, I thought it’d be a good idea to train two models, each on another GPU, simultaneously using one dataloader. As far as I understand, this could be seen&hellip;
0
2021-11-05T18:16:11.539Z
Yeah, that’s it! Thanks a lot for checking it out. I experimented with different settings of cudnn and found that calling torch.backends.cudnn.deterministic = True was sufficient to solve the issue. Some additional info with respect to runtime per batch for future readers (ii and iii solve the i&hellip;
0
2021-11-12T10:50:04.504Z
https://discuss.pytorch.org/t/training-multiple-models-with-one-dataloader/136117/10
Thank you for the reply. I found the solution on another website. Simply change all the parameters of model to float by using net.float() before loss and convert the input to float. Yeah, that’s it! Thanks a lot for checking it out. I experimented with different settings of cudnn and found that calling torch.backend...
1,175
{'text': ['Yeah, that’s it! Thanks a lot for checking it out.\n\nI experimented with different settings of cudnn and found that calling\n\ntorch.backends.cudnn.deterministic = True\n\nwas sufficient to solve the issue.\n\nSome additional info with respect to runtime per batch for future readers (ii and iii solve the i&...
Dataset input Nan but fine on index
<a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/e/ce3b73d32bebb5e0b9d6f18c08782be18ad9510d.png" data-download-href="https://discuss.pytorch.org/uploads/default/ce3b73d32bebb5e0b9d6f18c08782be18ad9510d" title="image">[image]</a> I get the message as below when I’m training WideResNet...
0
2021-05-09T14:36:11.463Z
Thanks for the update. Could you execute these runs and see, if the behavior changes, as a sync wouldn’t be strictly necessary, but would help us to isolate is an internal method is broken: add synchronizations in the train_data loop before and after each line of code set non_blocking=False reru&hellip;
0
2021-05-10T23:25:37.862Z
https://discuss.pytorch.org/t/dataset-input-nan-but-fine-on-index/120733/5
Thank you for the reply. I found the solution on another website. Simply change all the parameters of model to float by using net.float() before loss and convert the input to float. Yeah, that’s it! Thanks a lot for checking it out. I experimented with different settings of cudnn and found that calling torch.backend...
492
{'text': ['Thanks for the update.\n\nCould you execute these runs and see, if the behavior changes, as a sync wouldn’t be strictly necessary, but would help us to isolate is an internal method is broken:\n\nadd synchronizations in the train_data loop before and after each line of code\n\nset non_blocking=False\n\nreru&...
DDP with multiple models
Hi, I’m trying to train two models A and B on 4 GPUs, each being trained on 2 GPUs (and thus DDP is needed). The two models are independent, but they need to exchange some information during training (not gradients), hence I would like to execute a single command torch.distributed.launch so that th&hellip;
0
2021-07-06T08:21:17.630Z
You can launch 4 processes (1 per GPU) and initialize a process group of world_size 4. You can use this process group to exchange data between A and B. Then for each model, create a new subprocess group using <a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.new_group" class="inline-onebox" r...
1
2021-07-06T23:42:36.540Z
https://discuss.pytorch.org/t/ddp-with-multiple-models/125923/2
You can launch 4 processes (1 per GPU) and initialize a process group of world_size 4. You can use this process group to exchange data between A and B. Then for each model, create a new subprocess group using <a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.new_group" class="inline-onebox" r...
1,600
{'text': ['You can launch 4 processes (1 per GPU) and initialize a process group of world_size 4. You can use this process group to exchange data between A and B.\n\nThen for each model, create a new subprocess group using <a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.new_group" class="inl...
Inconsistency During Inference
I have trained several models and would like to compare their performance on a single image. The problem is that running the same model (let’s call it A) produces different results. I have set the model to evaluation mode (i.e. A = myModel.eval()) and I am using “with torch.no_grad()” yet every time&hellip;
0
2021-02-23T15:36:03.948Z
[image] zhuser: I do agree that this has to be the case and I would like to attract your attention to the point that printing out the auto_grad status of the different layers of the model using “.named_parameters()” and then applying “.requires_grad” shows “requires_grad=True”. Given that the wh&hellip;
0
2021-02-25T17:58:21.964Z
https://discuss.pytorch.org/t/inconsistency-during-inference/112736/9
You can launch 4 processes (1 per GPU) and initialize a process group of world_size 4. You can use this process group to exchange data between A and B. Then for each model, create a new subprocess group using <a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.new_group" class="inline-onebox" r...
1,250
{'text': ['[image] zhuser:\n\nI do agree that this has to be the case and I would like to attract your attention to the point that printing out the auto_grad status of the different layers of the model using “.named_parameters()” and then applying “.requires_grad” shows “requires_grad=True”. Given that the wh&hellip;']...
Training specific examples from CIFAR 100
I have been working on CIFAR 100 torchvision built in dataset. I wanted to train my model for images with some specific labels and want to remove other training examples. How do do that?
0
2020-05-21T15:36:29.450Z
Here is an alternative. Use <a href="https://course.fast.ai/datasets" rel="nofollow noopener">fastai_datasets</a> to get your CIFAR100 dataset. The reason being it provides data in Imagenet form i.e. every class/label image are in their separate folders and you can just delete the folders/classes that you do not want. ...
2
2020-05-21T22:09:32.241Z
https://discuss.pytorch.org/t/training-specific-examples-from-cifar-100/82339/12
You can launch 4 processes (1 per GPU) and initialize a process group of world_size 4. You can use this process group to exchange data between A and B. Then for each model, create a new subprocess group using <a href="https://pytorch.org/docs/stable/distributed.html#torch.distributed.new_group" class="inline-onebox" r...
756
{'text': ['Here is an alternative. Use <a href="https://course.fast.ai/datasets" rel="nofollow noopener">fastai_datasets</a> to get your CIFAR100 dataset. The reason being it provides data in Imagenet form i.e. every class/label image are in their separate folders and you can just delete the folders/classes that you do...
C++ extension performance issue
I’m writing a C++ extension to optimize the performance of a custom function. As a starting point I’m only focused on the CPU version. My optimized version should in principle be faster by ~30%. However, it runs in about the same time. Below are my code: Unoptimized version: torch::Tensor symsum&hellip;
0
2021-12-16T20:52:14.230Z
I tried implementing AVX version. On my PC it runs 3 times faster Duration symsum_avx: 0.127393 s Duration symsum_forward_unoptimized: 0.370589 s EDIT: changed loading and storing to unaligned versions as suggested here’s the code, if you’re interested torch::Tensor symsum_avx(torch::Tensor inp&hellip;
1
2021-12-18T16:04:58.466Z
https://discuss.pytorch.org/t/c-extension-performance-issue/139572/6
I tried implementing AVX version. On my PC it runs 3 times faster Duration symsum_avx: 0.127393 s Duration symsum_forward_unoptimized: 0.370589 s EDIT: changed loading and storing to unaligned versions as suggested here’s the code, if you’re interested torch::Tensor symsum_avx(torch::Tensor inp&hellip; Sorry, I do...
2,484
{'text': ['I tried implementing AVX version. On my PC it runs 3 times faster\n\nDuration symsum_avx: 0.127393 s\n\nDuration symsum_forward_unoptimized: 0.370589 s\n\nEDIT: changed loading and storing to unaligned versions as suggested\n\nhere’s the code, if you’re interested\n\ntorch::Tensor symsum_avx(torch::Tensor in...
Slow Forward Time
I am implementing a network for point cloud. However, the forward time for feature_extraction Module is much slower than the detection module. Below is the network implementation. Is there a way to speed up the implementation? class ResUNet2(ME.MinkowskiNetwork): NORM_TYPE = None BLOCK_NORM_TYP&hellip;
0
2020-04-03T08:27:44.952Z
Sorry, I don’t know if the function you need exists. But I can show you what I will do: coords_A = coords.view(coords.shape[0], 1, 3).repeat(1, coords.shape[0], 1) coords_B = coords.view(1, coords.shape[0], 3).repeat(coords.shape[0], 1, 1) coords_confusion = torch.stack((coords_A, coords_B), dim=2)&hellip;
0
2020-04-03T14:46:21.681Z
https://discuss.pytorch.org/t/slow-forward-time/75207/9
I tried implementing AVX version. On my PC it runs 3 times faster Duration symsum_avx: 0.127393 s Duration symsum_forward_unoptimized: 0.370589 s EDIT: changed loading and storing to unaligned versions as suggested here’s the code, if you’re interested torch::Tensor symsum_avx(torch::Tensor inp&hellip; Sorry, I do...
1,551
{'text': ['Sorry, I don’t know if the function you need exists. But I can show you what I will do:\n\ncoords_A = coords.view(coords.shape[0], 1, 3).repeat(1, coords.shape[0], 1)\n\ncoords_B = coords.view(1, coords.shape[0], 3).repeat(coords.shape[0], 1, 1)\n\ncoords_confusion = torch.stack((coords_A, coords_B), dim=2)&...
Converting pre Pytorch1.0 code
I have a PyTorch code written in PyTorch 0.4 and I want to upgrade it. The major part where I am getting stuck is with the CUDA kernels. I know that I need to use ATen library but I do not think it is very properly documented and hence as such I am completely stuck while trying to do the upgrade. Th&hellip;
1
2020-06-25T07:35:31.836Z
Yeah. If that bothers you in the overall picture, Probably go with a custom kernel. Best regards Thomas
1
2020-06-27T22:52:47.471Z
https://discuss.pytorch.org/t/converting-pre-pytorch1-0-code/86831/10
I tried implementing AVX version. On my PC it runs 3 times faster Duration symsum_avx: 0.127393 s Duration symsum_forward_unoptimized: 0.370589 s EDIT: changed loading and storing to unaligned versions as suggested here’s the code, if you’re interested torch::Tensor symsum_avx(torch::Tensor inp&hellip; Sorry, I do...
620
{'text': ['Yeah. If that bothers you in the overall picture, Probably go with a custom kernel.\n\nBest regards\n\nThomas'], 'answer_start': [620]}
Training with batch_size = 1, all outputs are the same and trains poorly
I am trying to train a network to output target values (between 0 and 1). I cannot batch my inputs, so I am using a batch size of 1. Since I don’t want the sum of the loss gradients of each example, but the gradient of the average loss, I am adding item_loss/num_items for each item to end up with an&hellip;
0
2020-11-12T00:42:29.409Z
I cleaned up and modularized my model and solved the case with multiple samples all having the same output. It had to do with me passing the original inputs into a linear layer instead of the convolved inputs. Since all the inputs contain similar sets of elements, except the elements are related in&hellip;
0
2020-11-16T04:57:16.680Z
https://discuss.pytorch.org/t/training-with-batch-size-1-all-outputs-are-the-same-and-trains-poorly/102477/10
I cleaned up and modularized my model and solved the case with multiple samples all having the same output. It had to do with me passing the original inputs into a linear layer instead of the convolved inputs. Since all the inputs contain similar sets of elements, except the elements are related in&hellip; You could r...
1,450
{'text': ['I cleaned up and modularized my model and solved the case with multiple samples all having the same output. It had to do with me passing the original inputs into a linear layer instead of the convolved inputs.\n\nSince all the inputs contain similar sets of elements, except the elements are related in&hellip...
Ensemble two features
I need to ensemble the features only that help in classification which I can extract it from two different models . So I need to remove the last layer first from each model then start to concatenate them … how can the ensemble method will be ?
0
2021-12-06T04:50:45.671Z
You could replace the last linear layers with nn.Identity modules and create the ensemble as described in <a href="https://discuss.pytorch.org/t/custom-ensemble-approach/52024/4">this post</a>.
1
2021-12-06T07:22:17.182Z
https://discuss.pytorch.org/t/ensemble-two-features/138620/2
I cleaned up and modularized my model and solved the case with multiple samples all having the same output. It had to do with me passing the original inputs into a linear layer instead of the convolved inputs. Since all the inputs contain similar sets of elements, except the elements are related in&hellip; You could r...
1,034
{'text': ['You could replace the last linear layers with nn.Identity modules and create the ensemble as described in <a href="https://discuss.pytorch.org/t/custom-ensemble-approach/52024/4">this post</a>.'], 'answer_start': [1034]}
Custom color mapping in data loader for UNET image segmentation
Hi, I have a 1000x1000 image and a mask of the same size with 5 color-coded classes (blue, red, dark green, light green, and pink). <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/a/ca933445e89256b8d643d14c4dbc9da9b26c34de.png" data-download-href="https://discuss.pytorch.org/upload...
0
2021-05-20T18:24:40.454Z
Figured it out! The fill tool I was using on GIMP had anti-aliasing which added additional pixel values to the mask boundary in order to smooth the edges. Thank you.
0
2021-06-04T19:48:39.180Z
https://discuss.pytorch.org/t/custom-color-mapping-in-data-loader-for-unet-image-segmentation/121876/12
I cleaned up and modularized my model and solved the case with multiple samples all having the same output. It had to do with me passing the original inputs into a linear layer instead of the convolved inputs. Since all the inputs contain similar sets of elements, except the elements are related in&hellip; You could r...
503
{'text': ['Figured it out! The fill tool I was using on GIMP had anti-aliasing which added additional pixel values to the mask boundary in order to smooth the edges. Thank you.'], 'answer_start': [503]}
Indices returned by torch.topk is of wrong order
The indices return by torch.topk is strange. In my option, if sorted=False, then the returned indices should be sorted, that is the elements in the indices are ascending. However, in the following example, t2 has something wrong: 2144, 20, 104, 118, 123, 136, 137, 144, 171 &gt;&gt;&gt; import tor&hellip;
0
2020-03-25T03:34:06.063Z
If you don’t specify sorted=True, there is no guarantee of any order (sorted or original order). [image] ShengweiAn: Such as the non-determinism incurred by the parallelism. But rerunning topk for servel times gave same results. Yes, that’s most likely the reason at least for GPU runs. I’m &hellip;
0
2020-03-28T04:55:01.594Z
https://discuss.pytorch.org/t/indices-returned-by-torch-topk-is-of-wrong-order/74305/9
If you don’t specify sorted=True, there is no guarantee of any order (sorted or original order). [image] ShengweiAn: Such as the non-determinism incurred by the parallelism. But rerunning topk for servel times gave same results. Yes, that’s most likely the reason at least for GPU runs. I’m &hellip; No problem! Seem...
1,336
{'text': ['If you don’t specify sorted=True, there is no guarantee of any order (sorted or original order).\n\n[image] ShengweiAn:\n\nSuch as the non-determinism incurred by the parallelism.\n\nBut rerunning topk for servel times gave same results.\n\nYes, that’s most likely the reason at least for GPU runs. I’m &helli...
Find derivative of model's paremeters wrt to a vector
Hello, I am trying to find a double derivative using the torch.autograd.grad fucntion. It requires a step where I have to find the double derivative of the model’s parameters wrt to a vector (in this case A). Can someone please guide me how to do so? # reproduce error import torch import torch.nn &hellip;
0
2021-06-14T20:30:47.190Z
No problem! Seems like since you need to update A later using this computed gradient, it actually seems like the vjp IS what you want here. In that case, I wouldn’t worry about the “entire Jacobian” to much and no further action is needed apart from just using .grad(delL_delWo, A), and using a grad_&hellip;
0
2021-06-15T15:01:57.028Z
https://discuss.pytorch.org/t/find-derivative-of-models-paremeters-wrt-to-a-vector/124104/4
If you don’t specify sorted=True, there is no guarantee of any order (sorted or original order). [image] ShengweiAn: Such as the non-determinism incurred by the parallelism. But rerunning topk for servel times gave same results. Yes, that’s most likely the reason at least for GPU runs. I’m &hellip; No problem! Seem...
972
{'text': ['No problem! Seems like since you need to update A later using this computed gradient, it actually seems like the vjp IS what you want here. In that case, I wouldn’t worry about the “entire Jacobian” to much and no further action is needed apart from just using .grad(delL_delWo, A), and using a grad_&hellip;'...
Multiple nodes with Pytorch (Only CPUs)
Hi, For single node, I set os.environ[&#39;MASTER_ADDR&#39;] = &#39;localhost&#39; os.environ[&#39;MASTER_PORT&#39;] = &#39;29500&#39; and the size is as input parameter. However, with multiple nodes, we have to set differently. But I did now know how to set it? For example, I know the node names with 4 nodes as ...
0
2020-06-10T08:31:27.830Z
Thanks for reporting, it’s an error in the doc, I think it needs to be: rpc.ProcessGroupRpcBackendOptions( num_send_recv_threads=16, rpc_timeout=datetime.timedelta(seconds=1000) ) Let me try.
1
2020-06-10T16:07:13.167Z
https://discuss.pytorch.org/t/multiple-nodes-with-pytorch-only-cpus/84865/13
If you don’t specify sorted=True, there is no guarantee of any order (sorted or original order). [image] ShengweiAn: Such as the non-determinism incurred by the parallelism. But rerunning topk for servel times gave same results. Yes, that’s most likely the reason at least for GPU runs. I’m &hellip; No problem! Seem...
613
{'text': ['Thanks for reporting, it’s an error in the doc, I think it needs to be:\n\nrpc.ProcessGroupRpcBackendOptions(\n\nnum_send_recv_threads=16,\n\nrpc_timeout=datetime.timedelta(seconds=1000)\n\n)\n\nLet me try.'], 'answer_start': [613]}
My numpy and pytorch codes have totally different results
I wanted to calculate the sum of 1st to K-th power of an array and equally calculate the sum of 1st to k-th power of a tensor. I found out that the following codes and their results are totally different and I don’t know why. I debugged the code and I know that the results are equal in the first ro&hellip;
0
2019-02-16T21:26:15.228Z
The error is regarding the shallow/deep copy. If you add a copy() after assigning the numpy arrays, your code runs fine with an error of ~2e-7: adj_k_prob = adj_prob.copy() adj_k_pow = adj_prob.copy()
1
2019-02-18T20:32:17.679Z
https://discuss.pytorch.org/t/my-numpy-and-pytorch-codes-have-totally-different-results/37388/10
The error is regarding the shallow/deep copy. If you add a copy() after assigning the numpy arrays, your code runs fine with an error of ~2e-7: adj_k_prob = adj_prob.copy() adj_k_pow = adj_prob.copy() .eval() changes the behavior of some modules. For example, Batchnorm uses the saved statistics instead of the curre...
1,618
{'text': ['The error is regarding the shallow/deep copy.\n\nIf you add a copy() after assigning the numpy arrays, your code runs fine with an error of ~2e-7:\n\nadj_k_prob = adj_prob.copy()\n\nadj_k_pow = adj_prob.copy()'], 'answer_start': [1618]}
Possible reasons for regression problem with almost same prediction result
I have a model that predict four similar category numerical data (target values). I use a CNN to extract feature for each category target value, before FC layers, I also add two values to the flattened extracted feature maps. This works in Keras. I rewrite my codes with Pytorch. But the result of &hellip;
0
2020-01-14T06:10:17.967Z
.eval() changes the behavior of some modules. For example, Batchnorm uses the saved statistics instead of the current batch’s ones, dropout becomes an identity, etc
1
2020-01-18T05:45:50.127Z
https://discuss.pytorch.org/t/possible-reasons-for-regression-problem-with-almost-same-prediction-result/66596/10
The error is regarding the shallow/deep copy. If you add a copy() after assigning the numpy arrays, your code runs fine with an error of ~2e-7: adj_k_prob = adj_prob.copy() adj_k_pow = adj_prob.copy() .eval() changes the behavior of some modules. For example, Batchnorm uses the saved statistics instead of the curre...
1,014
{'text': ['.eval() changes the behavior of some modules. For example, Batchnorm uses the saved statistics instead of the current batch’s ones, dropout becomes an identity, etc'], 'answer_start': [1014]}
Combination losses: two backward or one backward?
Hello all, I have an architecture likes [Untitled%20Diagram%20(2)] The input is fed to Gen network to generate a fake image (fakeA). I use L1 loss to compute the different between input and fakeA. I called it is lossGen. The fakeA then is fed to the segmentation network to create a predA. I used &hellip;
0
2019-02-21T18:53:13.581Z
Both approaches should compute the same gradients. In the second approach you would need to call lossGen.backward(retain_graph=True), otherwise the intermediate values will be cleared and you’ll get an error calling lossSeg.backward(). However, currently you are using lossSeg to calculate gradient&hellip;
3
2019-02-21T20:18:02.628Z
https://discuss.pytorch.org/t/combination-losses-two-backward-or-one-backward/37887/2
The error is regarding the shallow/deep copy. If you add a copy() after assigning the numpy arrays, your code runs fine with an error of ~2e-7: adj_k_prob = adj_prob.copy() adj_k_pow = adj_prob.copy() .eval() changes the behavior of some modules. For example, Batchnorm uses the saved statistics instead of the curre...
370
{'text': ['Both approaches should compute the same gradients.\n\nIn the second approach you would need to call lossGen.backward(retain_graph=True), otherwise the intermediate values will be cleared and you’ll get an error calling lossSeg.backward().\n\nHowever, currently you are using lossSeg to calculate gradient&hell...
Weights loaded incorrectly
I was f’tuning VGG network for style transfer (Gatys et al, 2015) and kept getting results that made no sense, so after some debugging it turned out I uploaded the weights incorrectly. Can someone point out my error, because I tried it on other models, and it seemed to work? import vgg16 pretrained&hellip;
0
2019-10-15T14:38:47.991Z
Hi, This does not work because par = foo is assigning to the object foo the new name of par. What was in par before is deleted. If you want to write in the par Tensor, you need to use an inplace operation like par.copy_(foo) to copy into the Tensor that is in par. Also the .to() operation is alwa&hellip;
0
2019-10-15T15:30:59.186Z
https://discuss.pytorch.org/t/weights-loaded-incorrectly/58298/4
Hi, This does not work because par = foo is assigning to the object foo the new name of par. What was in par before is deleted. If you want to write in the par Tensor, you need to use an inplace operation like par.copy_(foo) to copy into the Tensor that is in par. Also the .to() operation is alwa&hellip; You need to...
1,356
{'text': ['Hi,\n\nThis does not work because par = foo is assigning to the object foo the new name of par. What was in par before is deleted.\n\nIf you want to write in the par Tensor, you need to use an inplace operation like par.copy_(foo) to copy into the Tensor that is in par.\n\nAlso the .to() operation is alwa&he...
Triplet loss stuck at margin alpha value
Hi everyone I’m struggling with the triplet loss convergence. I’m trying to do a face verification (1:1 problem) with a minimum computer calculation (since I don’t have GPU). So I’m using the facenet-pytorch model InceptionResnetV1 pretrained with vggface2 (casia-webface gives the same results). &hellip;
0
2022-02-06T22:11:43.300Z
You need to do extra inference pass before training, gather outputs, sort triplets out, then run training with these triplets. And this is rather complicated part, since every time you update weights your outputs change and all old outputs calculated before for combining triplet pairs become outdate&hellip;
0
2022-02-08T06:47:18.811Z
https://discuss.pytorch.org/t/triplet-loss-stuck-at-margin-alpha-value/143425/8
Hi, This does not work because par = foo is assigning to the object foo the new name of par. What was in par before is deleted. If you want to write in the par Tensor, you need to use an inplace operation like par.copy_(foo) to copy into the Tensor that is in par. Also the .to() operation is alwa&hellip; You need to...
987
{'text': ['You need to do extra inference pass before training, gather outputs, sort triplets out, then run training with these triplets. And this is rather complicated part, since every time you update weights your outputs change and all old outputs calculated before for combining triplet pairs become outdate&hellip;'...
TypeError: object() takes no parameters
Hi all, I have two folders, the first folder contain Original Images and the second folder contain the same Images with noise and I have no label. When I added path and loading images from paths in the code I get this error: 1 train_dataset = Dataset(path_input_1 = path_input_1 ----&gt; 2 ,path_inpu&hellip;
0
2020-07-07T18:39:42.803Z
Hi <a class="mention" href="/u/nikronic">@Nikronic</a> Thank you very much, everything works very well.
1
2020-07-08T15:51:55.278Z
https://discuss.pytorch.org/t/typeerror-object-takes-no-parameters/88277/10
Hi, This does not work because par = foo is assigning to the object foo the new name of par. What was in par before is deleted. If you want to write in the par Tensor, you need to use an inplace operation like par.copy_(foo) to copy into the Tensor that is in par. Also the .to() operation is alwa&hellip; You need to...
618
{'text': ['Hi <a class="mention" href="/u/nikronic">@Nikronic</a>\n\nThank you very much, everything works very well.'], 'answer_start': [618]}
Quantization/QAT causing jit.script to fail
Hello I’m trying to do QAT -&gt; Torchscript but am getting an error. My model is <details><summary>Click here</summary>import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.quantization import QuantStub, DeQuantStub def SeperableConv2d(in_channels, out_channels, kerne...
0
2020-07-09T07:27:51.326Z
Updating to torch nightly from torch 1.5.1 fixed the issue! (did not try 1.6)
1
2020-08-12T03:13:28.152Z
https://discuss.pytorch.org/t/quantization-qat-causing-jit-script-to-fail/88514/13
Updating to torch nightly from torch 1.5.1 fixed the issue! (did not try 1.6) in your code , it’s for creating val and train set . this is one way of spliting your dataset to train and val set. if you set sampler to None, dataloader choose samples from all semple in your dataset. [image] muhammedcanpirincci: i want...
1,444
{'text': ['Updating to torch nightly from torch 1.5.1 fixed the issue! (did not try 1.6)'], 'answer_start': [1444]}
New batch in each epoch
Hello. I am trying to use augmented and not augmented dataset in each epoch(for example: augmented in one epoch not augmented in different epoch) but i couldn’t figure out how to do it. My approach was loading DataLoader in each epoch again and again but I think it’s wrong. Because when i print inde&hellip;
0
2022-01-22T13:22:28.777Z
in your code , it’s for creating val and train set . this is one way of spliting your dataset to train and val set. if you set sampler to None, dataloader choose samples from all semple in your dataset. [image] muhammedcanpirincci: i want my program to select batch that doesnt have augmented &hellip;
1
2022-01-22T16:22:48.232Z
https://discuss.pytorch.org/t/new-batch-in-each-epoch/142302/6
Updating to torch nightly from torch 1.5.1 fixed the issue! (did not try 1.6) in your code , it’s for creating val and train set . this is one way of spliting your dataset to train and val set. if you set sampler to None, dataloader choose samples from all semple in your dataset. [image] muhammedcanpirincci: i want...
800
{'text': ['in your code , it’s for creating val and train set .\n\nthis is one way of spliting your dataset to train and val set.\n\nif you set sampler to None, dataloader choose samples from all semple in your dataset.\n\n[image] muhammedcanpirincci:\n\ni want my program to select batch that doesnt have augmented &hel...
How to do sort subsampling
Can any one help me with this question? Lets say i have a 4x4 tensor and i want to do subsampling in the following way, so for each 2x2 block i put the smallest elements together, then the second smallest elements, and so on, so the out put will be 4 tensors with size half of the input. Stride wil&hellip;
0
2018-08-07T20:31:20.761Z
You are right! Thanks for pointing this out. Here is a (hopefully) fixed version: kh, kw = 2, 2 dh, dw = 2, 2 input = torch.randint(10, (1,2,6,6)) input_windows = input.unfold(2, kh, dh).unfold(3, kw, dw) input_windows = input_windows.contiguous().view(*input_windows.size()[:-2], -1) input_windows&hellip;
0
2018-08-08T19:22:12.286Z
https://discuss.pytorch.org/t/how-to-do-sort-subsampling/22616/9
Updating to torch nightly from torch 1.5.1 fixed the issue! (did not try 1.6) in your code , it’s for creating val and train set . this is one way of spliting your dataset to train and val set. if you set sampler to None, dataloader choose samples from all semple in your dataset. [image] muhammedcanpirincci: i want...
384
{'text': ['You are right! Thanks for pointing this out.\n\nHere is a (hopefully) fixed version:\n\nkh, kw = 2, 2\n\ndh, dw = 2, 2\n\ninput = torch.randint(10, (1,2,6,6))\n\ninput_windows = input.unfold(2, kh, dh).unfold(3, kw, dw)\n\ninput_windows = input_windows.contiguous().view(*input_windows.size()[:-2], -1)\n\ninp...
Freeing gradients memory after optimizer step
I am training multiple models in a sequential way on the same GPU, and I need them to share the parameters after a given number of iterations. For GPU sonsumption optimization I need to free the gradients of each model at the end of each optimizer iteration. A simple solution is to set all gradients&hellip;
0
2021-03-29T13:48:30.002Z
Hi, Depending on the particular model and training loop, it may improve perf and not. Note that a simpler way to do this is via the regular zero grad: model.zero_grad(set_to_none=True).
2
2021-03-29T13:59:29.305Z
https://discuss.pytorch.org/t/freeing-gradients-memory-after-optimizer-step/116346/2
Hi, Depending on the particular model and training loop, it may improve perf and not. Note that a simpler way to do this is via the regular zero grad: model.zero_grad(set_to_none=True). Hi, You don’t have to do each parameter one by one, you can give all the params/grads as tuples. You get all zeros because your fu...
1,394
{'text': ['Hi,\n\nDepending on the particular model and training loop, it may improve perf and not.\n\nNote that a simpler way to do this is via the regular zero grad: model.zero_grad(set_to_none=True).'], 'answer_start': [1394]}
HVP w.r.t model parameters
Hi! I have seen that within the 1.5.0 release, the possibility to compute HVP of a function has been added. As far as I understand from the documentation, the HVP (as well as the VHP, VJP and so on) can be computed w.r.t. the input only, and not w.r.t. some other variable (such as, for instance, t&hellip;
0
2020-05-31T00:15:43.077Z
Hi, You don’t have to do each parameter one by one, you can give all the params/grads as tuples. You get all zeros because your function f does not use the inputs x to compute the output. You can do something like this to use the autograd API with torch.nn: # Utilities to make nn.Module function&hellip;
1
2020-05-31T22:03:38.189Z
https://discuss.pytorch.org/t/hvp-w-r-t-model-parameters/83520/4
Hi, Depending on the particular model and training loop, it may improve perf and not. Note that a simpler way to do this is via the regular zero grad: model.zero_grad(set_to_none=True). Hi, You don’t have to do each parameter one by one, you can give all the params/grads as tuples. You get all zeros because your fu...
885
{'text': ['Hi,\n\nYou don’t have to do each parameter one by one, you can give all the params/grads as tuples.\n\nYou get all zeros because your function f does not use the inputs x to compute the output.\n\nYou can do something like this to use the autograd API with torch.nn:\n\n# Utilities to make nn.Module function&...
Loss does not improve on training
Hi, I implemented a model which fails to learn. Loss calculated for every epoch is exactly the same and so is the sequence of losses over batches for every epoch. I have been fumbling around with this for a couple of days and apparently stumbled over the reason for this behaviour now. As it seems &hellip;
0
2019-08-01T09:26:09.551Z
Thanks tom for your reply. The learning rate was indeed set to 1.0 which is a bit high I guess but maybe not yet rediculous. Switching the learning rate back to 0.01 alone is not enough as it seems because I’m still getting my nans then. While I have still trouble getting a proper standard deviatio&hellip;
0
2019-08-08T11:47:25.855Z
https://discuss.pytorch.org/t/loss-does-not-improve-on-training/52289/11
Hi, Depending on the particular model and training loop, it may improve perf and not. Note that a simpler way to do this is via the regular zero grad: model.zero_grad(set_to_none=True). Hi, You don’t have to do each parameter one by one, you can give all the params/grads as tuples. You get all zeros because your fu...
497
{'text': ['Thanks tom for your reply. The learning rate was indeed set to 1.0 which is a bit high I guess but maybe not yet rediculous. Switching the learning rate back to 0.01 alone is not enough as it seems because I’m still getting my nans then.\n\nWhile I have still trouble getting a proper standard deviatio&hellip...