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
Using PyCharm to debug Pytorch model on GCE, AWS or Azure
Hello everyone, I know my question is not directly related to deep learning or Pytorch, but I have found this community so helpful and one time more I need your help. I have implemented a model using Pytorch, but I do not have access to GPU on my local environment and using Google Colab is so frus…
0
2019-05-25T19:33:37.317Z
[image] Nikronic: But, are you sure about Google colab? Yes, I’m sure. Done that several times. Having free K80 GPU right in PyCharm is super handy when you want to make your code GPU proofed. Configuration is tricky, multistep process, but doable. The main problem is that Colab VM instance …
4
2019-06-15T21:47:28.548Z
https://discuss.pytorch.org/t/using-pycharm-to-debug-pytorch-model-on-gce-aws-or-azure/46212/4
[image] Nikronic: But, are you sure about Google colab? Yes, I’m sure. Done that several times. Having free K80 GPU right in PyCharm is super handy when you want to make your code GPU proofed. Configuration is tricky, multistep process, but doable. The main problem is that Colab VM instance … Yes, plain Pytho...
1,100
{'text': ['[image] Nikronic:\n\nBut, are you sure about Google colab?\n\nYes, I’m sure. Done that several times. Having free K80 GPU right in PyCharm is super handy when you want to make your code GPU proofed.\n\nConfiguration is tricky, multistep process, but doable. The main problem is that Colab VM instance …...
Parameters initialised by nn.Parameter not present in the model.parameters()
Hi, I have defined the weight parameters as follows but still these trainable parameters are not listed in the model.parameters(). class Module(nn.Module): def __init__(input_dim, output_dim) #some variables def build(self): self.wt_dict = nn.ParameterDict() # self.wt_d…
1
2021-06-25T06:10:37.673Z
Yes, plain Python “containers” such as list, dict etc. won’t (recursively) register the parameters and buffers, so you should use the PyTorch equivalents instead such as nn.ParameterList, nn.ModuleList, nn.ModuleDict etc.
1
2021-06-25T23:34:08.865Z
https://discuss.pytorch.org/t/parameters-initialised-by-nn-parameter-not-present-in-the-model-parameters/124997/6
[image] Nikronic: But, are you sure about Google colab? Yes, I’m sure. Done that several times. Having free K80 GPU right in PyCharm is super handy when you want to make your code GPU proofed. Configuration is tricky, multistep process, but doable. The main problem is that Colab VM instance … Yes, plain Pytho...
854
{'text': ['Yes, plain Python “containers” such as list, dict etc. won’t (recursively) register the parameters and buffers, so you should use the PyTorch equivalents instead such as nn.ParameterList, nn.ModuleList, nn.ModuleDict etc.'], 'answer_start': [854]}
CUDA Synchronize using Aten.h for a PyTorch CUDA C++ extension
Hi all, I am trying to implement a mixed C++ CUDA Torch extension. My understanding is that I can only use ATen.h for this. (e.g. Torch.h cannot be used). The issue is that I wan to synchronize CUDA kernels from CPU, so I am trying to do the equivalent to cudaDeviceSynchronize() in CUDA , I canno…
0
2019-03-16T23:23:22.033Z
Hi all, finally I got what was wrong with my code: a) I had a very old NVIDIA driver and CUDA 8.0. So, I update my system to have a clean installation: NVIDIA-SMI 410.104 Driver Version: 410.104 CUDA Version: 10.0 b) * AT_CUDA_CHECK(cudaStreamSynchronize(stream));* was throwing out an e…
1
2019-03-19T01:15:48.795Z
https://discuss.pytorch.org/t/cuda-synchronize-using-aten-h-for-a-pytorch-cuda-c-extension/40048/8
[image] Nikronic: But, are you sure about Google colab? Yes, I’m sure. Done that several times. Having free K80 GPU right in PyCharm is super handy when you want to make your code GPU proofed. Configuration is tricky, multistep process, but doable. The main problem is that Colab VM instance … Yes, plain Pytho...
526
{'text': ['Hi all, finally I got what was wrong with my code:\n\na) I had a very old NVIDIA driver and CUDA 8.0. So, I update my system to have a clean installation:\n\nNVIDIA-SMI 410.104 Driver Version: 410.104 CUDA Version: 10.0\n\nb) * AT_CUDA_CHECK(cudaStreamSynchronize(stream));* was throwing out an e&he...
Values after softmax in torchscript in c++ is not same as python torch
#include <torch/torch.h> #include <torch/script.h> // One-stop header. #include <iostream> #include <memory> #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> using namespace cv; using namespace std; int main...
0
2020-01-28T20:13:11.573Z
If I’m not mistaken, OpenCV reads the image as [height, width, channels], while PIL.Image returns the array as [channels, height, width]. The torch::from_blob call might thus interleave the pixels. Have you checked the outputs? Also, resize should use the linear interpolation by default in OpenCV …
1
2020-01-29T07:43:41.930Z
https://discuss.pytorch.org/t/values-after-softmax-in-torchscript-in-c-is-not-same-as-python-torch/67947/4
If I’m not mistaken, OpenCV reads the image as [height, width, channels], while PIL.Image returns the array as [channels, height, width]. The torch::from_blob call might thus interleave the pixels. Have you checked the outputs? Also, resize should use the linear interpolation by default in OpenCV … Here is how...
1,668
{'text': ['If I’m not mistaken, OpenCV reads the image as [height, width, channels], while PIL.Image returns the array as [channels, height, width].\n\nThe torch::from_blob call might thus interleave the pixels. Have you checked the outputs?\n\nAlso, resize should use the linear interpolation by default in OpenCV &hell...
Distributed training with CPU's
Hi! I am interested in possibly using Ignite to enable distributed training in CPU’s (since I am training a shallow network and have no GPU"s available). I tried using ignite.distributed with the gloo backend, but when I set nproc_per_node to more than 1, the program gets stuck and doesn’t run (it …
0
2021-08-09T19:57:16.906Z
Here is how to launch the code on Jupyter. import os os.environ["CUDA_VISIBLE_DEVICES"] = "" import time import ignite.distributed as idist def training(local_rank, config, **kwargs): time.sleep(local_rank) print(idist.get_rank(), ': run with config:', config, '- backend=', id...
0
2021-08-09T22:27:42.926Z
https://discuss.pytorch.org/t/distributed-training-with-cpus/128983/4
If I’m not mistaken, OpenCV reads the image as [height, width, channels], while PIL.Image returns the array as [channels, height, width]. The torch::from_blob call might thus interleave the pixels. Have you checked the outputs? Also, resize should use the linear interpolation by default in OpenCV … Here is how...
1,143
{'text': ['Here is how to launch the code on Jupyter.\n\nimport os\n\nos.environ["CUDA_VISIBLE_DEVICES"] = ""\n\nimport time\n\nimport ignite.distributed as idist\n\ndef training(local_rank, config, **kwargs):\n\ntime.sleep(local_rank)\n\nprint(idist.get_rank(), ': run with config:', config,...
Model initialized from scratch is not training at all
Hi, I am trying to train a cnn to classify dogs, cats. But the network always outputs loss as 0.6931 and accuracy 50%. I have seen the same issue in this tutorial <a href="https://pytorch.org/tutorials/beginner/finetuning_torchvision_models_tutorial.html" rel="nofollow noopener">https://pytorch.org/tutorials/beginner...
0
2018-11-14T18:41:10.194Z
Could you post your training code so that we can have a look and debug it? Sometimes some hyperparameters are off, e.g. a too high learning rate was used.
0
2018-11-14T19:47:41.890Z
https://discuss.pytorch.org/t/model-initialized-from-scratch-is-not-training-at-all/29606/2
If I’m not mistaken, OpenCV reads the image as [height, width, channels], while PIL.Image returns the array as [channels, height, width]. The torch::from_blob call might thus interleave the pixels. Have you checked the outputs? Also, resize should use the linear interpolation by default in OpenCV &hellip; Here is how...
650
{'text': ['Could you post your training code so that we can have a look and debug it?\n\nSometimes some hyperparameters are off, e.g. a too high learning rate was used.'], 'answer_start': [650]}
Why is my DQN (Deep Q Network) not learning?
I am training a DQN (Deep Q Network) on a CartPole problem from OpenAI’s gym, but the total score from an episode decreases, instead of increasing. I don’t know if it is helpful but I noticed that the AI prefers one action over another and refuses to do anything else (unless it is forced by the epsi&hellip;
0
2021-07-10T07:05:34.736Z
No wait that’s totally messed up. Why do you even clone the prediction for the opt prediction? pred = self.net.predict(sample.state)[sample.action] opt_pred = sample.reward if sample.next_state is not None: opt_pred += t.max(self.target_net.pred&hellip;
1
2021-07-12T18:32:05.117Z
https://discuss.pytorch.org/t/why-is-my-dqn-deep-q-network-not-learning/126336/16
No wait that’s totally messed up. Why do you even clone the prediction for the opt prediction? pred = self.net.predict(sample.state)[sample.action] opt_pred = sample.reward if sample.next_state is not None: opt_pred += t.max(self.target_net.pred&hellip; This should help -&gt; <a href="https://discuss.pytorch.org/t/...
1,610
{'text': ['No wait that’s totally messed up. Why do you even clone the prediction for the opt prediction?\n\npred = self.net.predict(sample.state)[sample.action]\n\nopt_pred = sample.reward\n\nif sample.next_state is not None:\n\nopt_pred += t.max(self.target_net.pred&hellip;'], 'answer_start': [1610]}
Libtorch for raspberry pi
Hi everyone do you have ever compile libtorch for raspberry pi 3 ?. Do you mind share it?
0
2019-12-05T09:09:12.345Z
This should help -&gt; <a href="https://discuss.pytorch.org/t/pytorch-1-3-wheels-for-raspberry-pi-python-3-7/58580" class="inline-onebox">PyTorch 1.3 wheels for Raspberry Pi (Python 3.7)</a> You’ll find the dynamic library in something like /home/pi/.local/lib/python3.7/site-packages/torch/lib, and the header files in...
0
2019-12-05T16:52:19.708Z
https://discuss.pytorch.org/t/libtorch-for-raspberry-pi/63107/2
No wait that’s totally messed up. Why do you even clone the prediction for the opt prediction? pred = self.net.predict(sample.state)[sample.action] opt_pred = sample.reward if sample.next_state is not None: opt_pred += t.max(self.target_net.pred&hellip; This should help -&gt; <a href="https://discuss.pytorch.org/t/...
1,063
{'text': ['This should help -&gt; <a href="https://discuss.pytorch.org/t/pytorch-1-3-wheels-for-raspberry-pi-python-3-7/58580" class="inline-onebox">PyTorch 1.3 wheels for Raspberry Pi (Python 3.7)</a>\n\nYou’ll find the dynamic library in something like /home/pi/.local/lib/python3.7/site-packages/torch/lib, and the he...
CUDA RuntimeError: CUDA error: an illegal memory access was encountered
Hi, I am using colab, pytorch version 1.6.0+cu101. When I try to allocate a model or a parameter to GPU I get the error below. I have tried to reproduce several tips/corrections that were listed in the forum but no one has worked so far…any ideas? Thanks! device = torch.device(&#39;cuda&#39; if torch.cuda&hellip;
0
2020-11-02T06:02:17.355Z
Thanks for the rest of the code. While running it I get a proper error message: RuntimeError: Tensor for argument #2 &#39;mat1&#39; is on CPU, but expected it to be on GPU (while checking arguments for addmm) which points to a device mismatch in Generator. After checking the code it seems that z is crea&hellip;
1
2020-11-02T09:50:33.028Z
https://discuss.pytorch.org/t/cuda-runtimeerror-cuda-error-an-illegal-memory-access-was-encountered/101318/8
No wait that’s totally messed up. Why do you even clone the prediction for the opt prediction? pred = self.net.predict(sample.state)[sample.action] opt_pred = sample.reward if sample.next_state is not None: opt_pred += t.max(self.target_net.pred&hellip; This should help -&gt; <a href="https://discuss.pytorch.org/t/...
689
{'text': ['Thanks for the rest of the code.\n\nWhile running it I get a proper error message:\n\nRuntimeError: Tensor for argument #2 &#39;mat1&#39; is on CPU, but expected it to be on GPU (while checking arguments for addmm)\n\nwhich points to a device mismatch in Generator.\n\nAfter checking the code it seems that z ...
How to visualize model in Pytorch
Just like we have plot_model in keras, is there some way in pytorch by which model can be visualized? I tried make_dot using: batch = next(iter(dataloader_train)) yhat = model(batch.text) # Give dummy batch to forward(). from torchviz import make_dot make_dot(yhat, params=dict(list(model.named_p&hellip;
0
2021-03-26T14:59:04.982Z
Not a problem <a class="mention" href="/u/hs99">@hs99</a>! I’d suggest reading the tutorial first <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html" class="inline-onebox" rel="noopener nofollow ugc">Saving and Loading Models — PyTorch Tutorials 1.8.1+cu102 documentation</a> and if there are sti...
0
2021-03-26T17:23:54.845Z
https://discuss.pytorch.org/t/how-to-visualize-model-in-pytorch/116091/17
Not a problem <a class="mention" href="/u/hs99">@hs99</a>! I’d suggest reading the tutorial first <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html" class="inline-onebox" rel="noopener nofollow ugc">Saving and Loading Models — PyTorch Tutorials 1.8.1+cu102 documentation</a> and if there are sti...
2,010
{'text': ['Not a problem <a class="mention" href="/u/hs99">@hs99</a>! I’d suggest reading the tutorial first <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html" class="inline-onebox" rel="noopener nofollow ugc">Saving and Loading Models — PyTorch Tutorials 1.8.1+cu102 documentation</a> and if th...
Post-Training Quantization to Custom Bitwidth
Hi, I need to do post-training quantization of a ResNet-18 model to custom bitwidth. I would like to be able to post-training quantize to 7, 6, 5, 4, 3, and 2 bits both weights and activations so that I can evaluate how different models (pre-trained with different losses) can withstand aggressive qu&hellip;
0
2022-03-09T10:54:03.680Z
A more or less ‘baked in’ version of this is quantization aware training where the quantization library simulates the quantized operator using fake quants. This is generally used for training but would seem to work for your purposes. See Quantization Aware Training section here: <a href="https://pytorch.org/docs/maste...
2
2022-03-14T17:57:08.554Z
https://discuss.pytorch.org/t/post-training-quantization-to-custom-bitwidth/145952/6
Not a problem <a class="mention" href="/u/hs99">@hs99</a>! I’d suggest reading the tutorial first <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html" class="inline-onebox" rel="noopener nofollow ugc">Saving and Loading Models — PyTorch Tutorials 1.8.1+cu102 documentation</a> and if there are sti...
1,357
{'text': ['A more or less ‘baked in’ version of this is quantization aware training where the quantization library simulates the quantized operator using fake quants. This is generally used for training but would seem to work for your purposes.\n\nSee Quantization Aware Training section here: <a href="https://pytorch.o...
Inception_v3 is not working very well
Hey, I have implemented ResNet and Densenet in PyTorch. I am now using Inception V3. But when I was first using it throws me an error, that I solved by changing the - transform_train = transforms.Compose([transforms.RandomHorizontalFlip(), transforms.RandomResiz&hellip;
0
2019-02-26T13:33:53.289Z
Might be unrelated to the first issue. Could you set num_workers=0 and run the code again to get a proper error message?
0
2019-02-26T13:58:10.132Z
https://discuss.pytorch.org/t/inception-v3-is-not-working-very-well/38296/6
Not a problem <a class="mention" href="/u/hs99">@hs99</a>! I’d suggest reading the tutorial first <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html" class="inline-onebox" rel="noopener nofollow ugc">Saving and Loading Models — PyTorch Tutorials 1.8.1+cu102 documentation</a> and if there are sti...
808
{'text': ['Might be unrelated to the first issue.\n\nCould you set num_workers=0 and run the code again to get a proper error message?'], 'answer_start': [808]}
Please Help me solve this error Process finished with exit code -1073741819 (0xC0000005)
My environment is python3.6.9 windows10 torch1.2.0. cuda9.2 My problem is when I running FC network the code works well in both CPU and GPU. But when it comes to CNN, I can only train it on CPU. It raises an error when I try to train it on GPU. like that: Process finished with exit code -10737418&hellip;
0
2019-10-11T05:21:29.854Z
In the end, I switch my python to 3.5. And it works. Amazing… but my whole week is done. :joy:
0
2019-10-23T14:19:48.832Z
https://discuss.pytorch.org/t/please-help-me-solve-this-error-process-finished-with-exit-code-1073741819-0xc0000005/57932/9
In the end, I switch my python to 3.5. And it works. Amazing… but my whole week is done. :joy: Yes, pydicom returns a int16 array-type. If you want to view it as a greyscale image in rgb format, then you need to know what window level you’re using or need, and adjust appropriately before saving or displaying. First y...
1,858
{'text': ['In the end, I switch my python to 3.5. And it works. Amazing… but my whole week is done. :joy:'], 'answer_start': [1858]}
Normalizing 16-bit Medical Images
Hi there, I just started using PyTorch and want to build a patch classifier for breast mammography. Thing is, my image patches are in range from [0, 65535] and I just found out that ToTensor() operation is treating my images as they are 8-bit. Here is the code I am currently using to load my datase&hellip;
0
2020-10-27T23:36:25.514Z
Yes, pydicom returns a int16 array-type. If you want to view it as a greyscale image in rgb format, then you need to know what window level you’re using or need, and adjust appropriately before saving or displaying. First you have to extract parameters slope and interception from the DICOM file an&hellip;
1
2020-10-29T20:06:32.016Z
https://discuss.pytorch.org/t/normalizing-16-bit-medical-images/100833/4
In the end, I switch my python to 3.5. And it works. Amazing… but my whole week is done. :joy: Yes, pydicom returns a int16 array-type. If you want to view it as a greyscale image in rgb format, then you need to know what window level you’re using or need, and adjust appropriately before saving or displaying. First y...
1,024
{'text': ['Yes, pydicom returns a int16 array-type.\n\nIf you want to view it as a greyscale image in rgb format, then you need to know what window level you’re using or need, and adjust appropriately before saving or displaying.\n\nFirst you have to extract parameters slope and interception from the DICOM file an&hell...
Expected 4-dimensional input for 4-dimensional weight [64, 3, 3, 3], but got 3-dimensional input of size [3, 112, 112] instead
Hi when i try to run my train code this error pop up and im not sure how to fix it this is my code ########################################################################################################## #try to train if __name__ == &#39;__main__&#39;: #set_trace() args = edict({ &#39;operat&hellip;
0
2020-08-07T10:22:56.206Z
I had to do a lot of changes to make it start training… for i, data in enumerate(dataloader): inps, labs = data inps, labs = inps.cuda(args[&#39;device&#39;]), labs.cuda(args[&#39;device&#39;]) inps = Variable(inps).cuda(args[&#39;device&#39;]) labs = Variable(labs).cuda(arg&hellip;
0
2020-08-10T15:23:54.659Z
https://discuss.pytorch.org/t/expected-4-dimensional-input-for-4-dimensional-weight-64-3-3-3-but-got-3-dimensional-input-of-size-3-112-112-instead/91945/12
In the end, I switch my python to 3.5. And it works. Amazing… but my whole week is done. :joy: Yes, pydicom returns a int16 array-type. If you want to view it as a greyscale image in rgb format, then you need to know what window level you’re using or need, and adjust appropriately before saving or displaying. First y...
404
{'text': ['I had to do a lot of changes to make it start training…\n\nfor i, data in enumerate(dataloader):\n\ninps, labs = data\n\ninps, labs = inps.cuda(args[&#39;device&#39;]), labs.cuda(args[&#39;device&#39;])\n\ninps = Variable(inps).cuda(args[&#39;device&#39;])\n\nlabs = Variable(labs).cuda(arg&hellip;'], 'answer...
Shuffle a tensor a long a certain dimension
Dear all, I have a 4D tensor [batch_size, temporal_dimension, data[0], data[1]], the 3d tensor of [temporal_dimension, data[0], data[1]] is actually my input data to the network. I would shuffle the tensor along the second dimension, which is my temporal dimension to check if the network is learnin&hellip;
0
2021-08-19T19:52:19.863Z
In that case the indexing with idx created by randperm should work and you could skip the last part. This would shuffle the x tensor in dim1.
0
2021-08-20T08:07:00.227Z
https://discuss.pytorch.org/t/shuffle-a-tensor-a-long-a-certain-dimension/129798/4
In that case the indexing with idx created by randperm should work and you could skip the last part. This would shuffle the x tensor in dim1. Taking a second look, I still don’t understand why the (current code) has a best_model_wts = copy.deepcopy(model.state_dict()) at the beginning of the training function with mode...
1,384
{'text': ['In that case the indexing with idx created by randperm should work and you could skip the last part. This would shuffle the x tensor in dim1.'], 'answer_start': [1384]}
Model.eval() accuracy is low
Hello, I am using a pretrained resnet50 to classify some images. My problem is that when I had, in the same training function, both model.train and model.eval, the accuracies where fine (about 65% train and validation accuracies) but when I tried to separate them and use different functions for ea&hellip;
0
2021-06-09T19:32:17.940Z
Taking a second look, I still don’t understand why the (current code) has a best_model_wts = copy.deepcopy(model.state_dict()) at the beginning of the training function with model.load_state_dict(best_model_wts) at the end when the best_model_wts is never updated. This means that the training will h&hellip;
1
2021-06-18T18:59:12.068Z
https://discuss.pytorch.org/t/model-eval-accuracy-is-low/123716/38
In that case the indexing with idx created by randperm should work and you could skip the last part. This would shuffle the x tensor in dim1. Taking a second look, I still don’t understand why the (current code) has a best_model_wts = copy.deepcopy(model.state_dict()) at the beginning of the training function with mode...
834
{'text': ['Taking a second look, I still don’t understand why the (current code) has a best_model_wts = copy.deepcopy(model.state_dict()) at the beginning of the training function with model.load_state_dict(best_model_wts) at the end when the best_model_wts is never updated. This means that the training will h&hellip;'...
Is it mandatory to add modules to ModuleList to access its parameters
I read some posts about ModuleList and all of them said that adding modules to ModuleList gives access to parameters of the Neural Network but in “Training a classifier” example of 60 mins pytorch tutorial the modules are not added to any ModuleList and still the parameters could be accessed using o&hellip;
0
2020-05-17T09:44:07.064Z
Yes, that’s the difference between a Python list and an nn.ModuleList. As explained in the linked topics, the parameters wrapped in a plain list won’t be registered, while the parameters from all modules inside an nn.ModuleList will be registered. So if you want to use a list-like container, then &hellip;
1
2020-05-18T08:42:24.181Z
https://discuss.pytorch.org/t/is-it-mandatory-to-add-modules-to-modulelist-to-access-its-parameters/81622/5
In that case the indexing with idx created by randperm should work and you could skip the last part. This would shuffle the x tensor in dim1. Taking a second look, I still don’t understand why the (current code) has a best_model_wts = copy.deepcopy(model.state_dict()) at the beginning of the training function with mode...
451
{'text': ['Yes, that’s the difference between a Python list and an nn.ModuleList.\n\nAs explained in the linked topics, the parameters wrapped in a plain list won’t be registered, while the parameters from all modules inside an nn.ModuleList will be registered.\n\nSo if you want to use a list-like container, then &hell...
Applying custom mask on kernel for CNN
Is this the correct way to specify custom manipulation of the weights of a convolution layer? class MaskedConv3d(nn.Module): def __init__(self, channels, filter_mask): super().__init__() self.kernel_size = tuple(filter_mask.shape) self.filter_mask = nn.Parameter(fi&hellip;
0
2020-06-27T10:34:00.246Z
No, you shouldn’t use the .data attribute, as it might yield silent errors and could break your code in various ways. The error message points to a mismatch between a tensor and the expected nn.Parameter. Try to wrap the new weight into a parameter via: with torch.no_grad(): self.conv.weight &hellip;
1
2020-06-28T09:58:12.539Z
https://discuss.pytorch.org/t/applying-custom-mask-on-kernel-for-cnn/87099/2
No, you shouldn’t use the .data attribute, as it might yield silent errors and could break your code in various ways. The error message points to a mismatch between a tensor and the expected nn.Parameter. Try to wrap the new weight into a parameter via: with torch.no_grad(): self.conv.weight &hellip; A naive approa...
1,518
{'text': ['No, you shouldn’t use the .data attribute, as it might yield silent errors and could break your code in various ways.\n\nThe error message points to a mismatch between a tensor and the expected nn.Parameter.\n\nTry to wrap the new weight into a parameter via:\n\nwith torch.no_grad():\n\nself.conv.weight &hel...
How to build a network consisting of several parallelly connected subnetworks
Hi, all, Recently, I want to use PyTorch to build a slightly special network with the following structure: <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/2X/c/c7a32d74dbf9dd13c0011349d0bbc4d9088cea0f.png" data-download-href="https://discuss.pytorch.org/uploads/default/c7a32d74dbf9dd13c...
1
2018-03-19T16:18:00.196Z
A naive approach would indeed be to construct m using nn.ModuleList() and a for loop. But I think we parallelise the whole lot. The following idea should work, but I haven’t checked all the details. The input x is shared by all subnetworks, so a single Linear layer of size m*100 followed by separa&hellip;
2
2018-03-19T21:44:33.176Z
https://discuss.pytorch.org/t/how-to-build-a-network-consisting-of-several-parallelly-connected-subnetworks/15161/3
No, you shouldn’t use the .data attribute, as it might yield silent errors and could break your code in various ways. The error message points to a mismatch between a tensor and the expected nn.Parameter. Try to wrap the new weight into a parameter via: with torch.no_grad(): self.conv.weight &hellip; A naive approa...
1,065
{'text': ['A naive approach would indeed be to construct m using nn.ModuleList() and a for loop.\n\nBut I think we parallelise the whole lot. The following idea should work, but I haven’t checked all the details.\n\nThe input x is shared by all subnetworks, so a single Linear layer of size m*100 followed by separa&hell...
Torch dataloader num_workers>0 not spawning workers
I’m currently working on porting code from Keras to PyTorch. I’m working with many GPUs and CPUs so it’s important to have batch generation happening in parallel. My problem is that I’m trying to use the num_workers argument on the DataLoader class, but am meeting with errors. Current relevant toy&hellip;
0
2020-12-14T18:35:41.928Z
Based on the first post I assume that your code runs fine with num_workers=0 for the full epoch and doesn’t yield any error? If that’s the case, could you check if you have enough shared memory available?
0
2020-12-15T06:45:04.970Z
https://discuss.pytorch.org/t/torch-dataloader-num-workers-0-not-spawning-workers/106114/4
No, you shouldn’t use the .data attribute, as it might yield silent errors and could break your code in various ways. The error message points to a mismatch between a tensor and the expected nn.Parameter. Try to wrap the new weight into a parameter via: with torch.no_grad(): self.conv.weight &hellip; A naive approa...
615
{'text': ['Based on the first post I assume that your code runs fine with num_workers=0 for the full epoch and doesn’t yield any error?\n\nIf that’s the case, could you check if you have enough shared memory available?'], 'answer_start': [615]}
ERROR LNK2019 unresolved external symbol ""float __cdecl pow(float,int)" in function ""void __cdecl test_atomic_mul<float>(void)"
Hi everyone! I have been trying to install Pytorch for over a week now, and I can not get it to work. After approximately 8 hours, the build always stops with: Making of project &quot;C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\caffe2\xla_tensor_test.vcxproj&quot; is finished (Standardziele). Maki&hellip;
0
2021-05-15T11:07:15.013Z
Sorry for the late reply. It’s an intermittent one. Just retry the build a few times.
1
2021-06-19T05:02:34.620Z
https://discuss.pytorch.org/t/error-lnk2019-unresolved-external-symbol-float-cdecl-pow-float-int-in-function-void-cdecl-test-atomic-mul-float-void/121318/33
Sorry for the late reply. It’s an intermittent one. Just retry the build a few times. torch.cat will return a tensor, so it seems you haven’t used it to create all_classes, have you? Could you post an executable code snippet showing your use case and explain what results are expected? Hi Py! [image] pytorcher: my cu...
1,640
{'text': ['Sorry for the late reply. It’s an intermittent one. Just retry the build a few times.'], 'answer_start': [1640]}
Angular Features
Hi, Just wondering if anyone has any idea about finding the angles between centers of classes and their corresponding features. I want to implement the model from the CVPR-2020 paper &quot; Deep Representation Learning on Long-tailed Data_ A Learnable Embedding Augmentation Perspective&quot; Any help would b&hellip;
0
2020-10-13T02:45:30.900Z
torch.cat will return a tensor, so it seems you haven’t used it to create all_classes, have you? Could you post an executable code snippet showing your use case and explain what results are expected?
1
2020-12-14T10:20:20.517Z
https://discuss.pytorch.org/t/angular-features/99144/43
Sorry for the late reply. It’s an intermittent one. Just retry the build a few times. torch.cat will return a tensor, so it seems you haven’t used it to create all_classes, have you? Could you post an executable code snippet showing your use case and explain what results are expected? Hi Py! [image] pytorcher: my cu...
906
{'text': ['torch.cat will return a tensor, so it seems you haven’t used it to create all_classes, have you?\n\nCould you post an executable code snippet showing your use case and explain what results are expected?'], 'answer_start': [906]}
How to debug with floating point differences
I am trying to convert code from an old pytorch version on an old computer to a new one. I have it very close, but it is still not getting quite the same results. Im having trouble determining where actual changes are happening and where it is just tiny floating point differences. I already have &hellip;
0
2020-05-21T23:37:49.130Z
Hi Py! [image] pytorcher: my custom functions were using .data in 0.3 and 1.3 versions. My conclusion is that your use of .data() is the cause of “does not work at all in 1.3.1.” Note, what you show below does not replicate the &quot;does not work at all &quot; problem – it replicates the “agrees &hellip;
1
2020-05-26T14:15:11.986Z
https://discuss.pytorch.org/t/how-to-debug-with-floating-point-differences/82397/12
Sorry for the late reply. It’s an intermittent one. Just retry the build a few times. torch.cat will return a tensor, so it seems you haven’t used it to create all_classes, have you? Could you post an executable code snippet showing your use case and explain what results are expected? Hi Py! [image] pytorcher: my cu...
287
{'text': ['Hi Py!\n\n[image] pytorcher:\n\nmy custom functions were using .data in 0.3 and 1.3 versions.\n\nMy conclusion is that your use of .data() is the cause of “does\n\nnot work at all in 1.3.1.”\n\nNote, what you show below does not replicate the &quot;does not work at\n\nall &quot; problem – it replicates the “...
CTCLoss predicts blanks
Hi, I am doing seq2seq where the input is a sequence of images and the output is a text (sequence of token words). My model is a pretrained CNN layer + Self-attention encoder (or LSTM) + Linear layer and apply the logSoftmax to get the log probs of the classes + blank label (batch, Seq, classes+1) &hellip;
0
2020-01-17T04:06:29.561Z
[image] IliasPap: use reduction=‘mean’ and zero_infinity=“True” hey sorry for the late response and thank you for your reply. I tried using use reduction=‘mean’ and zero_infinity=“True” but they didn’t work. It seems that by doing this : loss = ctc_loss(output, y.cpu(), x_lengths.cpu(), y_l&hellip;
0
2020-02-17T16:00:19.641Z
https://discuss.pytorch.org/t/ctcloss-predicts-blanks/66928/3
[image] IliasPap: use reduction=‘mean’ and zero_infinity=“True” hey sorry for the late response and thank you for your reply. I tried using use reduction=‘mean’ and zero_infinity=“True” but they didn’t work. It seems that by doing this : loss = ctc_loss(output, y.cpu(), x_lengths.cpu(), y_l&hellip; So the problem i...
1,198
{'text': ['[image] IliasPap:\n\nuse reduction=‘mean’ and zero_infinity=“True”\n\nhey sorry for the late response and thank you for your reply.\n\nI tried using use reduction=‘mean’ and zero_infinity=“True” but they didn’t work.\n\nIt seems that by doing this : loss = ctc_loss(output, y.cpu(), x_lengths.cpu(), y_l&helli...
P.data.grad is None after backwards
Hey, I’m trying to implement the optimization algorithems by myself and to compare them . However, not sure why, but the backwards flow doesnt update the gradients and they left as None values. My optimizer : class MyOptimizer: def __init__(self, parameters,lr=0.001, momentum=0.9): self.mo&hellip;
0
2020-01-07T21:45:08.552Z
So the problem is that layer_dict[&#39;params&#39;] is not a list, but just a Tensor. So when you do for p in layer_data[&#39;params&#39;]:, you actually slice the Tensor along the 0th dimension. Since this returns new Tensors, the .grad field is not set for them. You can either do layer_dict[&#39;params&#39;]=[layer...
0
2020-01-07T22:25:28.612Z
https://discuss.pytorch.org/t/p-data-grad-is-none-after-backwards/66044/8
[image] IliasPap: use reduction=‘mean’ and zero_infinity=“True” hey sorry for the late response and thank you for your reply. I tried using use reduction=‘mean’ and zero_infinity=“True” but they didn’t work. It seems that by doing this : loss = ctc_loss(output, y.cpu(), x_lengths.cpu(), y_l&hellip; So the problem i...
903
{'text': ['So the problem is that layer_dict[&#39;params&#39;] is not a list, but just a Tensor.\n\nSo when you do for p in layer_data[&#39;params&#39;]:, you actually slice the Tensor along the 0th dimension. Since this returns new Tensors, the .grad field is not set for them.\n\nYou can either do layer_dict[&#39;para...
Neural Network only gives outputs of 0
Hi there! I am trying to train a neural network with a tensor of 1040 float inputs and have a singular float output. No matter what I do the predicted value comes out as 0 I think the problem I am having is with teaching the network. My Net class is as below. The interneuron_count is 64. class N&hellip;
0
2020-04-17T22:30:46.826Z
The error is on my end, I was running the NN as a classification network as opposed to a regression style. I followed an example for predicting house prices on this <a href="https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/march/test-run-neural-regression-using-pytorch" rel="nofollow noopener">link</a> and h...
0
2020-04-19T20:18:37.748Z
https://discuss.pytorch.org/t/neural-network-only-gives-outputs-of-0/77250/10
[image] IliasPap: use reduction=‘mean’ and zero_infinity=“True” hey sorry for the late response and thank you for your reply. I tried using use reduction=‘mean’ and zero_infinity=“True” but they didn’t work. It seems that by doing this : loss = ctc_loss(output, y.cpu(), x_lengths.cpu(), y_l&hellip; So the problem i...
637
{'text': ['The error is on my end, I was running the NN as a classification network as opposed to a regression style. I followed an example for predicting house prices on this <a href="https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/march/test-run-neural-regression-using-pytorch" rel="nofollow noopener">lin...
Gradient cannot be computed, help!
I have the following code. It gives me the following error one of the variables needed for gradient computation has been modified by an inplace operation lam = 0 # lambda c = 0 # penalty mu = 0 # other parameters # outer loop while outer_step &lt; self.max_outer_iter: inner_step = 0 &hellip;
0
2020-11-02T18:24:52.598Z
Hi, I think I have found the problem. After I use the backward, I use the network’s forward to get some other values. [image] Lening_Li: loss.backward() # check if the weights are updated a = list(self.value.model.parameters())[0].clone() optimiz&hellip;
0
2020-11-04T20:02:26.004Z
https://discuss.pytorch.org/t/gradient-cannot-be-computed-help/101402/12
Hi, I think I have found the problem. After I use the backward, I use the network’s forward to get some other values. [image] Lening_Li: loss.backward() # check if the weights are updated a = list(self.value.model.parameters())[0].clone() optimiz&hellip; Thanks for the update. I came up with another approach, but...
2,070
{'text': ['Hi, I think I have found the problem. After I use the backward, I use the network’s forward to get some other values.\n\n[image] Lening_Li:\n\nloss.backward()\n\n# check if the weights are updated\n\na = list(self.value.model.parameters())[0].clone()\n\noptimiz&hellip;'], 'answer_start': [2070]}
Compare each element with each other element
What is the fastest way to compare all the elements of a matrix, with all other elements of the matrix? for example, x = torch.randn(5, 5) y = x.unfold(0, 3, 1).unfold(1, 3, 1) now if I want to compare every element in these 9 3x3 blocks, with every other 8 elements, without using for loop, then &hellip;
0
2020-05-05T08:46:51.214Z
Thanks for the update. I came up with another approach, but you will only see a slightly performance benefit for larger sizes. Your code seems to be alright for this workload: def fun1(a, b): c = torch.cat((a, b), dim=0) idx = c.nonzero() res = torch.zeros(c.size()[1:]) res[idx[:,&hellip;
0
2020-05-16T08:03:38.842Z
https://discuss.pytorch.org/t/compare-each-element-with-each-other-element/79801/11
Hi, I think I have found the problem. After I use the backward, I use the network’s forward to get some other values. [image] Lening_Li: loss.backward() # check if the weights are updated a = list(self.value.model.parameters())[0].clone() optimiz&hellip; Thanks for the update. I came up with another approach, but...
1,295
{'text': ['Thanks for the update.\n\nI came up with another approach, but you will only see a slightly performance benefit for larger sizes.\n\nYour code seems to be alright for this workload:\n\ndef fun1(a, b):\n\nc = torch.cat((a, b), dim=0)\n\nidx = c.nonzero()\n\nres = torch.zeros(c.size()[1:])\n\nres[idx[:,&hellip...
WeightedRandomSampler sampler not working properly
I am using the Weighted random sampler function of PyTorch to sample my classes equally, But while checking the samples of each class in a batch, it seems to sample randomly. here is a snippet of my code. def cal_sample_weight(files): print(&quot;file length &quot;,len(files)) labels = [int(f[-5])-1 for f&hellip;
0
2020-02-08T15:14:28.486Z
Hey, I figured this out. Seems that even though I am zipping my weights with the samples while shuffling at the epoch end, the weights with the sampler don’t get shuffled. The weighted random sampler just allocated the probabilities to all the samples once and has no effect of my custom shuffling. M&hellip;
0
2020-02-11T18:50:08.430Z
https://discuss.pytorch.org/t/weightedrandomsampler-sampler-not-working-properly/69063/5
Hi, I think I have found the problem. After I use the backward, I use the network’s forward to get some other values. [image] Lening_Li: loss.backward() # check if the weights are updated a = list(self.value.model.parameters())[0].clone() optimiz&hellip; Thanks for the update. I came up with another approach, but...
557
{'text': ['Hey, I figured this out. Seems that even though I am zipping my weights with the samples while shuffling at the epoch end, the weights with the sampler don’t get shuffled. The weighted random sampler just allocated the probabilities to all the samples once and has no effect of my custom shuffling.\n\nM&helli...
RuntimeError: Expected isFloatingType(grads[i].scalar_type()) to be true, but got false. (Could this error message be improved?
I am getting this weird error when i am using the following funcs in my training loop as soon as it hits loss.backward() def pos_weight(pred_tensor, pos_tensor, neg_weight=1, pos_weight=1): # neg_weight for when pred position &lt; target position # pos_weight for when pred position &gt; target po&hellip;
0
2020-05-01T17:43:52.233Z
The problem is that pos_weight is not actually differentiable because the argmax op is not differentiable. But due to a bug on our side, this is detected too late and here is a minimal repro: import torch from torch import nn t = torch.rand(10, requires_grad=True) bad = torch.argmax(t) res = ba&hellip;
1
2020-05-01T18:41:09.590Z
https://discuss.pytorch.org/t/runtimeerror-expected-isfloatingtype-grads-i-scalar-type-to-be-true-but-got-false-could-this-error-message-be-improved/79298/13
The problem is that pos_weight is not actually differentiable because the argmax op is not differentiable. But due to a bug on our side, this is detected too late and here is a minimal repro: import torch from torch import nn t = torch.rand(10, requires_grad=True) bad = torch.argmax(t) res = ba&hellip; [image] D...
1,732
{'text': ['The problem is that pos_weight is not actually differentiable because the argmax op is not differentiable.\n\nBut due to a bug on our side, this is detected too late and here is a minimal repro:\n\nimport torch\n\nfrom torch import nn\n\nt = torch.rand(10, requires_grad=True)\n\nbad = torch.argmax(t)\n\nres...
ResNet18 Not working on 2 GPUS
I need some help. I bit new to using higher batches sizes on the GPU. my data set s so big 500K images so I need to use bigger batchsize and larger net. But I was not successful until now to make this work. train_loader = DataLoader(dset,batch_size=16,shuffle=True,num_workers=4)# pin_memory=True # &hellip;
0
2018-11-20T14:31:05.004Z
[image] Diego: ps -elf | grep python Thank i think what u said is correct and it’s working now.Basically what i did is i killed almost all the jupyter notebooks, python files and almost all. It’s working now. Thank you <a class="mention" href="/u/diego">@Diego</a> , <a class="mention" href="/u/juanfmontesinos">@Ju...
0
2018-11-21T00:43:40.643Z
https://discuss.pytorch.org/t/resnet18-not-working-on-2-gpus/30084/15
The problem is that pos_weight is not actually differentiable because the argmax op is not differentiable. But due to a bug on our side, this is detected too late and here is a minimal repro: import torch from torch import nn t = torch.rand(10, requires_grad=True) bad = torch.argmax(t) res = ba&hellip; [image] D...
1,177
{'text': ['[image] Diego:\n\nps -elf | grep python\n\nThank i think what u said is correct and it’s working now.Basically what i did is i killed almost all the jupyter notebooks, python files and almost all.\n\nIt’s working now.\n\nThank you <a class="mention" href="/u/diego">@Diego</a> , <a class="mention" href="/u/j...
[Please Help!] How can copy the gradient from Net A to Net B
If I have two networks with the same architecture, say A and B. For security reason, Net B cannot get access to the training data. So I need to train A and update B with A’s gradient. Note we cannot always copy A to B because A will be updated when training.
0
2019-03-29T21:17:35.419Z
I think you should also clone the gradients of A&amp;B. Can you change like below. Without clone data is not explicitly copied to destination I guess. for net1,net2 in zip(A.named_parameters(),B.named_parameters()): net2[1].data.grad = net1[1].data.grad.clone
0
2019-03-30T15:57:37.207Z
https://discuss.pytorch.org/t/please-help-how-can-copy-the-gradient-from-net-a-to-net-b/41226/6
The problem is that pos_weight is not actually differentiable because the argmax op is not differentiable. But due to a bug on our side, this is detected too late and here is a minimal repro: import torch from torch import nn t = torch.rand(10, requires_grad=True) bad = torch.argmax(t) res = ba&hellip; [image] D...
671
{'text': ['I think you should also clone the gradients of A&amp;B. Can you change like below. Without clone data is not explicitly copied to destination I guess.\n\nfor net1,net2 in zip(A.named_parameters(),B.named_parameters()):\n\nnet2[1].data.grad = net1[1].data.grad.clone'], 'answer_start': [671]}
Interpreting gradcheck errors
Hi, sorry for the basic question. Gradcheck seems to give 2 separate outputs on a failure. Numerical, and Analytical. What is the difference between the two? And how would I use this information to find a problem in my model? Example output from a failed gradcheck… RuntimeError: for output no.&hellip;
0
2018-04-11T01:56:10.167Z
They are numerical Jacobian estimated with point perturbations, and analytical Jacobian computed from autograd.
0
2018-04-11T02:13:56.887Z
https://discuss.pytorch.org/t/interpreting-gradcheck-errors/16239/2
They are numerical Jacobian estimated with point perturbations, and analytical Jacobian computed from autograd. Thanks for the data! I loaded it and executed the provided code snippet, however I’m getting all finite outputs (even with executing the training loop several times). Which PyTorch version are you currently...
1,864
{'text': ['They are numerical Jacobian estimated with point perturbations, and analytical Jacobian computed from autograd.'], 'answer_start': [1864]}
Function 'PowBackward1' returned nan values in its 1th output
I am attempting to implement the following operation from this <a href="http://ceur-ws.org/Vol-2125/paper_181.pdf" rel="nofollow noopener">paper</a>: <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/7/470feafc027b26575afd811158c63000f477a807.png" data-download-href="https://discuss.p...
0
2020-06-27T20:23:29.524Z
Thanks for the data! I loaded it and executed the provided code snippet, however I’m getting all finite outputs (even with executing the training loop several times). Which PyTorch version are you currently using? I tried to reproduce it with 1.6.0.dev20200611 and it’s working fine.
0
2020-06-29T08:53:38.799Z
https://discuss.pytorch.org/t/function-powbackward1-returned-nan-values-in-its-1th-output/87138/7
They are numerical Jacobian estimated with point perturbations, and analytical Jacobian computed from autograd. Thanks for the data! I loaded it and executed the provided code snippet, however I’m getting all finite outputs (even with executing the training loop several times). Which PyTorch version are you currently...
1,044
{'text': ['Thanks for the data!\n\nI loaded it and executed the provided code snippet, however I’m getting all finite outputs (even with executing the training loop several times).\n\nWhich PyTorch version are you currently using?\n\nI tried to reproduce it with 1.6.0.dev20200611 and it’s working fine.'], 'answer_start...
TypeError: forward() got an unexpected keyword argument 'return_dict' BERT CLASSIFICATION HUGGINFACE with ray tuning
I’m stacked with this model, every day errors came to my code! Anyway I’m trying to implement a Bert Classifier to discriminate between 2 sequences classes (BINARY CLASSIFICATION), with AX hyperparameters tuning. This is all my code implemented anticipated by a sample of my datasets ( I have 3 csv,&hellip;
0
2022-03-09T19:05:23.358Z
I think you are hitting <a href="https://discuss.pytorch.org/t/bcewithlogitsloss-with-bert-valueerror-target-size-torch-size-68-1-1-must-be-the-same-as-input-size/146037/4">this issue</a> again. Based on your last statement in the linked topic, I guess your output has the shape [batch size=2, seq_len=512, nb_classes=1...
1
2022-03-15T17:54:31.201Z
https://discuss.pytorch.org/t/typeerror-forward-got-an-unexpected-keyword-argument-return-dict-bert-classification-hugginface-with-ray-tuning/145984/10
They are numerical Jacobian estimated with point perturbations, and analytical Jacobian computed from autograd. Thanks for the data! I loaded it and executed the provided code snippet, however I’m getting all finite outputs (even with executing the training loop several times). Which PyTorch version are you currently...
399
{'text': ['I think you are hitting <a href="https://discuss.pytorch.org/t/bcewithlogitsloss-with-bert-valueerror-target-size-torch-size-68-1-1-must-be-the-same-as-input-size/146037/4">this issue</a> again.\n\nBased on your last statement in the linked topic, I guess your output has the shape [batch size=2, seq_len=512,...
How to save multi-class segmentation prediction as image?
Hi, My multi-class UNET model output is of the following shape: [1, 6, 100, 100] which is expected because the batch size is 1, I have 6 classes, and the image size is 100x100. How can I save a prediction as an image which contains all 6 classes using torchvision.utils. save_image? The tensor in s&hellip;
0
2021-06-07T21:04:04.309Z
Nope, things are allocated on the CPU by default. You can simply add device=&#39;cuda&#39; to the torch.tensor(...) calls to fix this.
1
2021-06-08T21:02:45.158Z
https://discuss.pytorch.org/t/how-to-save-multi-class-segmentation-prediction-as-image/123536/10
Nope, things are allocated on the CPU by default. You can simply add device=&#39;cuda&#39; to the torch.tensor(...) calls to fix this. I had a look at your code and it seems your error calculation does overflow. In this method you are calculating the error: def error_criterion(outputs,labels): max_vals, max_indices ...
1,718
{'text': ['Nope, things are allocated on the CPU by default. You can simply add device=&#39;cuda&#39; to the torch.tensor(...) calls to fix this.'], 'answer_start': [1718]}
How does the Cifar10 tutorial make sure to use the test set is actually the test set if both use the same path to load both test and train?
I was looking at: trainset = torchvision.datasets.CIFAR10(root=&#39;./data&#39;, train=True, download=True, transform=transform) trainloader = torch.utils.data.DataLoader(trainset, batch_size=4, shuffle=True, num_workers=2) &hellip;
0
2018-04-12T00:32:45.180Z
I had a look at your code and it seems your error calculation does overflow. In this method you are calculating the error: def error_criterion(outputs,labels): max_vals, max_indices = torch.max(outputs,1) train_error = (max_indices != labels).sum().data[0]/max_indices.size()[0] return &hellip;
1
2018-04-13T09:08:01.831Z
https://discuss.pytorch.org/t/how-does-the-cifar10-tutorial-make-sure-to-use-the-test-set-is-actually-the-test-set-if-both-use-the-same-path-to-load-both-test-and-train/16288/11
Nope, things are allocated on the CPU by default. You can simply add device=&#39;cuda&#39; to the torch.tensor(...) calls to fix this. I had a look at your code and it seems your error calculation does overflow. In this method you are calculating the error: def error_criterion(outputs,labels): max_vals, max_indices ...
994
{'text': ['I had a look at your code and it seems your error calculation does overflow.\n\nIn this method you are calculating the error:\n\ndef error_criterion(outputs,labels):\n\nmax_vals, max_indices = torch.max(outputs,1)\n\ntrain_error = (max_indices != labels).sum().data[0]/max_indices.size()[0]\n\nreturn &hellip;...
Segmentation Network Loss issues
Hello, I’ve read quite a few relevant topics here on discuss.pytorch.org such as: <a href="https://discuss.pytorch.org/t/loss-function-for-segmentation-models/32129/3" class="inline-onebox">Loss function for segmentation models</a> <a href="https://discuss.pytorch.org/t/convert-pixel-wise-class-tensor-to-image-segme...
0
2020-03-19T19:08:38.134Z
Your logit output shape is missing the class dimension. In my code snippet I’m creating the logits as [batch_size, nb_classes, height, width] and the target es [batch_size, height, width]. If you stick to these shapes, it should work. [image] Alex_Ge: Also, would you recommend CrossEntropyLoss &hellip;
1
2020-03-20T19:56:28.127Z
https://discuss.pytorch.org/t/segmentation-network-loss-issues/73797/5
Nope, things are allocated on the CPU by default. You can simply add device=&#39;cuda&#39; to the torch.tensor(...) calls to fix this. I had a look at your code and it seems your error calculation does overflow. In this method you are calculating the error: def error_criterion(outputs,labels): max_vals, max_indices ...
435
{'text': ['Your logit output shape is missing the class dimension.\n\nIn my code snippet I’m creating the logits as [batch_size, nb_classes, height, width] and the target es [batch_size, height, width]. If you stick to these shapes, it should work.\n\n[image] Alex_Ge:\n\nAlso, would you recommend CrossEntropyLoss &hell...
Does Concatenate Datasets preserve class labels and indices
Let’s say I have 2 image folder datasets and I want to concatenate them. The first dataset has 100 images with 2 equal classes: “Dog” and “Cat” with class indices 0 and 1 The second dataset has 120 images with 3 equal classes: “Dog”, “Cat” and “Pig” with class indices 0, 1 and 2 When I concatenat&hellip;
0
2019-12-01T02:41:37.708Z
ConcatDataset will not create a mapping, but just index the passed Datasets. Each Dataset should make sure to yield the “right” labels. E.g. in your second use case, you should make sure that dataset1 only yields samples with the class labels 0 and 1 (dog and cat), while dataset2 should only yield&hellip;
1
2020-01-11T03:59:40.045Z
https://discuss.pytorch.org/t/does-concatenate-datasets-preserve-class-labels-and-indices/62611/3
ConcatDataset will not create a mapping, but just index the passed Datasets. Each Dataset should make sure to yield the “right” labels. E.g. in your second use case, you should make sure that dataset1 only yields samples with the class labels 0 and 1 (dog and cat), while dataset2 should only yield&hellip; ModuleList ...
1,482
{'text': ['ConcatDataset will not create a mapping, but just index the passed Datasets.\n\nEach Dataset should make sure to yield the “right” labels.\n\nE.g. in your second use case, you should make sure that dataset1 only yields samples with the class labels 0 and 1 (dog and cat), while dataset2 should only yield&hell...
How to use forward on modules in a ModuleList?
Hi, I have a net composed of layers in a nn::ModuleList. I didn’t succeed to apply the forward method on the modules in the list. How can I use them? Here is the code to reproduce the issue: #include &lt;torch/torch.h&gt; using namespace torch; struct LinearImpl : nn::Module { LinearImpl(int in_f&hellip;
0
2020-04-15T12:52:06.798Z
ModuleList doesn’t store the modules’ type information, and we need to convert the modules to the concrete types for forward to work. So instead of doing module-&gt;forward(x), we should do module-&gt;as&lt;Linear&gt;()(x).
1
2020-04-15T23:48:47.835Z
https://discuss.pytorch.org/t/how-to-use-forward-on-modules-in-a-modulelist/76867/5
ConcatDataset will not create a mapping, but just index the passed Datasets. Each Dataset should make sure to yield the “right” labels. E.g. in your second use case, you should make sure that dataset1 only yields samples with the class labels 0 and 1 (dog and cat), while dataset2 should only yield&hellip; ModuleList ...
1,050
{'text': ['ModuleList doesn’t store the modules’ type information, and we need to convert the modules to the concrete types for forward to work. So instead of doing module-&gt;forward(x), we should do module-&gt;as&lt;Linear&gt;()(x).'], 'answer_start': [1050]}
Activation values in ResNet
Hi! I’ve trained a ResNet model and now I’m using it on another dataset and I need access to all the activation values for each neuron for each image. How can i do that? This is the part of my code that concerns the model: def conv3x3(in_channels, out_channels, stride=1): return nn.Conv2d(in_c&hellip;
0
2021-07-29T10:21:35.539Z
You can use forward hooks as described <a href="https://discuss.pytorch.org/t/how-can-l-load-my-best-model-as-a-feature-extractor-evaluator/17254/6">here</a> to get intermediate activations.
1
2021-07-30T04:27:02.132Z
https://discuss.pytorch.org/t/activation-values-in-resnet/128029/2
ConcatDataset will not create a mapping, but just index the passed Datasets. Each Dataset should make sure to yield the “right” labels. E.g. in your second use case, you should make sure that dataset1 only yields samples with the class labels 0 and 1 (dog and cat), while dataset2 should only yield&hellip; ModuleList ...
533
{'text': ['You can use forward hooks as described <a href="https://discuss.pytorch.org/t/how-can-l-load-my-best-model-as-a-feature-extractor-evaluator/17254/6">here</a> to get intermediate activations.'], 'answer_start': [533]}
What is the meaning of @weak_module?
I saw in the code @weak_module decorator. Any explanation on what this means actually?
0
2019-02-27T13:36:56.600Z
From my understandingof the code, this is needed for torch.jit only to create a static computation graph, meaning that the function calls to/from this class will be lazily compiled and inlined
1
2019-02-27T14:58:24.792Z
https://discuss.pytorch.org/t/what-is-the-meaning-of-weak-module/38404/5
From my understandingof the code, this is needed for torch.jit only to create a static computation graph, meaning that the function calls to/from this class will be lazily compiled and inlined <a class="mention" href="/u/sixerwang">@SixerWang</a> By “saving a TorchScript model in C++”, do you mean one of the following:...
1,446
{'text': ['From my understandingof the code, this is needed for torch.jit only to create a static computation graph, meaning that the function calls to/from this class will be lazily compiled and inlined'], 'answer_start': [1446]}
How to save torchscript model using cpp?
I know detail about how to save torchscript model using python, and load it with c++ from the doc: <a href="https://pytorch.org/tutorials/advanced/cpp_export.html#step-5-getting-help-and-exploring-the-api" rel="nofollow noopener">link</a>. But how to save torchscript using cpp?I should train my model using c++, but I ...
0
2019-11-01T06:17:35.331Z
<a class="mention" href="/u/sixerwang">@SixerWang</a> By “saving a TorchScript model in C++”, do you mean one of the following: You want to embed Python/TorchScript code in your C++ code, and then save that portion of code to a TorchScript model file Answer: This is not supported right now, but it is possible to impl...
2
2019-12-10T17:10:48.008Z
https://discuss.pytorch.org/t/how-to-save-torchscript-model-using-cpp/59743/10
From my understandingof the code, this is needed for torch.jit only to create a static computation graph, meaning that the function calls to/from this class will be lazily compiled and inlined <a class="mention" href="/u/sixerwang">@SixerWang</a> By “saving a TorchScript model in C++”, do you mean one of the following:...
916
{'text': ['<a class="mention" href="/u/sixerwang">@SixerWang</a> By “saving a TorchScript model in C++”, do you mean one of the following:\n\nYou want to embed Python/TorchScript code in your C++ code, and then save that portion of code to a TorchScript model file\n\nAnswer: This is not supported right now, but it is p...
Problem in DataPrallel for more than 2 GPUs
I had a working model. It ran and was very consistent with its result regarding the number of GPUs. This means it already gave similar results when running on 1-4 GPUs (all combinations had been tested). Now a came across some weird issue, Everything works fine on single or double GPUs (done with &hellip;
0
2020-11-19T11:30:07.816Z
The error seems to come from NCCL not being able to use shared memory: NCCL WARN Call to posix_fallocate failed : No space left on device [...] NCCL WARN Error while creating shared memory segment nccl-shm-recv-ea821c4e67e70b28-0-2-0 (size 9637888) so make sure your machine has enough shared memor&hellip;
3
2020-11-22T10:50:27.850Z
https://discuss.pytorch.org/t/problem-in-dataprallel-for-more-than-2-gpus/103373/4
From my understandingof the code, this is needed for torch.jit only to create a static computation graph, meaning that the function calls to/from this class will be lazily compiled and inlined <a class="mention" href="/u/sixerwang">@SixerWang</a> By “saving a TorchScript model in C++”, do you mean one of the following:...
544
{'text': ['The error seems to come from NCCL not being able to use shared memory:\n\nNCCL WARN Call to posix_fallocate failed : No space left on device\n\n[...]\n\nNCCL WARN Error while creating shared memory segment nccl-shm-recv-ea821c4e67e70b28-0-2-0 (size 9637888)\n\nso make sure your machine has enough shared memo...
Quantization not Decreasing Model Size (Static and QAT)
Hi I am trying to quantize a text detection model based on Mobilenet (model definition <a href="https://github.com/raghavgurbaxani/Quantization_Experiments/blob/master/model.py" rel="nofollow noopener">here</a> ) After inserting the quant and dequant stub, fusing all the conv+bn+relu and conv+relu, replacing cat with...
1
2020-06-29T15:50:42.522Z
Hi Raghav, For post training quantization, we want the model to be in eval mode (see <a href="https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497/torch/quantization/fuse_modules.py#L63" rel="nofollow noopener">https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497...
1
2020-07-06T21:17:35.907Z
https://discuss.pytorch.org/t/quantization-not-decreasing-model-size-static-and-qat/87319/10
Hi Raghav, For post training quantization, we want the model to be in eval mode (see <a href="https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497/torch/quantization/fuse_modules.py#L63" rel="nofollow noopener">https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497...
1,708
{'text': ['Hi Raghav,\n\nFor post training quantization, we want the model to be in eval mode (see <a href="https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497/torch/quantization/fuse_modules.py#L63" rel="nofollow noopener">https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c...
Can not slice torchvision MNIST dataset
In Pytorch, when using torchvision MNIST dataset, we can get a digit as follow : import torchvision import torchvision.transforms as transforms from torch.utils.data import DataLoader, Dataset, TensorDataset tsfm = transforms.Compose([transforms.Resize((16, 16)), &hellip;
0
2019-01-18T10:16:22.896Z
Yeah, I’ve built torchvision from source, where these names were modified (<a href="https://github.com/pytorch/vision/blob/98ca260bc834ec94a8143e4b5cfe9516b0b951a2/torchvision/datasets/mnist.py#L57" rel="nofollow noopener">source</a>). You are right, if you need to transform the PIL.Images, my suggestion won’t work. ...
2
2019-01-19T04:57:15.319Z
https://discuss.pytorch.org/t/can-not-slice-torchvision-mnist-dataset/34999/6
Hi Raghav, For post training quantization, we want the model to be in eval mode (see <a href="https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497/torch/quantization/fuse_modules.py#L63" rel="nofollow noopener">https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497...
1,322
{'text': ['Yeah, I’ve built torchvision from source, where these names were modified (<a href="https://github.com/pytorch/vision/blob/98ca260bc834ec94a8143e4b5cfe9516b0b951a2/torchvision/datasets/mnist.py#L57" rel="nofollow noopener">source</a>).\n\nYou are right, if you need to transform the PIL.Images, my suggestion ...
Pre-Trained Model Feature Fusion
Hi, I have two different image data-set but related to a same class. I am going to use pre-trained net like alexnet for both to detect features and then, concatenate those features into a classifier (and optimize this classifier not the whole models). I would appreciate if you can help me within th&hellip;
0
2020-01-24T21:38:59.689Z
The code looks alright from what I could see. PS: it’s generally better to post code snippets directly by wrapping them in three backticks ```. :wink:
2
2020-01-30T05:46:45.633Z
https://discuss.pytorch.org/t/pre-trained-model-feature-fusion/67584/13
Hi Raghav, For post training quantization, we want the model to be in eval mode (see <a href="https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497/torch/quantization/fuse_modules.py#L63" rel="nofollow noopener">https://github.com/pytorch/pytorch/blob/530d48e93a3f04a5ec63a1b789c19a5f775bf497...
929
{'text': ['The code looks alright from what I could see.\n\nPS: it’s generally better to post code snippets directly by wrapping them in three backticks ```. :wink:'], 'answer_start': [929]}
CMake error and fatal error LNK1181 building from source on Windows 10
I’m getting the following error while compiling PyTorch from source: [1818/2610] Linking CXX shared library bin\caffe2.dll FAILED: bin/caffe2.dll lib/caffe2.lib cmd.exe /C &quot;cd . &amp;&amp; &quot;C:\Program Files (x86)\CMake\bin\cmake.exe&quot; -E vs_link_dll --intdir=caffe2\CMakeFiles\caffe2.dir --rc=C:\PROGRA~...
0
2019-06-10T10:36:41.727Z
Well, I saw that your build directory contains space. As a workground, you can just avoid that to make build pass. However, more details to fix this issue are welcomed.
1
2019-06-10T11:38:37.970Z
https://discuss.pytorch.org/t/cmake-error-and-fatal-error-lnk1181-building-from-source-on-windows-10/47541/5
Well, I saw that your build directory contains space. As a workground, you can just avoid that to make build pass. However, more details to fix this issue are welcomed. Thanks for the code. Using your code and just passing some random values into the models, I can get valid gradients in both models: model = Network(2...
2,160
{'text': ['Well, I saw that your build directory contains space. As a workground, you can just avoid that to make build pass. However, more details to fix this issue are welcomed.'], 'answer_start': [2160]}
How to feed in output of a trained NN into another network that must be trained
Hi there, I want to train a NN using the output of another already trained NN. I think I am not able to do it right. new to pytorch. kindly help. In the code below, the already trained NN is called “model” (hence, usd in eval() mode), and the network to be trained is “modelFCNN” (a fully connecte&hellip;
0
2020-07-17T21:46:32.652Z
Thanks for the code. Using your code and just passing some random values into the models, I can get valid gradients in both models: model = Network(2, 2) modelFCNN = NetworkFCNN(2, 1) criterion1 = torch.nn.MSELoss() data = torch.randn(1, 2) y_pred_ref = modelFCNN(data) # concatenate the tens&hellip;
2
2020-07-21T04:23:48.968Z
https://discuss.pytorch.org/t/how-to-feed-in-output-of-a-trained-nn-into-another-network-that-must-be-trained/89651/10
Well, I saw that your build directory contains space. As a workground, you can just avoid that to make build pass. However, more details to fix this issue are welcomed. Thanks for the code. Using your code and just passing some random values into the models, I can get valid gradients in both models: model = Network(2...
1,249
{'text': ['Thanks for the code.\n\nUsing your code and just passing some random values into the models, I can get valid gradients in both models:\n\nmodel = Network(2, 2)\n\nmodelFCNN = NetworkFCNN(2, 1)\n\ncriterion1 = torch.nn.MSELoss()\n\ndata = torch.randn(1, 2)\n\ny_pred_ref = modelFCNN(data)\n\n# concatenate the ...
Is pytorch support RTX2080 and cuda10.0 and cudnn7.5?
I want to install fastai V1 with pytorch V1 However, I have tried a lot of times, And I cannot get the correct version pytorch. Here is the technical specs of my PC GPU: RTx 2080 cuda: 10.0 cudnn: 7.5 here is one piece installation log. ~$ conda install pytorch=1.0.0 cudatoolkit=10.0 -c pytor&hellip;
0
2019-04-02T08:54:40.260Z
We’ve had this issue <a href="https://discuss.pytorch.org/t/problem-installing-pytorch-with-conda/40940/2?u=ptrblck">here</a>. Could you try to run conda install pytorch=1.0.0 torchvision cuda100 -c pytorch and see if the right CUDA version will be installed?
2
2019-04-02T09:00:30.443Z
https://discuss.pytorch.org/t/is-pytorch-support-rtx2080-and-cuda10-0-and-cudnn7-5/41474/2
Well, I saw that your build directory contains space. As a workground, you can just avoid that to make build pass. However, more details to fix this issue are welcomed. Thanks for the code. Using your code and just passing some random values into the models, I can get valid gradients in both models: model = Network(2...
477
{'text': ['We’ve had this issue <a href="https://discuss.pytorch.org/t/problem-installing-pytorch-with-conda/40940/2?u=ptrblck">here</a>.\n\nCould you try to run\n\nconda install pytorch=1.0.0 torchvision cuda100 -c pytorch\n\nand see if the right CUDA version will be installed?'], 'answer_start': [477]}
Efficiency of dataloader and collate for large array-like datasets
I have been writing a custom dataset to handle my HDF5-stored tables, and I really like it as an abstraction and interface. I liked it so much I just played with the class and added some flexbility that should make sense to efficiently gather my data. So me, a horrible, terrible newbie and pytorch &hellip;
0
2019-10-30T10:36:20.659Z
In case where bulk read makes sense, you should not use DataLoader in the default random read style. Here is a quick start on how to switch to bulk loading mode. Instead, write a sampler that spits out keys representing batch index (e.g., range, or list of indices). For DataLoader, set batch_size=&hellip;
3
2019-10-30T21:48:41.687Z
https://discuss.pytorch.org/t/efficiency-of-dataloader-and-collate-for-large-array-like-datasets/59569/4
In case where bulk read makes sense, you should not use DataLoader in the default random read style. Here is a quick start on how to switch to bulk loading mode. Instead, write a sampler that spits out keys representing batch index (e.g., range, or list of indices). For DataLoader, set batch_size=&hellip; I see the e...
1,478
{'text': ['In case where bulk read makes sense, you should not use DataLoader in the default random read style.\n\nHere is a quick start on how to switch to bulk loading mode.\n\nInstead, write a sampler that spits out keys representing batch index (e.g., range, or list of indices). For DataLoader, set batch_size=&hell...
Issues on using nn.DataParallel with Python 3.10 and PyTorch 1.11
I modify nn.DataParallel so as it handles a modified network (a GenForce GAN generator in my case), as follows: class DataParallelPassthrough(nn.DataParallel): def __getattr__(self, name): try: return super(DataParallelPassthrough, self).__getattr__(name) except Attr&hellip;
0
2022-03-17T16:08:31.011Z
I see the expected change in the current nightly, so I guess you are still looking into a wrong installation: root@4031504dc1c7:/workspace# pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html Looking in links: https://download.pytorch.org/whl/nightly/cu113/t&hellip;
0
2022-03-18T01:36:11.008Z
https://discuss.pytorch.org/t/issues-on-using-nn-dataparallel-with-python-3-10-and-pytorch-1-11/146745/10
In case where bulk read makes sense, you should not use DataLoader in the default random read style. Here is a quick start on how to switch to bulk loading mode. Instead, write a sampler that spits out keys representing batch index (e.g., range, or list of indices). For DataLoader, set batch_size=&hellip; I see the e...
1,048
{'text': ['I see the expected change in the current nightly, so I guess you are still looking into a wrong installation:\n\nroot@4031504dc1c7:/workspace# pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html\n\nLooking in links: https://download.pytorch.org/whl/nightly/cu113/t&hel...
Row-wise comparisons between 2D-tensors
Hi everyone! I’m trying to compare all row-elements of 2 2D tensors. An easy example of would be the following two tensors a = torch.tensor([[1,2], [4,5], [7,8]]) b = torch.tensor([[2,3], [7,5], [-1,7]]) Now I’d like to check for each element in the first tensor if it is part of the same row in t&hellip;
0
2021-02-16T15:03:21.873Z
Another implementation: res = a.repeat_interleave(2, dim=1).reshape(-1, 2) == b.repeat_interleave(2, dim=0)
1
2021-02-18T07:07:22.286Z
https://discuss.pytorch.org/t/row-wise-comparisons-between-2d-tensors/112056/4
In case where bulk read makes sense, you should not use DataLoader in the default random read style. Here is a quick start on how to switch to bulk loading mode. Instead, write a sampler that spits out keys representing batch index (e.g., range, or list of indices). For DataLoader, set batch_size=&hellip; I see the e...
619
{'text': ['Another implementation:\n\nres = a.repeat_interleave(2, dim=1).reshape(-1, 2) == b.repeat_interleave(2, dim=0)'], 'answer_start': [619]}
Pytorch suddenyl stops recognising GPU
Hi, I am using PyTorch through Anaconda Environment and something weird happens. While working or if I leave the machine for some time and come back, PyTorch stops recognizing the GPU. And the only way it starts recognizing the GPU is after rebooting the machine. Why does this happen?
0
2020-08-19T16:00:11.823Z
This happens to me sometimes and to fix without rebooting I reload gpu using $ sudo rmmod nvidia_uvm $ sudo modprobe nvidia_uvm No idea why it happens though
3
2020-08-19T16:49:32.274Z
https://discuss.pytorch.org/t/pytorch-suddenyl-stops-recognising-gpu/93384/4
This happens to me sometimes and to fix without rebooting I reload gpu using $ sudo rmmod nvidia_uvm $ sudo modprobe nvidia_uvm No idea why it happens though Then you should be using BertForQuestionAnswering not BertForSentenceClassification Indeed, torchvision C++ support isn’t matching Python support. However, <a...
1,454
{'text': ['This happens to me sometimes and to fix without rebooting I reload gpu using\n\n$ sudo rmmod nvidia_uvm\n\n$ sudo modprobe nvidia_uvm\n\nNo idea why it happens though'], 'answer_start': [1454]}
Training BERT for multi-classfication: ValueError: Expected input batch_size (1) to match target batch_size (512)
I have been getting the shape error, and I am not sure where the problem is. I have tried reshaping and it still does not work. Any help would greatly be appreciated. The batch size is 1 and the target labels are 512. Here is the error log <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original...
0
2020-06-27T14:26:49.366Z
Then you should be using BertForQuestionAnswering not BertForSentenceClassification
1
2020-06-27T18:40:45.214Z
https://discuss.pytorch.org/t/training-bert-for-multi-classfication-valueerror-expected-input-batch-size-1-to-match-target-batch-size-512/87117/22
This happens to me sometimes and to fix without rebooting I reload gpu using $ sudo rmmod nvidia_uvm $ sudo modprobe nvidia_uvm No idea why it happens though Then you should be using BertForQuestionAnswering not BertForSentenceClassification Indeed, torchvision C++ support isn’t matching Python support. However, <a...
888
{'text': ['Then you should be using BertForQuestionAnswering not BertForSentenceClassification'], 'answer_start': [888]}
About torchvision for C++ frontend
The C++ frontend of PyTorch seems not completed to me. If we want to train a model in Python and deploy that model in C++, we have to do hard about code porting. And I think most likely is the part of data preprocessing which could be implemented by torchvision in Python, but it’s missing in C++. T&hellip;
0
2019-07-05T16:30:49.585Z
Indeed, torchvision C++ support isn’t matching Python support. However, <a class="mention" href="/u/shahriarss">@ShahriarSS</a> is doing some good work on it, so the gap is getting smaller. My guess is that most people use OpenCV to do transforms or do them manually. (Personally, I incorporated things like “normalizi...
2
2019-07-05T23:49:30.221Z
https://discuss.pytorch.org/t/about-torchvision-for-c-frontend/49822/2
This happens to me sometimes and to fix without rebooting I reload gpu using $ sudo rmmod nvidia_uvm $ sudo modprobe nvidia_uvm No idea why it happens though Then you should be using BertForQuestionAnswering not BertForSentenceClassification Indeed, torchvision C++ support isn’t matching Python support. However, <a...
245
{'text': ['Indeed, torchvision C++ support isn’t matching Python support.\n\nHowever, <a class="mention" href="/u/shahriarss">@ShahriarSS</a> is doing some good work on it, so the gap is getting smaller.\n\nMy guess is that most people use OpenCV to do transforms or do them manually. (Personally, I incorporated things ...
Cross Entropy Loss: Target size and Output size mismatch
I have problem using Categorical Cross Entropy loss Target data is imported from a numpy array containing label indices for 3 classes (0,1,2) Dataset definition class Tr_dataset(Dataset): def __init__(self, windowed_input, classification_target): self.windowed_input = windowed_input &hellip;
0
2020-10-12T04:15:03.573Z
<a class="mention" href="/u/bibekx">@bibekx</a> That’s a bit weird. I can’t tell how a variable change may have caused that. What I would suggest is: Check the model weights in the test_model function to ensure that an updated model is in fact passed. Check that the dataloader in test_model is iterating through corr...
1
2020-10-13T07:41:37.425Z
https://discuss.pytorch.org/t/cross-entropy-loss-target-size-and-output-size-mismatch/99031/13
<a class="mention" href="/u/bibekx">@bibekx</a> That’s a bit weird. I can’t tell how a variable change may have caused that. What I would suggest is: Check the model weights in the test_model function to ensure that an updated model is in fact passed. Check that the dataloader in test_model is iterating through corr...
1,194
{'text': ['<a class="mention" href="/u/bibekx">@bibekx</a> That’s a bit weird. I can’t tell how a variable change may have caused that.\n\nWhat I would suggest is:\n\nCheck the model weights in the test_model function to ensure that an updated model is in fact passed.\n\nCheck that the dataloader in test_model is itera...
RunTime Error does not make sense
Hello, I have defined a densenet architecture in PyTorch to use it on training data consisting of 15000 samples of 128x128 images. When I want to train a densenet network, I get this error-stack: RuntimeError Traceback (most recent call last) &lt;ipython-input-40-6dace5fb&hellip;
0
2020-08-07T16:55:10.125Z
It’s hard to tell, if the issue might be CPU or OS - dependent (or might be triggered by any other issue). What is concerning is that the previous issue was apparently solved after using the terminal instead of Jupyter, your local environment might also be “broken”. Could you create a new virtual &hellip;
0
2020-08-14T10:25:56.690Z
https://discuss.pytorch.org/t/runtime-error-does-not-make-sense/91997/14
<a class="mention" href="/u/bibekx">@bibekx</a> That’s a bit weird. I can’t tell how a variable change may have caused that. What I would suggest is: Check the model weights in the test_model function to ensure that an updated model is in fact passed. Check that the dataloader in test_model is iterating through corr...
947
{'text': ['It’s hard to tell, if the issue might be CPU or OS - dependent (or might be triggered by any other issue).\n\nWhat is concerning is that the previous issue was apparently solved after using the terminal instead of Jupyter, your local environment might also be “broken”.\n\nCould you create a new virtual &hell...
Threading of Model Pytorch Android
I am trying to deploy my model on android device.Model should be fast in android but it is taking time as model is big. Is model threading option is there while declaring the model interpreter in android as it is available in tensorflow-lite ?
0
2019-11-29T06:11:07.083Z
Hello <a class="mention" href="/u/mohit7">@mohit7</a> We just exposed control on global number of threads used by pytorch android, it was landed in <a href="https://github.com/pytorch/pytorch/commit/62254430093fef5f2dece3825d95b25d443faf63" rel="nofollow noopener">master</a> method org.pytorch.Module#setNumThreads(in...
0
2019-12-11T23:22:28.725Z
https://discuss.pytorch.org/t/threading-of-model-pytorch-android/62490/3
<a class="mention" href="/u/bibekx">@bibekx</a> That’s a bit weird. I can’t tell how a variable change may have caused that. What I would suggest is: Check the model weights in the test_model function to ensure that an updated model is in fact passed. Check that the dataloader in test_model is iterating through corr...
659
{'text': ['Hello <a class="mention" href="/u/mohit7">@mohit7</a>\n\nWe just exposed control on global number of threads used by pytorch android, it was landed in <a href="https://github.com/pytorch/pytorch/commit/62254430093fef5f2dece3825d95b25d443faf63" rel="nofollow noopener">master</a>\n\nmethod org.pytorch.Module#s...
Very weird error of shape mismatch between same exact tensors
Hi. I’m working on some code on NLP where I require to create specific masks. However, when i do this operation: a[a==1] = 5, it tells me that a and a==1 are not of same shape. This happens after the 8th epoch, meaning that it was working for 8 epochs but not after? Moreover, it happens randomly, ma&hellip;
0
2019-10-14T03:10:19.834Z
To solve this, I would use the indices returned by the max op and do scatter(your_dim, ind, 1)
0
2019-10-18T19:21:09.527Z
https://discuss.pytorch.org/t/very-weird-error-of-shape-mismatch-between-same-exact-tensors/58128/15
To solve this, I would use the indices returned by the max op and do scatter(your_dim, ind, 1) Thanks for raising this issue! It seems the currently linked model cannot be imported using the latest stable release (1.2.0). However, after installing the nightly build, the model was loaded successfully in my colab noteb...
2,558
{'text': ['To solve this, I would use the indices returned by the max op and do scatter(your_dim, ind, 1)'], 'answer_start': [2558]}
PyTorch Model zoo and pretrained models not loading in Colab
I am trying to load models from the model zoo in Google Colab and keep getting the errors: AttributeError: module &#39;torch.jit&#39; has no attribute &#39;unused&#39; I was trying to load <a href="https://pytorch.org/hub/pytorch_vision_deeplabv3_resnet101/" rel="nofollow noopener">https://pytorch.org/hub/pytorch_vis...
0
2019-10-06T14:34:11.092Z
Thanks for raising this issue! It seems the currently linked model cannot be imported using the latest stable release (1.2.0). However, after installing the nightly build, the model was loaded successfully in my colab notebook. Try to run the following lines: !pip uninstall torch -y !pip install&hellip;
1
2019-10-08T01:17:17.928Z
https://discuss.pytorch.org/t/pytorch-model-zoo-and-pretrained-models-not-loading-in-colab/57561/3
To solve this, I would use the indices returned by the max op and do scatter(your_dim, ind, 1) Thanks for raising this issue! It seems the currently linked model cannot be imported using the latest stable release (1.2.0). However, after installing the nightly build, the model was loaded successfully in my colab noteb...
1,374
{'text': ['Thanks for raising this issue!\n\nIt seems the currently linked model cannot be imported using the latest stable release (1.2.0).\n\nHowever, after installing the nightly build, the model was loaded successfully in my colab notebook.\n\nTry to run the following lines:\n\n!pip uninstall torch -y\n\n!pip insta...
Post Quantizing conv1d, PReLU & layerNorm layers can be done?
I build a pytorch model based on conv1d. I gone through quantization and implemented some cases as well but all those are working on conv2d, bn,relu but In my case, my model is built on conv1d and PReLU. Does this quatization valid for these network layers? Because when I did quantization only the l&hellip;
0
2020-05-13T03:15:31.034Z
Only the quantized model will work if all the layers were quantized is it right? Or else we need to dequantize the parameters again before it passes through not quantized layer is it so? You can insert QuantStub, DequantStub blocks around the code that can be quantized. Please see <a href="https://pytorch.org/tutorial...
0
2020-05-20T04:43:44.103Z
https://discuss.pytorch.org/t/post-quantizing-conv1d-prelu-layernorm-layers-can-be-done/80954/5
To solve this, I would use the indices returned by the max op and do scatter(your_dim, ind, 1) Thanks for raising this issue! It seems the currently linked model cannot be imported using the latest stable release (1.2.0). However, after installing the nightly build, the model was loaded successfully in my colab noteb...
405
{'text': ['Only the quantized model will work if all the layers were quantized is it right? Or else we need to dequantize the parameters again before it passes through not quantized layer is it so?\n\nYou can insert QuantStub, DequantStub blocks around the code that can be quantized. Please see <a href="https://pytorch...
RuntimeError trying to run Pytorch over GPU GeForce GTX 1650 Ti
For my final part of the master thesis I’m running a algorithm on a large dataset. I’m very new to Python and PyTorch. But was recommended that the great forum here could give some guidance. On CPU the code runs without any problems. if torch.cuda.is_available(): print(‘Training on GPU:’) print(t&hellip;
0
2021-01-27T22:38:17.898Z
Dear ptrblck. with the combination of: torch.set_default_tensor_type(‘torch.cuda.FloatTensor’) model.to(device) and your suggestion of: def init_hidden(self, batchSize): device = next(self.parameters()).device return torch.zeros(1, batchSize, hiddenDimSize, device=device) I&hellip;
0
2021-01-28T23:06:53.005Z
https://discuss.pytorch.org/t/runtimeerror-trying-to-run-pytorch-over-gpu-geforce-gtx-1650-ti/110174/23
Dear ptrblck. with the combination of: torch.set_default_tensor_type(‘torch.cuda.FloatTensor’) model.to(device) and your suggestion of: def init_hidden(self, batchSize): device = next(self.parameters()).device return torch.zeros(1, batchSize, hiddenDimSize, device=device) I&hellip; It seems the error is raised ...
1,644
{'text': ['Dear ptrblck.\n\nwith the combination of:\n\ntorch.set_default_tensor_type(‘torch.cuda.FloatTensor’)\n\nmodel.to(device)\n\nand your suggestion of:\n\ndef init_hidden(self, batchSize):\n\ndevice = next(self.parameters()).device\n\nreturn torch.zeros(1, batchSize, hiddenDimSize, device=device)\n\nI&hellip;'],...
Input and model on different GPUs Error with complex model when using nn.DataParallel
Error message: Expected tensor for ‘out’ to have the same device as tensor for argument #2 ‘mat1’; but device 1 does not equal 0 (while checki ng arguments for addmm) I understand this error has been discussed quite a lot and after reading several posts I had a basic idea of why this occurs on my&hellip;
0
2020-11-18T09:43:14.633Z
It seems the error is raised by rewrapping the model into nn.DataParallel in each iteration. Move contact_net = torch.nn.DataParallel(contact_net) before the epoch loop and it should work. I don’t know, why this usage gives a device mismatch error and think a better error message should be raised.&hellip;
1
2020-11-26T01:30:09.814Z
https://discuss.pytorch.org/t/input-and-model-on-different-gpus-error-with-complex-model-when-using-nn-dataparallel/103243/16
Dear ptrblck. with the combination of: torch.set_default_tensor_type(‘torch.cuda.FloatTensor’) model.to(device) and your suggestion of: def init_hidden(self, batchSize): device = next(self.parameters()).device return torch.zeros(1, batchSize, hiddenDimSize, device=device) I&hellip; It seems the error is raised ...
1,113
{'text': ['It seems the error is raised by rewrapping the model into nn.DataParallel in each iteration.\n\nMove contact_net = torch.nn.DataParallel(contact_net) before the epoch loop and it should work.\n\nI don’t know, why this usage gives a device mismatch error and think a better error message should be raised.&hell...
Visualize image from pixels
Hello! I have a pytorch tensor, call it a, which should contain the pixel values of an image. Here it is how it looks like: tensor([[[154., 143., 137., ..., 136., 136., 136.], [140., 155., 143., ..., 136., 136., 136.], [131., 153., 138., ..., 136., 136., 136.], ..., &hellip;
0
2019-06-13T03:33:15.102Z
Hi, try this and check. import matplotlib.pyplot as plt import numpy as np npimg = img.numpy() # img is your tensor npimg = npimg / 255 # add this line plt.imshow(np.transpose(npimg, (1, 2, 0))) plt.show() Thanks
1
2019-06-13T05:23:00.908Z
https://discuss.pytorch.org/t/visualize-image-from-pixels/47811/11
Dear ptrblck. with the combination of: torch.set_default_tensor_type(‘torch.cuda.FloatTensor’) model.to(device) and your suggestion of: def init_hidden(self, batchSize): device = next(self.parameters()).device return torch.zeros(1, batchSize, hiddenDimSize, device=device) I&hellip; It seems the error is raised ...
600
{'text': ['Hi,\n\ntry this and check.\n\nimport matplotlib.pyplot as plt\n\nimport numpy as np\n\nnpimg = img.numpy() # img is your tensor\n\nnpimg = npimg / 255 # add this line\n\nplt.imshow(np.transpose(npimg, (1, 2, 0)))\n\nplt.show()\n\nThanks'], 'answer_start': [600]}
Loss decreasing when model runs on CPU, but loss is always zero when model runs on GPU
Hi, I’m trying to train a simple model with cats and dogs data set. When I start training on CPU the loss decreased the way it should be, but when I switched to GPU mode LOSS is always zero, I moved model and tensors to GPU like the bellow code but still loss is zero. Any idea ? import os import o&hellip;
0
2018-09-09T22:21:51.946Z
If you use datasets.ImageFolder then yes, your images should be located in separate folders which represent the classes. If you don’t want that, you can easily write your own Dataset and load the images using your own logic. <a href="https://pytorch.org/tutorials/beginner/data_loading_tutorial.html#dataset-class">Her...
0
2018-09-10T13:19:57.978Z
https://discuss.pytorch.org/t/loss-decreasing-when-model-runs-on-cpu-but-loss-is-always-zero-when-model-runs-on-gpu/24788/15
If you use datasets.ImageFolder then yes, your images should be located in separate folders which represent the classes. If you don’t want that, you can easily write your own Dataset and load the images using your own logic. <a href="https://pytorch.org/tutorials/beginner/data_loading_tutorial.html#dataset-class">Her...
1,640
{'text': ['If you use datasets.ImageFolder then yes, your images should be located in separate folders which represent the classes.\n\nIf you don’t want that, you can easily write your own Dataset and load the images using your own logic.\n\n<a href="https://pytorch.org/tutorials/beginner/data_loading_tutorial.html#dat...
Model shows different predictions after training without weight update
Dear Community, i encountered some none-intuitive behaviour. I load a model, set it to evaluation mode and predict a single image using model(input). Then, I set the model to training mode and predict a single image again. (Note that there is no .backward performed, I even disabled requires_grad fo&hellip;
0
2020-04-08T15:04:47.844Z
densenet121 uses batchnorm layers, which will update their running estimates during training in each forward pass. During evaluation these running estimates will then be applied instead of the batch statistics, which explains the difference in your outputs.
1
2020-04-09T05:30:47.783Z
https://discuss.pytorch.org/t/model-shows-different-predictions-after-training-without-weight-update/75877/2
If you use datasets.ImageFolder then yes, your images should be located in separate folders which represent the classes. If you don’t want that, you can easily write your own Dataset and load the images using your own logic. <a href="https://pytorch.org/tutorials/beginner/data_loading_tutorial.html#dataset-class">Her...
1,223
{'text': ['densenet121 uses batchnorm layers, which will update their running estimates during training in each forward pass.\n\nDuring evaluation these running estimates will then be applied instead of the batch statistics, which explains the difference in your outputs.'], 'answer_start': [1223]}
Change float labels to integer labels for binary segmentation
Dear engineers, I am sorry if my question might seem silly, but I would like to learn. I am quite new to programming and segmentation tasks. In effect, I am having a dataset with labels that are not in the form of [0,1] as It should be for a binary segmentation task. The readme of the data&hellip;
0
2020-05-04T04:12:14.166Z
[image] Patrice: The targets are not in the form of 0 (background) and 1(foreground) as it should be in the case of binary segmentation. Instead, the values of the foreground are float values ranging from 0.1 to 1. Thanks for mentioning it again. The dice loss is used for discrete data, so I&hellip;
0
2020-05-06T09:56:04.712Z
https://discuss.pytorch.org/t/change-float-labels-to-integer-labels-for-binary-segmentation/79610/19
If you use datasets.ImageFolder then yes, your images should be located in separate folders which represent the classes. If you don’t want that, you can easily write your own Dataset and load the images using your own logic. <a href="https://pytorch.org/tutorials/beginner/data_loading_tutorial.html#dataset-class">Her...
662
{'text': ['[image] Patrice:\n\nThe targets are not in the form of 0 (background) and 1(foreground) as it should be in the case of binary segmentation. Instead, the values of the foreground are float values ranging from 0.1 to 1.\n\nThanks for mentioning it again.\n\nThe dice loss is used for discrete data, so I&hellip;...
[Solved]Dimention mismatch when do transforms on images and masks in segmentation task
I am working on semantic segmentation task and I have to make a customized dataset. The images are 24-bit per pixel and the masks are 8-bit per pixel. My customized dataset as follows: lass MyDataset(Dataset): def __init__(self, root, set_name,): super(MyDataset, self).__init__() &hellip;
0
2019-01-21T12:04:35.448Z
Oh, it is too stupid. In my method transforms, I made mistakes mask = resize(image), so that in the DataLoader the dimension mismatch error will occur in the default_collate, it is not the DataLoader’s problem. My code as follows: rgb_mean = (0.4353, 0.4452, 0.4131) rgb_std = (0.2044, 0.1924, 0.2&hellip;
0
2019-01-23T13:27:02.508Z
https://discuss.pytorch.org/t/solved-dimention-mismatch-when-do-transforms-on-images-and-masks-in-segmentation-task/35205/8
Oh, it is too stupid. In my method transforms, I made mistakes mask = resize(image), so that in the DataLoader the dimension mismatch error will occur in the default_collate, it is not the DataLoader’s problem. My code as follows: rgb_mean = (0.4353, 0.4452, 0.4131) rgb_std = (0.2044, 0.1924, 0.2&hellip; Grouped co...
1,930
{'text': ['Oh, it is too stupid.\n\nIn my method transforms, I made mistakes mask = resize(image), so that in the DataLoader the dimension mismatch error will occur in the default_collate, it is not the DataLoader’s problem.\n\nMy code as follows:\n\nrgb_mean = (0.4353, 0.4452, 0.4131)\n\nrgb_std = (0.2044, 0.1924, 0.2...
F.conv2d runs x15 slower in mixed-precision/half-precision mode
SYSTEM info: OS: Ubuntu 18.04 CUDA: 10.1 pytorch: 1.4.0 installed from conda NVIDIA apex: latest installed from pip GPU: Titan RTX 24GB Driver: 430.64 cudnn version: 7603 I tested my system with following code: import torch import torch.nn as nn from torch import optim from apex import amp from &hellip;
0
2020-02-17T02:48:25.423Z
Grouped convolutions might not trigger the FP16 path and thus might not use TensorCores.
0
2020-02-17T05:20:15.455Z
https://discuss.pytorch.org/t/f-conv2d-runs-x15-slower-in-mixed-precision-half-precision-mode/69987/2
Oh, it is too stupid. In my method transforms, I made mistakes mask = resize(image), so that in the DataLoader the dimension mismatch error will occur in the default_collate, it is not the DataLoader’s problem. My code as follows: rgb_mean = (0.4353, 0.4452, 0.4131) rgb_std = (0.2044, 0.1924, 0.2&hellip; Grouped co...
1,275
{'text': ['Grouped convolutions might not trigger the FP16 path and thus might not use TensorCores.'], 'answer_start': [1275]}
Dataloader returns tuple instead of image and bounding box
Hello, I am implementing an algorithm for object Detection. I have written a custom data loader as below: def getTransform(): transformList = [] transformList += [transforms.ToTensor(), transforms.Normalize((0.485, 0.456, 0.406), &hellip;
0
2021-12-10T11:32:46.168Z
For anyone else stuck with similar problem, the reason input of variable size doesn’t work is because torch.stack will fail for inputs of varying size. Their is also a github issue in this regard. One way to work with such input is to write custom collate function. For example, see below. def colla&hellip;
4
2021-12-13T12:25:15.541Z
https://discuss.pytorch.org/t/dataloader-returns-tuple-instead-of-image-and-bounding-box/139056/13
Oh, it is too stupid. In my method transforms, I made mistakes mask = resize(image), so that in the DataLoader the dimension mismatch error will occur in the default_collate, it is not the DataLoader’s problem. My code as follows: rgb_mean = (0.4353, 0.4452, 0.4131) rgb_std = (0.2044, 0.1924, 0.2&hellip; Grouped co...
399
{'text': ['For anyone else stuck with similar problem, the reason input of variable size doesn’t work is because torch.stack will fail for inputs of varying size. Their is also a github issue in this regard. One way to work with such input is to write custom collate function. For example, see below.\n\ndef colla&hellip...
Is it expected for DistributedDataParallel to use more memory on 1 GPU in a 1GPU:1process setup?
Is it expected for nn.parallel.DistributedDataParallel in a 1GPU:1Process setup to use a little extra memory on one of the GPUs? The use isn’t exorbitant ( 3614 MiB vs. 4189 MiB). If so, what is this extra memory used for? Is it the all_reduce call on the gradients? If not what would this be attribu&hellip;
0
2020-04-21T19:46:25.581Z
Is the DDP process the only process using that GPU? The extra size ~500MB looks like an extra cuda context. Does this behavior still persist if you set CUDA_VISIBLE_DEVICES env var properly (instead of using torch.cuda.set_device(rank)) before launching each process?
0
2020-04-21T22:04:42.349Z
https://discuss.pytorch.org/t/is-it-expected-for-distributeddataparallel-to-use-more-memory-on-1-gpu-in-a-1gpu-1process-setup/77748/7
Is the DDP process the only process using that GPU? The extra size ~500MB looks like an extra cuda context. Does this behavior still persist if you set CUDA_VISIBLE_DEVICES env var properly (instead of using torch.cuda.set_device(rank)) before launching each process? So here we have to be careful about the objective a...
1,414
{'text': ['Is the DDP process the only process using that GPU? The extra size ~500MB looks like an extra cuda context. Does this behavior still persist if you set CUDA_VISIBLE_DEVICES env var properly (instead of using torch.cuda.set_device(rank)) before launching each process?'], 'answer_start': [1414]}
DataLoader not reading in masks correctly?
Hi, I got a multi-class segmentation model running from end-to-end but it seems to be performing incorrectly. I did some debugging and I believe it is because the DataLoader is incorrectly reading in the masks. For example, here is a mask with 3 classes: <a class="lightbox" href="https://discuss.pytorch.org/uploads/...
0
2021-06-10T21:03:33.107Z
So here we have to be careful about the objective and how to interpret the output. Are you training on a multilabel objective or a cross-entropy loss function? If it is cross-entropy, then doing pred &gt; 0.5 doesn’t seem to make sense as you can end up with multiple classes being predicted True as you&hellip;
1
2021-06-14T17:36:15.175Z
https://discuss.pytorch.org/t/dataloader-not-reading-in-masks-correctly/123837/21
Is the DDP process the only process using that GPU? The extra size ~500MB looks like an extra cuda context. Does this behavior still persist if you set CUDA_VISIBLE_DEVICES env var properly (instead of using torch.cuda.set_device(rank)) before launching each process? So here we have to be careful about the objective a...
976
{'text': ['So here we have to be careful about the objective and how to interpret the output. Are you training on a multilabel objective or a cross-entropy loss function? If it is cross-entropy, then doing pred &gt; 0.5 doesn’t seem to make sense as you can end up with multiple classes being predicted True as you&helli...
Equivalent of tf.nn.dilation2d
Hello, I’m new to PyTorch and I don’t know too well Tensorflow. I am currently re-writting a code in Tensorflow to Pytorch and they use tf.nn.dilation2d. I didn’t find any function close to the tensorflow’s one. Can anyone help me ? Thanks !
0
2019-07-29T16:09:49.412Z
I don’t think a dilation is implemented yet. You could unfold the image tensor and apply the max operation on each patch. Have a look at <a href="https://discuss.pytorch.org/t/efficiently-slicing-tensor-like-a-convolution/44840/2">this example</a> to see how to create the patches.
0
2019-07-30T21:30:19.302Z
https://discuss.pytorch.org/t/equivalent-of-tf-nn-dilation2d/51958/2
Is the DDP process the only process using that GPU? The extra size ~500MB looks like an extra cuda context. Does this behavior still persist if you set CUDA_VISIBLE_DEVICES env var properly (instead of using torch.cuda.set_device(rank)) before launching each process? So here we have to be careful about the objective a...
581
{'text': ['I don’t think a dilation is implemented yet.\n\nYou could unfold the image tensor and apply the max operation on each patch.\n\nHave a look at <a href="https://discuss.pytorch.org/t/efficiently-slicing-tensor-like-a-convolution/44840/2">this example</a> to see how to create the patches.'], 'answer_start': [5...
Can we add 2 type of classifier using transfer learning?
suppose my image contains 1 animal from a set of 10 animals and 1 bird from the set of 10 birds can we add 2 types of classifier using transfer learning, like in 1 classifier it gives result what animal this image contains and in another classifier it gives which bird and then we can add both loss &hellip;
2
2019-06-12T17:31:47.445Z
I think you can do it, lets say you are using a resnet50 model = models.resnet50(pretrained=True) inp = model.fc.in_features bottle_neck = nn.Linear(inp, 256) classifier1 = nn.Linear(256, 10) classifier2 = nn.Linear(256, 10) class Flatten(nn.Module): def forward(self, x): x = x.view(x.&hellip;
2
2019-06-12T19:35:25.545Z
https://discuss.pytorch.org/t/can-we-add-2-type-of-classifier-using-transfer-learning/47778/16
I think you can do it, lets say you are using a resnet50 model = models.resnet50(pretrained=True) inp = model.fc.in_features bottle_neck = nn.Linear(inp, 256) classifier1 = nn.Linear(256, 10) classifier2 = nn.Linear(256, 10) class Flatten(nn.Module): def forward(self, x): x = x.view(x.&hellip; This model was ad...
1,728
{'text': ['I think you can do it, lets say you are using a resnet50\n\nmodel = models.resnet50(pretrained=True)\n\ninp = model.fc.in_features\n\nbottle_neck = nn.Linear(inp, 256)\n\nclassifier1 = nn.Linear(256, 10)\n\nclassifier2 = nn.Linear(256, 10)\n\nclass Flatten(nn.Module):\n\ndef forward(self, x):\n\nx = x.view(x...
Pretrained deeplabv3_resnet50_coco is not supported as of now
I am getting the previous error when I use the following line of code: model=torchvision.models.segmentation.deeplabv3_resnet50(pretrained=True)
0
2020-04-17T21:14:42.447Z
This model was added 8 days ago in <a href="https://github.com/pytorch/vision/commit/bf843c664b8ba0ff49d2921237500c77d82f2d04">this PR</a>, so you could install the nightly binary or build from source to use it. :wink:
0
2020-04-18T04:23:52.732Z
https://discuss.pytorch.org/t/pretrained-deeplabv3-resnet50-coco-is-not-supported-as-of-now/77240/2
I think you can do it, lets say you are using a resnet50 model = models.resnet50(pretrained=True) inp = model.fc.in_features bottle_neck = nn.Linear(inp, 256) classifier1 = nn.Linear(256, 10) classifier2 = nn.Linear(256, 10) class Flatten(nn.Module): def forward(self, x): x = x.view(x.&hellip; This model was ad...
1,167
{'text': ['This model was added 8 days ago in <a href="https://github.com/pytorch/vision/commit/bf843c664b8ba0ff49d2921237500c77d82f2d04">this PR</a>, so you could install the nightly binary or build from source to use it. :wink:'], 'answer_start': [1167]}
Backward of a custom layer crashes
Hi, I’m new to PyTorch. I implemented a custom function to perform Hadamard product of matrices as: class HadamardProd(autograd.Function): #@staticmethod def forward(ctx, input, weight, bias=None): ctx.save_for_backward(input, weight, bias) output = torch.mul(inp&hellip;
0
2018-01-20T08:07:56.244Z
Weird. My implementation of the Inverse square root linear unit works fine. class ISRLU(torch.autograd.Function): @staticmethod def forward(ctx, tensor, alpha=1): negatives = torch.min(tensor, torch.Tensor([0])) nisr = torch.rsqrt(1. + alpha * (negatives ** 2)) retur&hellip;
0
2018-01-20T11:21:33.743Z
https://discuss.pytorch.org/t/backward-of-a-custom-layer-crashes/12569/5
I think you can do it, lets say you are using a resnet50 model = models.resnet50(pretrained=True) inp = model.fc.in_features bottle_neck = nn.Linear(inp, 256) classifier1 = nn.Linear(256, 10) classifier2 = nn.Linear(256, 10) class Flatten(nn.Module): def forward(self, x): x = x.view(x.&hellip; This model was ad...
522
{'text': ['Weird. My implementation of the Inverse square root linear unit works fine.\n\nclass ISRLU(torch.autograd.Function):\n\n@staticmethod\n\ndef forward(ctx, tensor, alpha=1):\n\nnegatives = torch.min(tensor, torch.Tensor([0]))\n\nnisr = torch.rsqrt(1. + alpha * (negatives ** 2))\n\nretur&hellip;'], 'answer_star...
Why regression model built using torch wont work well?
I am quite new with torch. And I have mostly difficulty with fitting simple feed forward network with some random data class Net(torch.nn.Module): def __init__(self, n_feature, n_hidden, n_output): super(Net, self).__init__() self.hidden = torch.nn.Linear(n_feature, n_hidden) &hellip;
0
2019-05-12T12:30:09.642Z
Might be unrelated, but could you check if the model output and target have the same shape? If your target is missing the feature dimension ([batch_size] instead of [batch_size, 1]), an unwanted broadcast might be applied. In the latest version this should throw a warning.
1
2019-05-12T13:57:45.290Z
https://discuss.pytorch.org/t/why-regression-model-built-using-torch-wont-work-well/45037/11
Might be unrelated, but could you check if the model output and target have the same shape? If your target is missing the feature dimension ([batch_size] instead of [batch_size, 1]), an unwanted broadcast might be applied. In the latest version this should throw a warning. I normalized the target and original image d...
1,606
{'text': ['Might be unrelated, but could you check if the model output and target have the same shape?\n\nIf your target is missing the feature dimension ([batch_size] instead of [batch_size, 1]), an unwanted broadcast might be applied.\n\nIn the latest version this should throw a warning.'], 'answer_start': [1606]}
Loss becomes zero after a few dozen pictures
I am using Coco Dataset’s pictures and mask image that I crreated with the below script to do sematic segmentation. Why is my cross entropy loss function returning zero after a few dozen pictures? [Screenshot from 2020-04-22 16-54-09] def make_palatte (classes): plt_dict = {0: [&quot;backgorund&quot;, (0&hellip;
0
2020-04-22T07:58:02.693Z
I normalized the target and original image data and it somehow solved the problem which I don’t quiet understand. closing the issue.
0
2020-04-22T16:30:32.063Z
https://discuss.pytorch.org/t/loss-becomes-zero-after-a-few-dozen-pictures/77814/16
Might be unrelated, but could you check if the model output and target have the same shape? If your target is missing the feature dimension ([batch_size] instead of [batch_size, 1]), an unwanted broadcast might be applied. In the latest version this should throw a warning. I normalized the target and original image d...
1,079
{'text': ['I normalized the target and original image data and it somehow solved the problem which I don’t quiet understand. closing the issue.'], 'answer_start': [1079]}
NAN after 50 epochs
I am training a self supervised learning model. The learning rate, loss goes from learning rate = 0.00073495, loss = 310.6790 to learning rate = 0.00073412, loss = nan, in the middle of the 52th epoch I have read earlier suggestions as well, but since my loss in not exploding could there be other &hellip;
0
2020-04-08T10:40:11.937Z
[image] braindotai: try setting it’s eps to bigger value like 1e-6 or 1e-4 or even bigger if required Does this help? You can set eps as- opimizer = torch.opim.Adam(model.parameters(), lr, eps = 1e-4)
0
2020-04-09T05:50:25.834Z
https://discuss.pytorch.org/t/nan-after-50-epochs/75835/6
Might be unrelated, but could you check if the model output and target have the same shape? If your target is missing the feature dimension ([batch_size] instead of [batch_size, 1]), an unwanted broadcast might be applied. In the latest version this should throw a warning. I normalized the target and original image d...
410
{'text': ['[image] braindotai:\n\ntry setting it’s eps to bigger value like 1e-6 or 1e-4 or even bigger if required\n\nDoes this help?\n\nYou can set eps as-\n\nopimizer = torch.opim.Adam(model.parameters(), lr, eps = 1e-4)'], 'answer_start': [410]}
Mismatched output size when using convolution layer [Figure]
I have four vectors size of 1x8. I want to a new vector where each element row of the new vector is a linear combination of each element row in the four vectors as the figure. The expected output should be 1x8. My solution is that using convolution to learn the weight. I convert the vector size of 1&hellip;
0
2018-12-06T16:27:08.018Z
Oh, I clearly misunderstood your use case, sorry! I thought the kernel would be the dotted line in your figure, but I’ve apparently didn’t read the indices carefully enough. So basically you have a weight for each input value. Both of my approaches use some kind of weight sharing and are not doing&hellip;
1
2018-12-06T18:53:03.838Z
https://discuss.pytorch.org/t/mismatched-output-size-when-using-convolution-layer-figure/31463/4
Oh, I clearly misunderstood your use case, sorry! I thought the kernel would be the dotted line in your figure, but I’ve apparently didn’t read the indices carefully enough. So basically you have a weight for each input value. Both of my approaches use some kind of weight sharing and are not doing&hellip; Sorry for t...
1,228
{'text': ['Oh, I clearly misunderstood your use case, sorry!\n\nI thought the kernel would be the dotted line in your figure, but I’ve apparently didn’t read the indices carefully enough.\n\nSo basically you have a weight for each input value. Both of my approaches use some kind of weight sharing and are not doing&hell...
Getting differing speeds on forward pass with different weights
If I use different weights for the same network, the forward pass speeds are very different. One takes around 0.017s the other takes 0.6s I am unsure why this is happening. Both the weights file have the same size (101M). The first one is provided by author of a repository, while the other is just &hellip;
0
2018-10-05T22:27:58.936Z
Sorry for the late reply. I’ve reproduced the timing issue, profiled your code using torch.utils.bottleneck, and it seems run with random weights just performs a lot more calls to layers/box_utils.py. It’s a guess as I’m not familiar with the code, but I think the random weights just might create a&hellip;
1
2018-10-12T01:46:20.232Z
https://discuss.pytorch.org/t/getting-differing-speeds-on-forward-pass-with-different-weights/26628/10
Oh, I clearly misunderstood your use case, sorry! I thought the kernel would be the dotted line in your figure, but I’ve apparently didn’t read the indices carefully enough. So basically you have a weight for each input value. Both of my approaches use some kind of weight sharing and are not doing&hellip; Sorry for t...
923
{'text': ['Sorry for the late reply. I’ve reproduced the timing issue, profiled your code using torch.utils.bottleneck, and it seems run with random weights just performs a lot more calls to layers/box_utils.py.\n\nIt’s a guess as I’m not familiar with the code, but I think the random weights just might create a&hellip...
Ease development by running computations on remote GPU
Hello! For development I use local machine with no GPU and have a remote machine with GPU. I like to debug my code via IDE tools but also want to have access to gpu. Using something a-la vscode over ssh is kinda slow so I want to run my scripts locally but send some computations to remote machine&hellip;
0
2021-05-12T06:27:14.561Z
Documentation on RemoteModule says RemoteModule is not currently supported when using CUDA tensors, but you said tensors will be automatically placed to the same cuda device. Am I missing something? If CUDA tensors are not supported now, where can I track progress on this? Thanks for pointing th&hellip;
1
2021-05-14T18:47:54.080Z
https://discuss.pytorch.org/t/ease-development-by-running-computations-on-remote-gpu/121002/7
Oh, I clearly misunderstood your use case, sorry! I thought the kernel would be the dotted line in your figure, but I’ve apparently didn’t read the indices carefully enough. So basically you have a weight for each input value. Both of my approaches use some kind of weight sharing and are not doing&hellip; Sorry for t...
618
{'text': ['Documentation on RemoteModule says RemoteModule is not currently supported when using CUDA tensors, but you said tensors will be automatically placed to the same cuda device. Am I missing something? If CUDA tensors are not supported now, where can I track progress on this?\n\nThanks for pointing th&hellip;']...
Shape of tensor changes after slicing. RuntimeError: stack expects each tensor to be equal size, but got [32, 1] at entry 0 and [32, 0] at entry 1
I have a very large tensor of shape (512,3,224,224). I input it to model in batches of 32 and I then save the scores corresponding to the target label which is 2. in each iteration, after every slice, the shape of scores changes. Which leads to the following error. What am I doing wrong and how to f&hellip;
0
2020-05-02T10:54:38.185Z
I’m not sure if a condition will save you, since you expect targets to have at least the length b+batch_size, while it seems to have a single element. I would recommend to take another look, how targets is defined and why it’s smaller than you expect.
1
2020-05-03T02:59:49.946Z
https://discuss.pytorch.org/t/shape-of-tensor-changes-after-slicing-runtimeerror-stack-expects-each-tensor-to-be-equal-size-but-got-32-1-at-entry-0-and-32-0-at-entry-1/79386/15
I’m not sure if a condition will save you, since you expect targets to have at least the length b+batch_size, while it seems to have a single element. I would recommend to take another look, how targets is defined and why it’s smaller than you expect. Your approach might work, if you are using a simple optimizer, e.g....
1,846
{'text': ['I’m not sure if a condition will save you, since you expect targets to have at least the length b+batch_size, while it seems to have a single element.\n\nI would recommend to take another look, how targets is defined and why it’s smaller than you expect.'], 'answer_start': [1846]}
Revert optimizer.step()?
Hi everyone, I am trying to perform the following experiment and I’d like your advice on what’s the best way to implement it in Pytorch. Given a mini-batch, weight gradients dW^{(t)} are computed based on minimizing a loss function. When we step towards that direction, we get our new weights and ca&hellip;
0
2020-02-22T17:53:37.344Z
Your approach might work, if you are using a simple optimizer, e.g. SGD without momentum. When you are using momentum or an optimizer with running estimates, the reversed step might not work out of the box and you might need to look into the applied formula to check, how to revert it. Here is a sm&hellip;
4
2020-02-22T23:21:22.903Z
https://discuss.pytorch.org/t/revert-optimizer-step/70692/5
I’m not sure if a condition will save you, since you expect targets to have at least the length b+batch_size, while it seems to have a single element. I would recommend to take another look, how targets is defined and why it’s smaller than you expect. Your approach might work, if you are using a simple optimizer, e.g....
1,176
{'text': ['Your approach might work, if you are using a simple optimizer, e.g. SGD without momentum.\n\nWhen you are using momentum or an optimizer with running estimates, the reversed step might not work out of the box and you might need to look into the applied formula to check, how to revert it.\n\nHere is a sm&hell...
LibTorch on WatchOS?
Hi all, Does anyone have a guide/tutorial on how to get LibTorch (C++) installed/setup for a WatchOS project? I was hoping it would be as easy as installing a Pod like the iOS version… but I get The platform of the target XXX WatchKit Extension(watchOS 6.1) is not compatible withLibTorch (1.4.0),&hellip;
0
2020-02-08T19:13:16.807Z
Scratch that, I found the problem. I had my Header Search Paths set to recursive and that caused my issues. For anyone that finds this… here’s what I did to get this installed on WatchOS. cloned the pytorch repo cd pytorch git checkout v1.4.0 git submodule sync git submodule update --init --recu&hellip;
1
2020-02-10T23:56:20.986Z
https://discuss.pytorch.org/t/libtorch-on-watchos/69073/4
I’m not sure if a condition will save you, since you expect targets to have at least the length b+batch_size, while it seems to have a single element. I would recommend to take another look, how targets is defined and why it’s smaller than you expect. Your approach might work, if you are using a simple optimizer, e.g....
562
{'text': ['Scratch that, I found the problem. I had my Header Search Paths set to recursive and that caused my issues.\n\nFor anyone that finds this… here’s what I did to get this installed on WatchOS.\n\ncloned the pytorch repo\n\ncd pytorch\n\ngit checkout v1.4.0\n\ngit submodule sync\n\ngit submodule update --init ...
Convert to ONNX. Why it fails?
Hi there Cannot use the following code from torch.autograd import Variable import torch.onnx import torch dummy_input = Variable(torch.randn(1, 3, 256, 256)) model = torch.load(‘Paramecium.pth’, map_location=torch.device(‘cpu’)) torch.onnx.export(model, dummy_input, “fromTorch.onnx”) to conv&hellip;
0
2020-06-21T14:14:53.431Z
It looks like I fixed it: <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/f/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f.png" data-download-href="https://discuss.pytorch.org/uploads/default/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f" title="image">[image]</a> Thanks.
0
2020-06-23T14:14:00.148Z
https://discuss.pytorch.org/t/convert-to-onnx-why-it-fails/86290/14
It looks like I fixed it: <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/f/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f.png" data-download-href="https://discuss.pytorch.org/uploads/default/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f" title="image">[image]</a> Thanks. What happens if you ...
1,746
{'text': ['It looks like I fixed it:\n\n<a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/f/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f.png" data-download-href="https://discuss.pytorch.org/uploads/default/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f" title="image">[image]</a>\n\nThanks.'], 'a...
Loss.backward() cause RuntimeError: invalid argument (in version 0.1.12 no error)
If I use batch_size=1, my Skip-gram implementation will raise error as following: (in pytorch 0.1.12 the code works well. but in 0.3.0 raises Runtime Errors) CPU version: Traceback (most recent call last): File &quot;/home/zarzen/Dev/sgns/train.py&quot;, line 32, in &lt;module&gt; train() File &quot;/home/zar&hell...
0
2018-02-05T21:42:50.455Z
What happens if you change all instances of bmm to matmul?
0
2018-02-07T15:05:10.945Z
https://discuss.pytorch.org/t/loss-backward-cause-runtimeerror-invalid-argument-in-version-0-1-12-no-error/13315/7
It looks like I fixed it: <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/f/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f.png" data-download-href="https://discuss.pytorch.org/uploads/default/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f" title="image">[image]</a> Thanks. What happens if you ...
1,173
{'text': ['What happens if you change all instances of bmm to matmul?'], 'answer_start': [1173]}
How to get the partial derivative of the output data with the middle layer data
In a MLP neural network, I want to get partial derivative of the output data with the middle layer data. such as, as shown below: [QQ%E6%88%AA%E5%9B%BE20180314154652],i need the partial derivative of Etotal with neto1. i find register_backward_hook can get this value, but i fail to use. below is my&hellip;
0
2018-03-14T08:03:43.194Z
Presumably label contains the labels as class identifier numbers, not as a 1-hot encoding. [image] <a href="https://discuss.pytorch.org/t/convert-int-into-one-hot-format/507/4?u=jpeg729">Convert int into one-hot format</a> Hi, You can use the scatter_ method to achieve this. I would also advise to create the y_one...
1
2018-03-15T20:49:17.190Z
https://discuss.pytorch.org/t/how-to-get-the-partial-derivative-of-the-output-data-with-the-middle-layer-data/14894/4
It looks like I fixed it: <a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/f/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f.png" data-download-href="https://discuss.pytorch.org/uploads/default/2ff52b7573c132445d0fa4e2c5ea6ac327bea53f" title="image">[image]</a> Thanks. What happens if you ...
359
{'text': ['Presumably label contains the labels as class identifier numbers, not as a 1-hot encoding.\n\n[image]\n\n<a href="https://discuss.pytorch.org/t/convert-int-into-one-hot-format/507/4?u=jpeg729">Convert int into one-hot format</a>\n\nHi,\n\nYou can use the scatter_ method to achieve this.\n\nI would also advis...
torch.nn.ConvTranspose2d vs torch.nn.Upsample
What is the difference between ConvTranspose2d and Upsample in Pytorch? To implement UNet in Pytorch based on the model <a href="https://arxiv.org/pdf/1505.04597.pdf" rel="nofollow noopener">in this paper</a> for the first upsampling layer some people used self.upSample1 = nn.Upsample(size=(1024, 1024), scale_factor...
9
2018-11-26T17:04:59.779Z
[image] justusschock: Transpose is a convolution and has trainable kernels while Upsample is a simple interpolation (bilinear, nearest etc.) Transpose is learning parameter while Up-sampling is no-learning parameters. Using Up-samling for faster inference or training because it does not requi&hellip;
14
2018-11-26T20:39:06.700Z
https://discuss.pytorch.org/t/torch-nn-convtranspose2d-vs-torch-nn-upsample/30574/5
[image] justusschock: Transpose is a convolution and has trainable kernels while Upsample is a simple interpolation (bilinear, nearest etc.) Transpose is learning parameter while Up-sampling is no-learning parameters. Using Up-samling for faster inference or training because it does not requi&hellip; Hi, The clone f...
1,466
{'text': ['[image] justusschock:\n\nTranspose is a convolution and has trainable kernels while Upsample is a simple interpolation (bilinear, nearest etc.)\n\nTranspose is learning parameter while Up-sampling is no-learning parameters. Using Up-samling for faster inference or training because it does not requi&hellip;']...
Why is the clone operation part of the computation graph? Is it even differentiable?
I saw that .clone() was part of the computation graph and thought it was really weird. Why is that? I wanted to know what it even meant to take derivatives with respect to such an operation (I thought it shouldn’t be defined) Why is it part of the computation graph if one can’t take derivatives w&hellip;
0
2020-01-18T21:40:34.982Z
Hi, The clone function is like an identity. f(x) = x, So you can take its derivative. You were expecting something else?
2
2020-01-18T22:28:37.064Z
https://discuss.pytorch.org/t/why-is-the-clone-operation-part-of-the-computation-graph-is-it-even-differentiable/67054/2
[image] justusschock: Transpose is a convolution and has trainable kernels while Upsample is a simple interpolation (bilinear, nearest etc.) Transpose is learning parameter while Up-sampling is no-learning parameters. Using Up-samling for faster inference or training because it does not requi&hellip; Hi, The clone f...
1,037
{'text': ['Hi,\n\nThe clone function is like an identity. f(x) = x, So you can take its derivative.\n\nYou were expecting something else?'], 'answer_start': [1037]}
Distributed training with DDP hangs
I am attempting to use DistributedDataParallel for single-node, multi-GPU training in a SageMaker Studio multi-GPU instance environment, within a Docker container. My entry code is as follows: import os from PIL import ImageFile import torch.multiprocessing as mp nodes, gpus = 1, 4 world_size = no&hellip;
0
2022-03-31T12:18:10.090Z
The code generally looks good, I have concerns for the fork argument in start_processes. <a href="https://pytorch.org/docs/master/notes/multiprocessing.html#cuda-in-multiprocessing" rel="noopener nofollow ugc">The CUDA runtime is not supported in forked subprocesses</a>. I would try replacing it with spawn, for example...
1
2022-04-04T17:27:01.332Z
https://discuss.pytorch.org/t/distributed-training-with-ddp-hangs/147942/3
[image] justusschock: Transpose is a convolution and has trainable kernels while Upsample is a simple interpolation (bilinear, nearest etc.) Transpose is learning parameter while Up-sampling is no-learning parameters. Using Up-samling for faster inference or training because it does not requi&hellip; Hi, The clone f...
427
{'text': ['The code generally looks good, I have concerns for the fork argument in start_processes. <a href="https://pytorch.org/docs/master/notes/multiprocessing.html#cuda-in-multiprocessing" rel="noopener nofollow ugc">The CUDA runtime is not supported in forked subprocesses</a>. I would try replacing it with spawn, ...
PyTorch changes the process affinity
I am running a simple while loop for inference on CPU. I want the inference to run only on 1 CPU, but it seems like PyTorch changes the process affinity. I can see from htop that jobs are being scheduled on multiple CPUs that I do not expect. My python program. import os import torch from torchvis&hellip;
0
2020-02-22T20:12:05.508Z
MKL has extra handling for CPU parallelism. The following two things always worked for me to restrict MKL usage to 1 core: 1. taskset 0x1 python myscript.py 2. OMP_NUM_THREADS=1 python myscript.py
2
2020-02-24T19:51:39.584Z
https://discuss.pytorch.org/t/pytorch-changes-the-process-affinity/70703/13
MKL has extra handling for CPU parallelism. The following two things always worked for me to restrict MKL usage to 1 core: 1. taskset 0x1 python myscript.py 2. OMP_NUM_THREADS=1 python myscript.py For all details check (<a href="https://github.com/IBM/powerai/issues/268" rel="nofollow noopener">https://github.com/IBM...
1,702
{'text': ['MKL has extra handling for CPU parallelism. The following two things always worked for me to restrict MKL usage to 1 core:\n\n1. taskset 0x1 python myscript.py\n\n2. OMP_NUM_THREADS=1 python myscript.py'], 'answer_start': [1702]}
Force installing torchvision (on IBM ppc64le)
I am in a weird scenario were I am forced to use torch 1.3.1 (due to hardware see: <a href="https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda/#/" rel="nofollow noopener">https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda/#/</a>). I read from the pytorch docs that it’s corres...
0
2020-09-23T17:36:38.389Z
For all details check (<a href="https://github.com/IBM/powerai/issues/268" rel="nofollow noopener">https://github.com/IBM/powerai/issues/268</a>). Make sure you have the right conda channel prepended: conda config --prepend channels https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda/#/ then ins...
0
2020-09-24T14:39:46.274Z
https://discuss.pytorch.org/t/force-installing-torchvision-on-ibm-ppc64le/97279/16
MKL has extra handling for CPU parallelism. The following two things always worked for me to restrict MKL usage to 1 core: 1. taskset 0x1 python myscript.py 2. OMP_NUM_THREADS=1 python myscript.py For all details check (<a href="https://github.com/IBM/powerai/issues/268" rel="nofollow noopener">https://github.com/IBM...
1,050
{'text': ['For all details check (<a href="https://github.com/IBM/powerai/issues/268" rel="nofollow noopener">https://github.com/IBM/powerai/issues/268</a>).\n\nMake sure you have the right conda channel prepended:\n\nconda config --prepend channels https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/con...
The problem about Loading a Pytorch Model in C++
I follow the tutorial and use the same code but it comes up a problem *** Error in `./example-app&#39;: free(): invalid pointer: 0x00007ffe733866b0 *** I run them in the centos, How can I solve this problem?
0
2019-07-03T09:52:56.529Z
I update the g++ from 4.8.5 to 4.9.2 and it works.
0
2019-07-16T09:22:57.123Z
https://discuss.pytorch.org/t/the-problem-about-loading-a-pytorch-model-in-c/49589/5
MKL has extra handling for CPU parallelism. The following two things always worked for me to restrict MKL usage to 1 core: 1. taskset 0x1 python myscript.py 2. OMP_NUM_THREADS=1 python myscript.py For all details check (<a href="https://github.com/IBM/powerai/issues/268" rel="nofollow noopener">https://github.com/IBM...
588
{'text': ['I update the g++ from 4.8.5 to 4.9.2 and it works.'], 'answer_start': [588]}
Variables are not updated after loss.backward() and optimizer.step()
Hello, I’m trying to create a multi-label classification based on BERT fine-tuning. However, model parameters are not updated after loss.backward() and optimizer.step(), So my model is never training. I already check that all model parameters have a True value of requires_grad. Also, I followed g&hellip;
0
2021-02-17T07:48:19.253Z
Finally, and after 5 days, I found the error. In fact, the computational graph was broken into two different places, due to two wrong operations. However, it was very difficult to debug it and find the issue source. No tools or Libs exist to visualize the graph, which is the main component for the &hellip;
0
2021-02-19T18:32:26.388Z
https://discuss.pytorch.org/t/variables-are-not-updated-after-loss-backward-and-optimizer-step/112135/10
Finally, and after 5 days, I found the error. In fact, the computational graph was broken into two different places, due to two wrong operations. However, it was very difficult to debug it and find the issue source. No tools or Libs exist to visualize the graph, which is the main component for the &hellip; If help som...
1,276
{'text': ['Finally, and after 5 days, I found the error.\n\nIn fact, the computational graph was broken into two different places, due to two wrong operations. However, it was very difficult to debug it and find the issue source. No tools or Libs exist to visualize the graph, which is the main component for the &hellip...
Custom Rank Loss Function
I’m trying to define a custom loss function in PyTorch. Currently, it is as follows: from scipy.spatial.distance import cdist import numpy as np class MRRLoss(nn.Module): &quot;&quot;&quot; Mean Reciprocal Rank Loss &quot;&quot;&quot; def __init__(self): super(MRRLoss, self).__init__() def forward(self, u, v, &h...
0
2020-05-18T20:49:36.102Z
If help someone, I’ve implemented a better solution to this question inpired by <a href="https://papers.nips.cc/paper/6200-improved-deep-metric-learning-with-multi-class-n-pair-loss-objective" rel="nofollow noopener">N-Pair Loss published on NIPS 2016</a>: import torch from torch import nn class NPairsLoss(nn.Module...
0
2020-06-01T14:49:45.979Z
https://discuss.pytorch.org/t/custom-rank-loss-function/81885/11
Finally, and after 5 days, I found the error. In fact, the computational graph was broken into two different places, due to two wrong operations. However, it was very difficult to debug it and find the issue source. No tools or Libs exist to visualize the graph, which is the main component for the &hellip; If help som...
947
{'text': ['If help someone, I’ve implemented a better solution to this question inpired by <a href="https://papers.nips.cc/paper/6200-improved-deep-metric-learning-with-multi-class-n-pair-loss-objective" rel="nofollow noopener">N-Pair Loss published on NIPS 2016</a>:\n\nimport torch\n\nfrom torch import nn\n\nclass NPa...
ImageNet Loading and plugging-in
Hi everyone, I am seeking for optimal steps in order to train my network on Imagenet. As the dataset is very big, I see a single mistake of mine may lead to several more days/hours. Please suggest me a reading on Imagenet-loading and plugging in the model.
0
2018-07-24T03:48:56.690Z
In that case you could use loss.data[0] instead. Let me know, if the memory issue disappears.
0
2018-07-28T10:17:11.320Z
https://discuss.pytorch.org/t/imagenet-loading-and-plugging-in/21609/8
Finally, and after 5 days, I found the error. In fact, the computational graph was broken into two different places, due to two wrong operations. However, it was very difficult to debug it and find the issue source. No tools or Libs exist to visualize the graph, which is the main component for the &hellip; If help som...
765
{'text': ['In that case you could use loss.data[0] instead.\n\nLet me know, if the memory issue disappears.'], 'answer_start': [765]}
Getting Nan value only on CPU
Hi, I have a saved model that I’m trying to load. The training was initially done over the GPU. When I load it to the GPU, it works fine. However, when I load it to the CPU, sometimes it works and sometimes it doesn’t (I have some Nan values). I’m using the following functions to save and load t&hellip;
0
2020-03-19T01:09:53.888Z
Could you try to run the code in the environment with numpy==1.18.1 please?
0
2020-04-07T06:14:46.811Z
https://discuss.pytorch.org/t/getting-nan-value-only-on-cpu/73696/6
Could you try to run the code in the environment with numpy==1.18.1 please? Where did you modify the code? In your first post or the github repo? I’m not sure about this line: label = label[:, :, np.newaxis] Are you trying to add a batch dimension to your target? If so, the batch dimension should be at dim0, i.e. t...
1,718
{'text': ['Could you try to run the code in the environment with numpy==1.18.1 please?'], 'answer_start': [1718]}