id
stringlengths
7
11
source
stringclasses
1 value
category
stringclasses
11 values
title
stringlengths
15
214
text
stringlengths
70
30.5k
url
stringlengths
57
160
tags
stringlengths
3
113
created_at
int64
1.22B
1.79B
se_79659981
stackoverflow
MACHINE_LEARNING
How to use pyInstaller to package PyTorch code that includes JIT?
How to use pyInstaller to package PyTorch code that includes JIT? The spec file I used is as follows, based on this discussion. # -*- mode: python ; coding: utf-8 -*- from PyInstaller.utils.hooks import collect_data_files datas = [] datas += collect_data_files('triton', include_py_files=True) datas += collect_data_f...
https://stackoverflow.com/questions/79659981/how-to-use-pyinstaller-to-package-pytorch-code-that-includes-jit
python, pytorch, pyinstaller
1,749,539,855
se_77444485
stackoverflow
MACHINE_LEARNING
Using positional encoding in pytorch
Using positional encoding in pytorch Is there any built-in positional encoding in pytorch? Basically, I want to be able to specify the dimension of the encoding, and then be able to get the i'th encoding for every i.
https://stackoverflow.com/questions/77444485/using-positional-encoding-in-pytorch
python, deep-learning, pytorch, transformer-model
1,699,437,475
se_79657483
stackoverflow
MACHINE_LEARNING
num workers does not run in parallel
num workers does not run in parallel from torch.utils.data import Dataset, DataLoader import time import multiprocessing as mp import torch class Sleep(Dataset): def __len__(self): return 20 def __getitem__(self, i): import time, os time.sleep(1) return os.getpid() if __name__ == "__m...
https://stackoverflow.com/questions/79657483/num-workers-does-not-run-in-parallel
pytorch, pytorch-dataloader
1,749,354,240
se_79655763
stackoverflow
MACHINE_LEARNING
Efficiency of torch matrix operations on CPU
Efficiency of torch matrix operations on CPU I am currently working on optimizing PyTorch code running on CPU. On CUDA, you can write fused multiple operators into specialized kernels to reduce memory transfers, avoid intermediate data allocations and thus, improve performance. Is it also possible to do this on CPU wi...
https://stackoverflow.com/questions/79655763/efficiency-of-torch-matrix-operations-on-cpu
optimization, pytorch, libtorch
1,749,204,550
se_70816481
stackoverflow
MACHINE_LEARNING
IndexError: index 89 is out of bounds for axis 0 with size 89
IndexError: index 89 is out of bounds for axis 0 with size 89 I am getting this error but I don't understand how to solve it, can anyone please help? I am trying to run a pre-implemented project on my own text dataset. I am using CUB 200-2011 bird dataset which had initially 11788 birds images and author model has bee...
https://stackoverflow.com/questions/70816481/indexerror-index-89-is-out-of-bounds-for-axis-0-with-size-89
python, machine-learning, deep-learning, pytorch
1,642,880,417
se_76985251
stackoverflow
MACHINE_LEARNING
Determining PCELoss(weight=?) for a NN with 1 binary output class?
Determining PCELoss(weight=?) for a NN with 1 binary output class? I have a neural network for classification with 1 binary output class. The training dataset is unbalanced. 97% for 0 or False, 3% for 1 or True. I'm using BCELoss for the loss function. What do I send in the BCELoss(weight= ???) argument? How do calc...
https://stackoverflow.com/questions/76985251/determining-pcelossweight-for-a-nn-with-1-binary-output-class
python, pytorch
1,693,093,992
se_63357718
stackoverflow
MACHINE_LEARNING
ImportError: TensorBoard logging requires TensorBoard version 1.15 or above
ImportError: TensorBoard logging requires TensorBoard version 1.15 or above I follow the tutorials in pytorch.org It occurs error:TensorBoard logging requires TensorBoard version 1.15 or above,but I have install TensorBoard already. Here is the code: #from torch.utils.tensorboard import SummaryWriter from tensorboardX...
https://stackoverflow.com/questions/63357718/importerror-tensorboard-logging-requires-tensorboard-version-1-15-or-above
pytorch, tensorboard, tensorboardx
1,597,147,364
se_79657416
stackoverflow
MACHINE_LEARNING
Loading and training data on Sagemaker with a Self-supervised pre-training model
Loading and training data on Sagemaker with a Self-supervised pre-training model I'm testing a Self-supervise pre-training model, independently of the model I'm getting the same Error. My environment is Jupiter Labs for AWS Sagemaker, the problem comes when, using args and trying to load the data (either from an S3 bu...
https://stackoverflow.com/questions/79657416/loading-and-training-data-on-sagemaker-with-a-self-supervised-pre-training-model
python, machine-learning, amazon-s3, pytorch, amazon-sagemaker
1,749,341,448
se_79658001
stackoverflow
MACHINE_LEARNING
Need Assistance with Fine-tuning my Content Moderation Neural Network with RoBERTa. (Dataset: Jigsaw)
Need Assistance with Fine-tuning my Content Moderation Neural Network with RoBERTa. (Dataset: Jigsaw) I can't quite figure out how to fine-tune my neural network with jigsaw and make it a multi-classifier rather than a binary-classifier (multiple types of output rather than just positive and negative) and need assista...
https://stackoverflow.com/questions/79658001/need-assistance-with-fine-tuning-my-content-moderation-neural-network-with-rober
python, pytorch, artificial-intelligence, data-science
1,749,400,310
se_79658051
stackoverflow
MACHINE_LEARNING
Why PyTorch softmax computes individual weighted scores differently
Why PyTorch softmax computes individual weighted scores differently I have a simple tensor test_tensor =torch.tensor([ [.1, .2, .3],[.4, .5, .6]]) when I use softmax weights = torch.softmax ( test_tensor, dim = -1), I get: tensor([[0.3006, 0.3322, 0.3672], [0.3006, 0.3322, 0.3672]]) I thought if I do this man...
https://stackoverflow.com/questions/79658051/why-pytorch-softmax-computes-individual-weighted-scores-differently
pytorch, softmax
1,749,404,293
se_79597119
stackoverflow
MACHINE_LEARNING
How to reduce GPU memory usage when running Stable Diffusion with HuggingFace Diffusers?
How to reduce GPU memory usage when running Stable Diffusion with HuggingFace Diffusers? I'm trying to run Stable Diffusion using HuggingFace's diffusers library, but I keep getting CUDA out of memory errors on my RTX 3060 (12GB VRAM). I'm using the standard StableDiffusionPipeline from the "CompVis/stable-diffusion-v...
https://stackoverflow.com/questions/79597119/how-to-reduce-gpu-memory-usage-when-running-stable-diffusion-with-huggingface-di
python, machine-learning, deep-learning, pytorch, stable-diffusion
1,745,866,176
se_79656972
stackoverflow
MACHINE_LEARNING
How to speed up a custom pytorch activation function?
How to speed up a custom pytorch activation function? I wrote a custom activation function in torch, but it is painfully slow: class NoisyRelu(nn.Module): def __init__(self): super(NoisyRelu, self).__init__() def forward(self, x: torch.Tensor)-> torch.Tensor: relu_result = F.relu(x) return relu_result...
https://stackoverflow.com/questions/79656972/how-to-speed-up-a-custom-pytorch-activation-function
pytorch, activation-function
1,749,302,106
se_55411921
stackoverflow
MACHINE_LEARNING
Is there a pytorch method to check the number of cpus?
Is there a pytorch method to check the number of cpus? I can use this torch.cuda.device_count() to check the number of GPUs. I was wondering if there was something equivalent to check the number of CPUs.
https://stackoverflow.com/questions/55411921/is-there-a-pytorch-method-to-check-the-number-of-cpus
python, neural-network, deep-learning, pytorch
1,553,842,208
se_52750622
stackoverflow
MACHINE_LEARNING
How to install pytorch on Power 8 or PPC64 machine?
How to install pytorch on Power 8 or PPC64 machine? I am trying to install pytorch using conda on power 8 IBM machine. Although, I read articles from IBM blog, I couldn't install with success because I got stuck with compiling magma.
https://stackoverflow.com/questions/52750622/how-to-install-pytorch-on-power-8-or-ppc64-machine
pytorch, powerpc
1,539,218,969
se_79537819
stackoverflow
MACHINE_LEARNING
What is the command to install pytorch with cuda 12.8?
What is the command to install pytorch with cuda 12.8? I notice on the website of pytorch (https://pytorch.org/get-started/locally/) there is a command for cuda 12.6 but not for the latest version of cuda which is 12.8. Is there a command specifically for cuda 12.8? Will the command for cuda 12.6 work if I'm using cud...
https://stackoverflow.com/questions/79537819/what-is-the-command-to-install-pytorch-with-cuda-12-8
python, pytorch
1,743,049,102
se_75305358
stackoverflow
MACHINE_LEARNING
RuntimeError: expected scalar type Float but found Half in Stable Diffusion
RuntimeError: expected scalar type Float but found Half in Stable Diffusion I am currently using Kangle Kurnel using Python version 3.7 It kept saying RuntimeError: expected scalar type Float but found Half installed packs accelerate 0.12.0 torch 1.9.1+cu111 t...
https://stackoverflow.com/questions/75305358/runtimeerror-expected-scalar-type-float-but-found-half-in-stable-diffusion
python, error-handling, pytorch, artificial-intelligence, stable-diffusion
1,675,222,115
se_79532275
stackoverflow
MACHINE_LEARNING
Why does torch import complain about numpy version
Why does torch import complain about numpy version I created a virtual environment on MacOS and installed pytorch with pip: python -m env torch-env source torch-env/bin/activate pip install torch torchvision torchaudio Launching python and importing torch fails, however: Python 3.11.2 (main, Mar 5 2023, 23:08:47) [C...
https://stackoverflow.com/questions/79532275/why-does-torch-import-complain-about-numpy-version
python, python-3.x, numpy, pytorch
1,742,854,410
se_79647152
stackoverflow
MACHINE_LEARNING
AttributeError: module 'torch' has no attribute 'get_default_device' when using SentenceTransformer
AttributeError: module 'torch' has no attribute 'get_default_device' when using SentenceTransformer I'm working on a Python NLP project and using the following library versions: PyTorch 2.2.2 Transformers 4.52.3 Sentence-Transformers 4.1.0 When I run this code: from sentence_transformers import Sentenc...
https://stackoverflow.com/questions/79647152/attributeerror-module-torch-has-no-attribute-get-default-device-when-using
python, pytorch, huggingface-transformers, sentence-transformers
1,748,747,871
se_69785483
stackoverflow
MACHINE_LEARNING
Why I face the "UserWarning: The NumPy module was reloaded (imported a second time)..." when I run pytorch code?
Why I face the "UserWarning: The NumPy module was reloaded (imported a second time)..." when I run pytorch code? My environment: Anaconda, Python 3.8.8, Pytorch1.8.1+cu111 Question: When I run the code below I get the following error: UserWarning: "D:\Anaconda3\envs\pytorch\lib\site-packages\torch\cuda\amp\a...
https://stackoverflow.com/questions/69785483/why-i-face-the-userwarning-the-numpy-module-was-reloaded-imported-a-second-ti
python, numpy, pytorch
1,635,672,399
se_76177216
stackoverflow
MACHINE_LEARNING
How is scaled_dot_product_attention meant to be used with cached keys/values in causal LM?
How is scaled_dot_product_attention meant to be used with cached keys/values in causal LM? I'm implementing a transformer and I have everything working, including attention using the new scaled_dot_product_attention from PyTorch 2.0. I'll only be doing causal attention, however, so it seems like it makes sense to use ...
https://stackoverflow.com/questions/76177216/how-is-scaled-dot-product-attention-meant-to-be-used-with-cached-keys-values-in
pytorch, language-model, self-attention
1,683,232,761
se_75385142
stackoverflow
MACHINE_LEARNING
tokenizer.push_to_hub(repo_name) is not working
tokenizer.push_to_hub(repo_name) is not working I'm trying to puch my tokonizer to my huggingface repo... it consist of the model vocab.Json (I'm making a speech recognition model) My code: vocab_dict["|"] = vocab_dict[" "] del vocab_dict[" "] vocab_dict["[UNK]"] = len(vocab_dict) vocab_dict["[PAD]"] = len(vocab_dict)...
https://stackoverflow.com/questions/75385142/tokenizer-push-to-hubrepo-name-is-not-working
python, pytorch, huggingface-transformers, huggingface-tokenizers, huggingface
1,675,855,768
se_79652783
stackoverflow
MACHINE_LEARNING
no_grad causing problem in Pytorch NN model
no_grad causing problem in Pytorch NN model I'm building regression neural network model for my NLP data. But can't get through this error: RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn What should I do? ChatGPT says: it's requires_grad=False somewhere in the code which isn't tr...
https://stackoverflow.com/questions/79652783/no-grad-causing-problem-in-pytorch-nn-model
python, pytorch, nlp
1,749,040,793
se_79650016
stackoverflow
MACHINE_LEARNING
Neural Network model in PyTorch prediction problem for anomaly detection in a simulated irrigation system
Neural Network model in PyTorch prediction problem for anomaly detection in a simulated irrigation system I'm working on my final studies project, which is detecting anomalies in an irrigation system. We simulated the irrigation network on a limited environment as you can see in the photo below.the model we created Th...
https://stackoverflow.com/questions/79650016/neural-network-model-in-pytorch-prediction-problem-for-anomaly-detection-in-a-si
python, machine-learning, pytorch, artificial-intelligence
1,748,882,118
se_79646476
stackoverflow
MACHINE_LEARNING
some_operation().to(device) vs to(device).some_operation()
some_operation().to(device) vs to(device).some_operation() Just found I randomly coded some_data.unsqueeze(0).to(device) and some_data.to(device).unsqueeze(0). If I recall correctly, torch.Tensor.to involves data transferring, something like cudaMemcpyHostToDevice?. Which makes me wonder, suppose device is set to GPU,...
https://stackoverflow.com/questions/79646476/some-operation-todevice-vs-todevice-some-operation
python, pytorch
1,748,683,097
se_61633944
stackoverflow
MACHINE_LEARNING
I am getting Attribute error as 'int' object has no attribute 'to'
I am getting Attribute error as &#39;int&#39; object has no attribute &#39;to&#39; I am writing a python code in Kaggle notebook for Image Classification. In the training part, I am getting an error AttributeError Traceback (most recent call last) <ipython-input-22-052723d8ce9d> in <module...
https://stackoverflow.com/questions/61633944/i-am-getting-attribute-error-as-int-object-has-no-attribute-to
python, pytorch
1,588,764,249
se_79639173
stackoverflow
MACHINE_LEARNING
LSTM model produces single output for full batch of training data
LSTM model produces single output for full batch of training data My training set has dimensions [7000, 2], but my output has single number in it. I want to configure the model to understand that "I want one output for each row in X_train", but I don't know how to do that. In other words, my input has 7000 rows and 2 ...
https://stackoverflow.com/questions/79639173/lstm-model-produces-single-output-for-full-batch-of-training-data
pytorch, lstm, recurrent-neural-network
1,748,271,845
se_79641308
stackoverflow
MACHINE_LEARNING
Understanding PyTorch gradients and backward function, when backwarding more than once
Understanding PyTorch gradients and backward function, when backwarding more than once I'm trying to add more than one generator training step per cycle to a GAN, i.e. I want my Generator to update its parameters n times every m updates of the Discriminator, where n > m. I wrote this piece of code: for epoch in range(...
https://stackoverflow.com/questions/79641308/understanding-pytorch-gradients-and-backward-function-when-backwarding-more-tha
python, pytorch, generative-adversarial-network
1,748,387,042
se_70148547
stackoverflow
MACHINE_LEARNING
WSL2 Pytorch - RuntimeError: No CUDA GPUs are available with RTX3080
WSL2 Pytorch - RuntimeError: No CUDA GPUs are available with RTX3080 I have been struggling for day to make torch work on WSL2 using an RTX 3080. I Installed the CUDA-toolkit version 11.3 Running nvcc -V returns this : nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Su...
https://stackoverflow.com/questions/70148547/wsl2-pytorch-runtimeerror-no-cuda-gpus-are-available-with-rtx3080
pytorch
1,638,144,575
se_73471929
stackoverflow
MACHINE_LEARNING
How to use OneCycleLR?
How to use OneCycleLR? I want to train on CIFAR-10, suppose for 200 epochs. This is my optimizer: optimizer = optim.Adam([x for x in model.parameters() if x.requires_grad], lr=0.001) I want to use OneCycleLR as scheduler. Now, according to the documentation, these are the parameters of OneCycleLR: torch.optim.lr_sched...
https://stackoverflow.com/questions/73471929/how-to-use-onecyclelr
optimization, deep-learning, neural-network, pytorch, learning-rate
1,661,338,702
se_57977880
stackoverflow
MACHINE_LEARNING
Testing that I&#39;ve installed PyTorch correctly
Testing that I&#39;ve installed PyTorch correctly I have installed the PyTorch. How can I test in my Python script whether the installation is correct, e.g., whether it can enable CUDA or not, etc?
https://stackoverflow.com/questions/57977880/testing-that-ive-installed-pytorch-correctly
deep-learning, pytorch
1,568,735,406
se_79134990
stackoverflow
MACHINE_LEARNING
Fast AI Siamese model not improving
Fast AI Siamese model not improving So I was following this tutorial: Fast Ai Siamese, however after I completed it, I got 50% accuracy. I tried loads of things, but nothing worked. So the only place where I think the problem could be is in the Siamese implementation itself, but I have little experience with fast.ai a...
https://stackoverflow.com/questions/79134990/fast-ai-siamese-model-not-improving
machine-learning, pytorch, computer-vision, fast-ai, siamese-network
1,730,146,664
se_79638455
stackoverflow
MACHINE_LEARNING
Torch: how to insert a tensor into another tensor at certain index
Torch: how to insert a tensor into another tensor at certain index I have a padded tensor X with shape (B, T1, C) and a padded tensor Y with shape (B, T2, C), I also know the sample lengths L for X. I want to insert the samples of X into Y at certain index I and pad at the end. For example, if I = 5, the goal of the t...
https://stackoverflow.com/questions/79638455/torch-how-to-insert-a-tensor-into-another-tensor-at-certain-index
python, indexing, pytorch, tensor
1,748,243,165
se_70906050
stackoverflow
MACHINE_LEARNING
How many num_workers in DataLoader?
How many num_workers in DataLoader? I have a machine with 1500 Gb of ram and 112 cores but no GPU. I would like to know how to calculate suitable number of num_workers in DataLoader and batch size. I have to make the inference with Inception-v3(pytorch) on 80,000,000 images. I tried with a batch size of 30k and num_wo...
https://stackoverflow.com/questions/70906050/how-many-num-workers-in-dataloader
python, machine-learning, deep-learning, pytorch
1,643,463,981
se_71639484
stackoverflow
MACHINE_LEARNING
NaN error during backpropagation of torch.sqrt() even though an epsilon is added inside the square root
NaN error during backpropagation of torch.sqrt() even though an epsilon is added inside the square root I am training a neural network with custom loss function that calls torch.sqrt() at one point. To avoid getting NaN gradients during backpropagation, I add a small epsilon value inside the square root. However, the ...
https://stackoverflow.com/questions/71639484/nan-error-during-backpropagation-of-torch-sqrt-even-though-an-epsilon-is-added
pytorch, nan, backpropagation
1,648,408,243
se_79628802
stackoverflow
MACHINE_LEARNING
Why is device_map=&quot;xpu&quot; insufficient VRAM when using madlad400-3b-mt in Pytorch?
Why is device_map=&quot;xpu&quot; insufficient VRAM when using madlad400-3b-mt in Pytorch? 1.Follow the example in this link https://huggingface.co/google/madlad400-3b-mt 2.Using AUTO does not seem to work on XPU, but it can run normally on CPU 3.What am I missing? How can I get it to work properly on the XPU? import...
https://stackoverflow.com/questions/79628802/why-is-device-map-xpu-insufficient-vram-when-using-madlad400-3b-mt-in-pytorch
pytorch, intel-pytorch, xpu
1,747,659,572
se_79584215
stackoverflow
MACHINE_LEARNING
How to select certain indices for multiple dimensions of a PyTorch tensor?
How to select certain indices for multiple dimensions of a PyTorch tensor? I have a situation where I need to add one PyTorch tensor to parts of another tensor. An example is like this: import torch x = torch.randn([10, 7, 128, 128]) # [batch, channel, height, width] # In the actual program, batch_idx and channel_i...
https://stackoverflow.com/questions/79584215/how-to-select-certain-indices-for-multiple-dimensions-of-a-pytorch-tensor
python, pytorch
1,745,221,626
se_78746073
stackoverflow
MACHINE_LEARNING
How to solve &quot;Torch was not compiled with flash attention&quot; warning?
How to solve &quot;Torch was not compiled with flash attention&quot; warning? I am using the Vision Transformer as part of the CLIP model and I keep getting the following warning: ..\site-packages\torch\nn\functional.py:5504: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at ..\aten\s...
https://stackoverflow.com/questions/78746073/how-to-solve-torch-was-not-compiled-with-flash-attention-warning
pytorch, self-attention, vision-transformer
1,720,950,911
se_66130547
stackoverflow
MACHINE_LEARNING
What is the difference between &#39;torch.backends.cudnn.deterministic=True&#39; and &#39;torch.set_deterministic(True)&#39;?
What is the difference between &#39;torch.backends.cudnn.deterministic=True&#39; and &#39;torch.set_deterministic(True)&#39;? My network includes torch.nn.MaxPool3d which throw a RuntimeError when the cudnn deterministic flag is on according to the PyTorch docs (version 1.7 - https://pytorch.org/docs/stable/generated/...
https://stackoverflow.com/questions/66130547/what-is-the-difference-between-torch-backends-cudnn-deterministic-true-and-to
python, pytorch, deterministic, reproducible-research
1,612,927,930
se_55097671
stackoverflow
MACHINE_LEARNING
How to save and load random number generator state in Pytorch?
How to save and load random number generator state in Pytorch? I am training a DL model in Pytorch, and want to train my model in a deterministic way. As written in this official guide, I set random seeds like this: np.random.seed(0) torch.manual_seed(0) torch.backends.cudnn.deterministic = True torch.backends.cudnn....
https://stackoverflow.com/questions/55097671/how-to-save-and-load-random-number-generator-state-in-pytorch
python, pytorch, random-seed, reproducible-research
1,552,292,229
se_79633395
stackoverflow
MACHINE_LEARNING
Why am I getting the error: one of the variables needed for gradient computation has been modified by an inplace operation while running backward
Why am I getting the error: one of the variables needed for gradient computation has been modified by an inplace operation while running backward I am working on my YOLO model. When I try to train my model with the code below an error occured def main(): # Initialize model, loss, and optimizer model = Yolov5(v...
https://stackoverflow.com/questions/79633395/why-am-i-getting-the-error-one-of-the-variables-needed-for-gradient-computation
pytorch, loss, yolov5, in-place
1,747,903,551
se_79631762
stackoverflow
MACHINE_LEARNING
Error in PyTorch when trying to create a generative AI (autoregression) Model
Error in PyTorch when trying to create a generative AI (autoregression) Model I'm trying to build an AI Model, but am getting this error: Traceback (most recent call last): File "F:\Pendrive\!!! Pivate !!!\Other\Other\Private\AI\PyTorch\Model_1\main.py", line 20, in <module> model.pretrain_on_corpus( File "F:\...
https://stackoverflow.com/questions/79631762/error-in-pytorch-when-trying-to-create-a-generative-ai-autoregression-model
python, machine-learning, error-handling, pytorch, artificial-intelligence
1,747,822,302
se_79631387
stackoverflow
MACHINE_LEARNING
Discrepancy in number of elements outputted by torch Dataset and DataLoader
Discrepancy in number of elements outputted by torch Dataset and DataLoader I have a custom Subset: class TestSubset2(Subset): def __init__(self, dataset, indices, days=False): super().__init__(dataset, indices) self.days = days def __getitem__(self, idx): original_idx = self.indices[id...
https://stackoverflow.com/questions/79631387/discrepancy-in-number-of-elements-outputted-by-torch-dataset-and-dataloader
python, pytorch, dataset, pytorch-dataloader
1,747,791,719
se_79025552
stackoverflow
MACHINE_LEARNING
PyTorch: difference between reshape() and view() method
PyTorch: difference between reshape() and view() method What is the difference between reshape and view method and why do we need and I am using pytorch tensors and working on changing the shape of data then I came to know these two functions. what are the affects on memory which consumes the more memory and which is ...
https://stackoverflow.com/questions/79025552/pytorch-difference-between-reshape-and-view-method
python, arrays, pytorch, dataset
1,727,326,451
se_79628713
stackoverflow
MACHINE_LEARNING
torch.cuda.device_count() return 0 when torch.cuda.is_available() return True in jupyter notebook
torch.cuda.device_count() return 0 when torch.cuda.is_available() return True in jupyter notebook I got an error in jupyternotebook said that RuntimeError: Attempting to deserialize object on CUDA device 0 but torch.cuda.device_count() is 0. Please use torch.load with map_location to map your storages to an existing d...
https://stackoverflow.com/questions/79628713/torch-cuda-device-count-return-0-when-torch-cuda-is-available-return-true-in
python, machine-learning, jupyter-notebook, pytorch, cuda
1,747,656,598
se_46595157
stackoverflow
MACHINE_LEARNING
How to apply the torch.inverse() function of PyTorch to every sample in the batch?
How to apply the torch.inverse() function of PyTorch to every sample in the batch? This may seem like a basic question, but I am unable to work it through. In the forward pass of my neural network, I have an output tensor of shape 8x3x3, where 8 is my batch size. We can assume each 3x3 tensor to be a non-singular ma...
https://stackoverflow.com/questions/46595157/how-to-apply-the-torch-inverse-function-of-pytorch-to-every-sample-in-the-batc
python, pytorch
1,507,239,405
se_58206286
stackoverflow
MACHINE_LEARNING
Multilabel classification with class imbalance in Pytorch
Multilabel classification with class imbalance in Pytorch I have a multilabel classification problem, which I am trying to solve with CNNs in Pytorch. I have 80,000 training examples and 7900 classes; every example can belong to multiple classes at the same time, mean number of classes per example is 130. The proble...
https://stackoverflow.com/questions/58206286/multilabel-classification-with-class-imbalance-in-pytorch
pytorch, multilabel-classification, imbalanced-data
1,570,036,657
se_70097798
stackoverflow
MACHINE_LEARNING
Does number of parameters and FLOPS change when converting a model from PyTorch to ONNX or TensorRT format?
Does number of parameters and FLOPS change when converting a model from PyTorch to ONNX or TensorRT format? Does number of parameters and FLOPS (float operations per second) change when converting a model from PyTorch to ONNX or TensorRT format?
https://stackoverflow.com/questions/70097798/does-number-of-parameters-and-flops-change-when-converting-a-model-from-pytorch
deep-learning, pytorch, onnx, tensorrt
1,637,763,821
se_77183339
stackoverflow
MACHINE_LEARNING
Installing torch with GPU support but without downloading 3 GB of duplicated siloed CUDA libraries?
Installing torch with GPU support but without downloading 3 GB of duplicated siloed CUDA libraries? I'm trying to make CUDA containers for DNN less heavy. PyTorch goes against my efforts, as it seems to come bundled with its own siloed copy of a large subset of CUDA libraries. But what if we have them already (possibl...
https://stackoverflow.com/questions/77183339/installing-torch-with-gpu-support-but-without-downloading-3-gb-of-duplicated-sil
python, pip, pytorch, gpu
1,695,761,553
se_79630622
stackoverflow
MACHINE_LEARNING
&quot;UserWarning: &#39;pin_memory&#39; argument is set as true but no accelerator is found, then device pinned memory won&#39;t be used.&quot;
&quot;UserWarning: &#39;pin_memory&#39; argument is set as true but no accelerator is found, then device pinned memory won&#39;t be used.&quot; I am trying to use EasyOCR, reader = easyocr.Reader(['en'], gpu=False) def read_sign(sign): result = reader.readtext(sign) return 'STOP' in result` However while it ...
https://stackoverflow.com/questions/79630622/userwarning-pin-memory-argument-is-set-as-true-but-no-accelerator-is-found
python, pytorch, ocr, torchvision, easyocr
1,747,750,217
se_67311527
stackoverflow
MACHINE_LEARNING
How to set GPU count to 0 using os.environ[&#39;CUDA_VISIBLE_DEVICES&#39;] =&quot;&quot;?
How to set GPU count to 0 using os.environ[&#39;CUDA_VISIBLE_DEVICES&#39;] =&quot;&quot;? So I have the following GPU configured in my system: +-----------------------------------------------------------------------------+ | NVIDIA-SMI 461.33 Driver Version: 461.33 CUDA Version: 11.2 | |---------------...
https://stackoverflow.com/questions/67311527/how-to-set-gpu-count-to-0-using-os-environcuda-visible-devices
python-3.x, pytorch, nvidia, python-os
1,619,674,373
se_79629787
stackoverflow
MACHINE_LEARNING
What is the currently recommended way to install Pytorch with CUDA enabled using conda?
What is the currently recommended way to install Pytorch with CUDA enabled using conda? Pytorch official website used to have an installation option using conda (see printscreen in this answer: https://stackoverflow.com/a/51229368/1273751) But currently no conda option is available: Nevertheless, there still is pytor...
https://stackoverflow.com/questions/79629787/what-is-the-currently-recommended-way-to-install-pytorch-with-cuda-enabled-using
python, pytorch, anaconda, conda
1,747,715,851
se_79629559
stackoverflow
MACHINE_LEARNING
How to format input data for Pytorch?
How to format input data for Pytorch? I have written a conv. neural network from scratch before, but I've decided to use Pytorch for its speed. However, I could not find documentation as to how to format for the conv2d layer. In general, there seems to be a lot of overheads and wrappers which prevents me from viewing ...
https://stackoverflow.com/questions/79629559/how-to-format-input-data-for-pytorch
python, pytorch, conv-neural-network
1,747,693,987
se_78328401
stackoverflow
MACHINE_LEARNING
libtorch_cpu.so: undefined symbol: iJIT_IsProfilingActive
libtorch_cpu.so: undefined symbol: iJIT_IsProfilingActive I have created this Conda environment: conda env create -f environment.yml The environment.yml file: name: deep3d_pytorch channels: - pytorch - conda-forge - defaults dependencies: - python=3.6 - pytorch=1.6.0 - torchvision=0.7.0 - numpy=1.18.1 ...
https://stackoverflow.com/questions/78328401/libtorch-cpu-so-undefined-symbol-ijit-isprofilingactive
pytorch, anaconda, conda, anaconda3
1,713,184,189
se_63218710
stackoverflow
MACHINE_LEARNING
RuntimeError(&quot;grad can be implicitly created only for scalar outputs&quot;)
RuntimeError(&quot;grad can be implicitly created only for scalar outputs&quot;) I have following code for train function for training an A3C. I am stuck with following error. RuntimeError("grad can be implicitly created only for scalar outputs") at line (policy_loss + 0.5 * value_loss).backward() Here is my code, ca...
https://stackoverflow.com/questions/63218710/runtimeerrorgrad-can-be-implicitly-created-only-for-scalar-outputs
python, pytorch, reinforcement-learning
1,596,387,349
se_60987997
stackoverflow
MACHINE_LEARNING
Why `torch.cuda.is_available()` returns False even after installing pytorch with cuda?
Why `torch.cuda.is_available()` returns False even after installing pytorch with cuda? On a Windows 10 PC with an NVidia GeForce 820M I installed CUDA 9.2 and cudnn 7.1 successfully, and then installed PyTorch using the instructions at pytorch.org: pip install torch==1.4.0+cu92 torchvision==0.5.0+cu92 -f https://downl...
https://stackoverflow.com/questions/60987997/why-torch-cuda-is-available-returns-false-even-after-installing-pytorch-with
python, pytorch
1,585,818,739
se_79226995
stackoverflow
MACHINE_LEARNING
Why is (remote) Jupyter busy during ML training, but not actually doing anything?
Why is (remote) Jupyter busy during ML training, but not actually doing anything? I am training an ML model with PyTorch on my own dedicated remote server, using Jupyter as my IDE. Around 120 epochs (about 2 hours into training), the Jupyter cell stops updating the output, but the status bar still says busy as the ker...
https://stackoverflow.com/questions/79226995/why-is-remote-jupyter-busy-during-ml-training-but-not-actually-doing-anything
machine-learning, jupyter-notebook, pytorch
1,732,629,311
se_64987430
stackoverflow
MACHINE_LEARNING
What exactly does the forward function output in Pytorch?
What exactly does the forward function output in Pytorch? This example is taken verbatim from the PyTorch Documentation. Now I do have some background on Deep Learning in general and know that it should be obvious that the forward call represents a forward pass, passing through different layers and finally reaching th...
https://stackoverflow.com/questions/64987430/what-exactly-does-the-forward-function-output-in-pytorch
python, machine-learning, neural-network, pytorch
1,606,224,078
se_79504951
stackoverflow
MACHINE_LEARNING
PyTorch Checkpointing Error: Recomputed Tensor Metadata Mismatch in Global Representation with Extra Sampling
PyTorch Checkpointing Error: Recomputed Tensor Metadata Mismatch in Global Representation with Extra Sampling I’m working on a PyTorch model where I compute a “global representation” through a forward pipeline. This pipeline is subsequently used in an extra sampling procedure later on in the network. When I compute th...
https://stackoverflow.com/questions/79504951/pytorch-checkpointing-error-recomputed-tensor-metadata-mismatch-in-global-repre
python, pytorch, autograd, checkpointing, automatic-mixed-precision
1,741,816,895
se_73180675
stackoverflow
MACHINE_LEARNING
Is there any &quot;better way&quot; to train a quadruped to walk using reinforcement Learning
Is there any &quot;better way&quot; to train a quadruped to walk using reinforcement Learning I have been chasing this problem of using RL to train a quadruped to walk. But have got NO noteworthy success. Following are the Details of the GYM ENV I am using. Sim: pybullet env.action_space = box(shape=(12,), upper = 1...
https://stackoverflow.com/questions/73180675/is-there-any-better-way-to-train-a-quadruped-to-walk-using-reinforcement-learn
pytorch, ros, reinforcement-learning, stable-baselines
1,659,241,764
se_79619583
stackoverflow
MACHINE_LEARNING
Pytorch - torchvision model getting different results in python and kotlin
Pytorch - torchvision model getting different results in python and kotlin I have a torchvision model which is mobilenet without the classification head to use as a similarity search. I have saved it as a torchvision model. When I use it within python with the similarity search it gets the right result but within kotl...
https://stackoverflow.com/questions/79619583/pytorch-torchvision-model-getting-different-results-in-python-and-kotlin
python, kotlin, machine-learning, pytorch, torchvision
1,747,137,143
se_79623585
stackoverflow
MACHINE_LEARNING
YOLOv8 RuntimeError: “could not create a primitive” on CPU using PyTorch
YOLOv8 RuntimeError: “could not create a primitive” on CPU using PyTorch I'm trying to run YOLOv8 inference using Ultralytics on CPU, but I get a RuntimeError: could not create a primitive. I'm using Windows and working in a virtual environment with PyTorch. I'm new to YOLO and would appreciate help understanding this...
https://stackoverflow.com/questions/79623585/yolov8-runtimeerror-could-not-create-a-primitive-on-cpu-using-pytorch
python, pytorch, ultralytics
1,747,319,427
se_79623038
stackoverflow
MACHINE_LEARNING
PyCharm 2025.1 Jupyter kernel fails on import torch with ImportError: libnccl.so.2, but same virtual-env works in terminal
PyCharm 2025.1 Jupyter kernel fails on import torch with ImportError: libnccl.so.2, but same virtual-env works in terminal I am running into the weirdest error. Using PyCharm's Jupyter Notebook IDE (2025.1) I get the following error when I run import torch --------------------------------------------------------------...
https://stackoverflow.com/questions/79623038/pycharm-2025-1-jupyter-kernel-fails-on-import-torch-with-importerror-libnccl-so
pytorch, pycharm, cuda, jetbrains-ide
1,747,302,287
se_53972159
stackoverflow
MACHINE_LEARNING
How does Pytorch&#39;s &quot;Fold&quot; and &quot;Unfold&quot; work?
How does Pytorch&#39;s &quot;Fold&quot; and &quot;Unfold&quot; work? I've gone through the official doc. I'm having a hard time understanding what this function is used for and how it works. Can someone explain this in layman's terms?
https://stackoverflow.com/questions/53972159/how-does-pytorchs-fold-and-unfold-work
python, machine-learning, deep-learning, computer-vision, pytorch
1,546,107,254
se_42480111
stackoverflow
MACHINE_LEARNING
How do I print the model summary in PyTorch?
How do I print the model summary in PyTorch? How do I print the summary of a model in PyTorch like what model.summary() does in Keras: Model Summary: ____________________________________________________________________________________________________ Layer (type) Output Shape Param # C...
https://stackoverflow.com/questions/42480111/how-do-i-print-the-model-summary-in-pytorch
python, machine-learning, deep-learning, pytorch
1,488,180,942
se_61598771
stackoverflow
MACHINE_LEARNING
`squeeze()` vs `unsqueeze()` in PyTorch
`squeeze()` vs `unsqueeze()` in PyTorch I don't understand what squeeze() and unsqueeze() do to a tensor, even after looking at the docs and related questions. I tried to understand it by exploring it myself in python. I first created a random tensor with x = torch.rand(3,2,dtype=torch.float) >>> x tensor([[0.3703, 0....
https://stackoverflow.com/questions/61598771/squeeze-vs-unsqueeze-in-pytorch
python, machine-learning, deep-learning, pytorch, tensor
1,588,615,598
se_42479902
stackoverflow
MACHINE_LEARNING
What does `view()` do in PyTorch?
What does `view()` do in PyTorch? What does view() do to the tensor x? What do negative values mean? x = x.view(-1, 16 * 5 * 5)
https://stackoverflow.com/questions/42479902/what-does-view-do-in-pytorch
python, machine-learning, memory, pytorch, tensor
1,488,180,070
se_70307952
stackoverflow
MACHINE_LEARNING
Get warning : You should probably TRAIN this model on a downstream task to be able to use it for predictions and inference. when loadin finetune model
Get warning : You should probably TRAIN this model on a downstream task to be able to use it for predictions and inference. when loadin finetune model I get this message when loading a finetune model of Bert with a forward neural network on the last layer from a checkpoint directory. This IS expected if you are initia...
https://stackoverflow.com/questions/70307952/get-warning-you-should-probably-train-this-model-on-a-downstream-task-to-be-ab
python, python-3.x, tensorflow, pytorch, huggingface-transformers
1,639,155,382
se_54307225
stackoverflow
MACHINE_LEARNING
`stack()` vs `cat()` in PyTorch
`stack()` vs `cat()` in PyTorch OpenAI's REINFORCE and actor-critic example for reinforcement learning has the following code: REINFORCE: policy_loss = torch.cat(policy_loss).sum() actor-critic: loss = torch.stack(policy_losses).sum() + torch.stack(value_losses).sum() One is using torch.cat, the other uses torch.sta...
https://stackoverflow.com/questions/54307225/stack-vs-cat-in-pytorch
python, machine-learning, deep-learning, pytorch, concatenation
1,548,156,287
se_44856691
stackoverflow
MACHINE_LEARNING
How do you alter the size of a Pytorch Dataset?
How do you alter the size of a Pytorch Dataset? Say I am loading MNIST from torchvision.datasets.MNIST, but I only want to load in 10000 images total, how would I slice the data to limit it to only some number of data points? I understand that the DataLoader is a generator yielding data in the size of the specified b...
https://stackoverflow.com/questions/44856691/how-do-you-alter-the-size-of-a-pytorch-dataset
python, machine-learning, dataset, torch, pytorch
1,498,873,960
se_42704283
stackoverflow
MACHINE_LEARNING
L1/L2 regularization in PyTorch
L1/L2 regularization in PyTorch How do I add L1/L2 regularization in PyTorch without manually computing it?
https://stackoverflow.com/questions/42704283/l1-l2-regularization-in-pytorch
python, machine-learning, pytorch, loss-function, regularized
1,489,089,259
se_66488807
stackoverflow
MACHINE_LEARNING
PyTorch model input shape
PyTorch model input shape I loaded a custom PyTorch model and I want to find out its input shape. Something like this: model.input_shape Is it possible to get this information? Update: print() and summary() don't show this model's input shape, so they are not what I'm looking for.
https://stackoverflow.com/questions/66488807/pytorch-model-input-shape
python, machine-learning, deep-learning, pytorch, conv-neural-network
1,614,931,192
se_57234095
stackoverflow
MACHINE_LEARNING
What is the difference between .flatten() and .view(-1) in PyTorch?
What is the difference between .flatten() and .view(-1) in PyTorch? Both .flatten() and .view(-1) flatten a tensor in PyTorch. What's the difference? Does .flatten() copy the data of the tensor? Is .view(-1) faster? Is there any situation that .flatten() doesn't work?
https://stackoverflow.com/questions/57234095/what-is-the-difference-between-flatten-and-view-1-in-pytorch
python, machine-learning, deep-learning, pytorch
1,564,245,319
se_57237352
stackoverflow
MACHINE_LEARNING
What does &quot;unsqueeze&quot; do in Pytorch?
What does &quot;unsqueeze&quot; do in Pytorch? The PyTorch documentation says: Returns a new tensor with a dimension of size one inserted at the specified position. [...] >>> x = torch.tensor([1, 2, 3, 4]) >>> torch.unsqueeze(x, 0) tensor([[ 1, 2, 3, 4]]) >>> torch.unsqueeze(x, 1) tensor([[ 1], [ 2], ...
https://stackoverflow.com/questions/57237352/what-does-unsqueeze-do-in-pytorch
python, numpy, machine-learning, deep-learning, pytorch
1,564,278,223
se_79082850
stackoverflow
MACHINE_LEARNING
ImportError: Using the `Trainer` with `PyTorch` requires `accelerate&gt;=0.26.0` but I have version already installed 1.0.1
ImportError: Using the `Trainer` with `PyTorch` requires `accelerate&gt;=0.26.0` but I have version already installed 1.0.1 I'm trying to run traning this way but face import error, how to fix it: args = TrainingArguments(output_dir="finetuned", num_train_epochs=10, ...
https://stackoverflow.com/questions/79082850/importerror-using-the-trainer-with-pytorch-requires-accelerate-0-26-0-bu
import, pytorch, huggingface-transformers, accelerate
1,728,812,730
se_78846880
stackoverflow
MACHINE_LEARNING
huggingface train only new tokens embedding
huggingface train only new tokens embedding I want to add new tokens to a huggingface model and train only their embeddings. How can I do that? There are some ways to train only part of a weight tensor (e.g. https://discuss.pytorch.org/t/how-can-i-freeze-weights-in-element-wise/117988), however they seem to have acces...
https://stackoverflow.com/questions/78846880/huggingface-train-only-new-tokens-embedding
python, pytorch, large-language-model, word-embedding, huggingface
1,723,099,650
se_79619981
stackoverflow
MACHINE_LEARNING
tflite model does not predict all the lines in hand as the .pt model does
tflite model does not predict all the lines in hand as the .pt model does I trained a YOLOv8 model for hand line detection. When I test the model in Python, it correctly detects all four hand lines, but when I convert the model to .tflite format and test it in Android Studio (Kotlin), it only predicts three lines. Pro...
https://stackoverflow.com/questions/79619981/tflite-model-does-not-predict-all-the-lines-in-hand-as-the-pt-model-does
kotlin, tensorflow, pytorch, artificial-intelligence
1,747,150,614
se_77418680
stackoverflow
MACHINE_LEARNING
Should the shuffle=True argument be used during training in torch.utils.data.DataLoader() when we have time series data?
Should the shuffle=True argument be used during training in torch.utils.data.DataLoader() when we have time series data? I am confused regarding whether the shuffle=True argument should be used in the pytorch torch.utils.data.DataLoader() during training when the training data are time series data. I believe that shuf...
https://stackoverflow.com/questions/77418680/should-the-shuffle-true-argument-be-used-during-training-in-torch-utils-data-dat
python, deep-learning, pytorch, time-series, pytorch-dataloader
1,699,033,125
se_79618964
stackoverflow
MACHINE_LEARNING
PyTorch Gan training: shape mismatch between real and fake tensor
PyTorch Gan training: shape mismatch between real and fake tensor I’m working on a custom CTGAN-like model for tabular data, where I implemented my own _collate_fn and run_step() logic to control sampling, noise injection, and discriminator inputs. However, I consistently run into shape mismatch errors between the rea...
https://stackoverflow.com/questions/79618964/pytorch-gan-training-shape-mismatch-between-real-and-fake-tensor
python, pytorch, generative-adversarial-network
1,747,112,245
se_79618775
stackoverflow
MACHINE_LEARNING
How to add new feature to torch geometric data object
How to add new feature to torch geometric data object I am using the Zinc graph dataset via torch geometric which I access as zinc_dataset = ZINC(root='my_path', split='train') Each data element is a graph zinc_dataset[0] looks like Data(x=[33, 1], edge_index=[2, 72], edge_attr=[72], y=[1]) I have computed a tensor ...
https://stackoverflow.com/questions/79618775/how-to-add-new-feature-to-torch-geometric-data-object
python, graph, pytorch, pytorch-geometric
1,747,094,667
se_79294216
stackoverflow
MACHINE_LEARNING
&quot;Inconsistent Predictions in PyTorch Model: Single Image vs. Batch Processing&quot;
&quot;Inconsistent Predictions in PyTorch Model: Single Image vs. Batch Processing&quot; I am noticing a significant difference in model predictions when running predictions on a single image versus the whole dataset. The model, which was trained using PyTorch, gives drastically different predictions for the same imag...
https://stackoverflow.com/questions/79294216/inconsistent-predictions-in-pytorch-model-single-image-vs-batch-processing
python, pytorch, huggingface-transformers, huggingface, huggingface-trainer
1,734,609,867
se_77670973
stackoverflow
MACHINE_LEARNING
How to use torcheval.metrics.FrechetInceptionDistance in pytorch for mnist dataset?
How to use torcheval.metrics.FrechetInceptionDistance in pytorch for mnist dataset? I defined a GAN model and I want to evaluate it using FID score. I have 1 channel images which are mnist dataset but this method wants 3 channels images. How can I do to solve this problem?
https://stackoverflow.com/questions/77670973/how-to-use-torcheval-metrics-frechetinceptiondistance-in-pytorch-for-mnist-datas
python, pytorch, evaluation, mnist, generative-adversarial-network
1,702,731,167
se_70954722
stackoverflow
MACHINE_LEARNING
Invert PyTorch Indexing
Invert PyTorch Indexing Suppose, I have a PyTorch tensor a of shape ba,c,h,w and wish to zero out some rows of a with indices given in another tensor b of shape ba,2 of dtype=torch.int16 and b[batch, 0] <= b[batch, 1]. The for loop way of doing is: for batch in range(ba): a[batch,:,0:b[batch,0],:] = 0 # stmnt 1 ...
https://stackoverflow.com/questions/70954722/invert-pytorch-indexing
python, pytorch, slice, tensor
1,643,800,972
se_79615651
stackoverflow
MACHINE_LEARNING
Pylance: &quot;Variable not allowed in type expression&quot; for torch.Tensor return type with from __future__ import annotations (Python 3.12, PyTorch 2.5)
Pylance: &quot;Variable not allowed in type expression&quot; for torch.Tensor return type with from __future__ import annotations (Python 3.12, PyTorch 2.5) I'm encountering a Pylance(reportInvalidTypeForm) error when using torch.Tensor as a return type hint in my PyTorch nn.Module subclasses. This happens even though...
https://stackoverflow.com/questions/79615651/pylance-variable-not-allowed-in-type-expression-for-torch-tensor-return-type
python, pytorch, python-typing, pylance
1,746,891,033
se_76566144
stackoverflow
MACHINE_LEARNING
View PyTorch Implementation details interactively
View PyTorch Implementation details interactively How to see the actual implementation of PyTorch functionalities, classes, and methods. I did not find them on PyTorch's official website. I want an easy way to navigate through the implementation to better understand the concepts.
https://stackoverflow.com/questions/76566144/view-pytorch-implementation-details-interactively
pytorch
1,687,877,659
se_75794403
stackoverflow
MACHINE_LEARNING
AttributeError: module &#39;os&#39; has no attribute &#39;add_dll_directory&#39;
AttributeError: module &#39;os&#39; has no attribute &#39;add_dll_directory&#39; ERROR https://github.com/CorentinJ/Real-Time-Voice-Cloning I am trying to clone my voice using ML. I am following : https://github.com/CorentinJ/Real-Time-Voice-Cloning repository. But at the third step of Setup that is when I run the com...
https://stackoverflow.com/questions/75794403/attributeerror-module-os-has-no-attribute-add-dll-directory
python, module, pytorch, attributes, attributeerror
1,679,339,636
se_74577562
stackoverflow
MACHINE_LEARNING
Get paths of saved checkpoints from Pytorch-Lightning ModelCheckpoint
Get paths of saved checkpoints from Pytorch-Lightning ModelCheckpoint I am using PytorchLightning and a ModelCheckpoint which saves models with a formatted filename like filename="model_{epoch}-{val_acc:.2f}" Afterwards I want to access these checkpoints again and need their paths. For simplicity I want the best from ...
https://stackoverflow.com/questions/74577562/get-paths-of-saved-checkpoints-from-pytorch-lightning-modelcheckpoint
python, pytorch, pytorch-lightning, checkpointing
1,669,407,709
se_63920887
stackoverflow
MACHINE_LEARNING
Whitelist tokens for text generation (XLNet, GPT-2) in huggingface-transformers
Whitelist tokens for text generation (XLNet, GPT-2) in huggingface-transformers In the documentation on text generation (https://huggingface.co/transformers/main_classes/model.html#generative-models) there is the option to put bad_words_ids (List[int], optional) – List of token ids that are not allowed to be generated...
https://stackoverflow.com/questions/63920887/whitelist-tokens-for-text-generation-xlnet-gpt-2-in-huggingface-transformers
python-3.x, nlp, pytorch, huggingface-transformers
1,600,262,138
se_76644106
stackoverflow
MACHINE_LEARNING
How to resolve runtime error in CNN model related to mismatch input size?
How to resolve runtime error in CNN model related to mismatch input size? I am trying to run a CNN model on a synthetic dataset consisting of 4000 sample of semi simple random points with 2 features and 1 cluster per class and input data size x is [4000,2] and corresponding labels size is [4000]. I understand that as ...
https://stackoverflow.com/questions/76644106/how-to-resolve-runtime-error-in-cnn-model-related-to-mismatch-input-size
machine-learning, deep-learning, pytorch, neural-network, conv-neural-network
1,688,836,447
se_79613435
stackoverflow
MACHINE_LEARNING
Soft Actor Critic -- actor forward pass outputs NaN immediately
Soft Actor Critic -- actor forward pass outputs NaN immediately I have the following code for my Actor network in my Soft Actor Critic. However, once the batch is full and it starts to do back prop, (batch size: 128), after about 5 iterations of updating the parameters (batch size: 135), the forward pass of the Actor ...
https://stackoverflow.com/questions/79613435/soft-actor-critic-actor-forward-pass-outputs-nan-immediately
pytorch, reinforcement-learning
1,746,759,605
se_79612729
stackoverflow
MACHINE_LEARNING
Training and validation losses do not reduce when fine-tuning ViTPose from huggingface
Training and validation losses do not reduce when fine-tuning ViTPose from huggingface I am trying to fine-tune a transformer/encoder based pose estimation model available here at: https://huggingface.co/docs/transformers/en/model_doc/vitpose When passing "labels" attribute to the forward pass of the model, the model ...
https://stackoverflow.com/questions/79612729/training-and-validation-losses-do-not-reduce-when-fine-tuning-vitpose-from-huggi
python, machine-learning, pytorch, huggingface-transformers, transformer-model
1,746,718,134
se_71651362
stackoverflow
MACHINE_LEARNING
Raytune tune.choice Typeerror: int() argument must be a string, a bytes-like object or a number, not &#39;Categorical&#39;
Raytune tune.choice Typeerror: int() argument must be a string, a bytes-like object or a number, not &#39;Categorical&#39; I am trying hyperparameter tuning using Ray-tune. current my tune_config is shown in below code self.tune_config = { "batch_size": tune.choice([128, 256, 512]), "epoch": tune.choice([50, 1...
https://stackoverflow.com/questions/71651362/raytune-tune-choice-typeerror-int-argument-must-be-a-string-a-bytes-like-obj
performance, pytorch, typeerror, hyperparameters, ray-tune
1,648,488,674
se_61515915
stackoverflow
MACHINE_LEARNING
Custom submodules in pytorch / libtorch C++
Custom submodules in pytorch / libtorch C++ Full disclosure, I asked this same question on the PyTorch forums about a few days ago and got no reply, so this is technically a repost, but I believe it's still a good question, because I've been unable to find an answer anywhere online. Here goes: Can you show an example...
https://stackoverflow.com/questions/61515915/custom-submodules-in-pytorch-libtorch-c
c++, pytorch, libtorch
1,588,220,784
se_78792142
stackoverflow
MACHINE_LEARNING
Pyarrow error with ray &amp; lightning on databricks
Pyarrow error with ray &amp; lightning on databricks I am trying to train a neural net with pytorch lightning on ray on a databricks cluster. As a start, I copied the example from https://docs.ray.io/en/latest/train/getting-started-pytorch-lightning.html. Unfortunately, the training stops after one epoch with a RayTas...
https://stackoverflow.com/questions/78792142/pyarrow-error-with-ray-lightning-on-databricks
pytorch, databricks, pyarrow, ray, lightning
1,721,894,889
se_68526138
stackoverflow
MACHINE_LEARNING
Torchvision Datasets: Flickr8k not importing Datapoints correctly
Torchvision Datasets: Flickr8k not importing Datapoints correctly I am using torchvision.Datasets to import Flickr8k for later usage inside a Jupyter Notebook. I downloaded all Images from Kaggle into a Folder "archive/Images" and have the file "captions.txt" inside the "archive" Folder. Below is the Problem, the Imag...
https://stackoverflow.com/questions/68526138/torchvision-datasets-flickr8k-not-importing-datapoints-correctly
python, jupyter-notebook, pytorch, kaggle, torchvision
1,627,285,316
se_78975293
stackoverflow
MACHINE_LEARNING
Linear FFNN Model achieving 100% accuracy in predicting sums
Linear FFNN Model achieving 100% accuracy in predicting sums I have a model that adds numbers between -10 to positive 10. The task is simply to predict the sum of those numbers. However the train accuracy quickly reaches 100%. I am not sure if the model is just quickly training, or if there is something wrong and it i...
https://stackoverflow.com/questions/78975293/linear-ffnn-model-achieving-100-accuracy-in-predicting-sums
python, machine-learning, deep-learning, pytorch, perceptron
1,726,080,228
se_79609919
stackoverflow
MACHINE_LEARNING
How to make NN really find optimal solution during training?
How to make NN really find optimal solution during training? Imagine a simple problem: make a function that gets a month index as input (zero-based: 0=Jan, 1=Feb, etc) and outputs number of days in this month (leap year ignored). Of course, using NN for that task is an overkill, but I wondered, can NN actually be trai...
https://stackoverflow.com/questions/79609919/how-to-make-nn-really-find-optimal-solution-during-training
machine-learning, deep-learning, pytorch, artificial-intelligence
1,746,600,444
se_79596508
stackoverflow
MACHINE_LEARNING
Why is day_size set to 32 in temporal embedding code?
Why is day_size set to 32 in temporal embedding code? I am trying to understand the code for temporal embedding inside autoformer implementation using pytorch. https://github.com/thuml/Autoformer/blob/main/layers/Embed.py class TemporalEmbedding(nn.Module): def __init__(self, d_model, embed_type='fixed', freq='h')...
https://stackoverflow.com/questions/79596508/why-is-day-size-set-to-32-in-temporal-embedding-code
python, pytorch, transformer-model
1,745,844,359
se_79599360
stackoverflow
MACHINE_LEARNING
What is the equivalent of torch.nn.Parameter(...) in julia&#39;s flux?
What is the equivalent of torch.nn.Parameter(...) in julia&#39;s flux? In pytorch I can create a custom module as follows (this code example is taken from here): from torch import nn class MyModel(nn.Module): def __init__(self): super().__init__() self.param = nn.Parameter(torch.randn(1, 1)) ...
https://stackoverflow.com/questions/79599360/what-is-the-equivalent-of-torch-nn-parameter-in-julias-flux
python, pytorch, julia, flux.jl
1,745,972,851
se_79609591
stackoverflow
MACHINE_LEARNING
How to trace PyTorch Dataloader workers with VizTracer?
How to trace PyTorch Dataloader workers with VizTracer? I'm using VizTracer to debug performance issues in my PyTorch data loading pipeline. Specifically, I'm using a DataLoader with num_workers > 0 to load data in parallel using multiple subprocesses. However, I noticed that VizTracer doesn't trace these worker subpr...
https://stackoverflow.com/questions/79609591/how-to-trace-pytorch-dataloader-workers-with-viztracer
python, pytorch, multiprocessing, trace, pytorch-dataloader
1,746,571,717
se_79609199
stackoverflow
MACHINE_LEARNING
Numerically stable noncentral chi-squared distribution in torch?
Numerically stable noncentral chi-squared distribution in torch? I need numerically stable non-central chi2 distribution in torch.
https://stackoverflow.com/questions/79609199/numerically-stable-noncentral-chi-squared-distribution-in-torch
python, pytorch, statistics, numerical-methods
1,746,552,587