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_79932903 | stackoverflow | MACHINE_LEARNING | Using Python ctypes Array and c_int as an argument in C++ function binding with pybind11 | Using Python ctypes Array and c_int as an argument in C++ function binding with pybind11
I have data from a device that is being captured in Python directly as a ctypes.Array of ctypes.c_uint16. I'm working PyTorch to create a new Tensor after some post-processing that must after data capture, which I am trying to imp... | https://stackoverflow.com/questions/79932903/using-python-ctypes-array-and-c-int-as-an-argument-in-c-function-binding-with | arrays, pytorch, ctypes, pybind11, python-bindings | 1,777,358,312 |
se_75751907 | stackoverflow | MACHINE_LEARNING | OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root | OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root
I have a weird problem which only occurs since today on my github workflow. These are relevant commands.
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
pip3 install mmengine==0.6.0 ... | https://stackoverflow.com/questions/75751907/oserror-cuda-home-environment-variable-is-not-set-please-set-it-to-your-cuda-i | python, pytorch, openmmlab | 1,678,937,217 |
se_79932456 | stackoverflow | MACHINE_LEARNING | Regarding's MONAI WarmupCosineSchedule with AdamW, should scheduler.step() be called per batch, and does optimizer lr define the peak lr? | Regarding's MONAI WarmupCosineSchedule with AdamW, should scheduler.step() be called per batch, and does optimizer lr define the peak lr?
I am training a PyTorch segmentation model and using:
torch.optim.AdamW
monai.optimizers.WarmupCosineSchedule
My optimizer:
optimizer = torch.optim.AdamW(
model.paramete... | https://stackoverflow.com/questions/79932456/regardings-monai-warmupcosineschedule-with-adamw-should-scheduler-step-be-ca | deep-learning, pytorch, huggingface | 1,777,284,336 |
se_79925632 | stackoverflow | MACHINE_LEARNING | Pytorch engine saves the batch size : how do I save the model in a way allowing me to input one image at a time? | Pytorch engine saves the batch size : how do I save the model in a way allowing me to input one image at a time?
I'm using pytorch ignite to be able to get metrics easily, so I'm using their checkpoint system to save my model.
I want to be able to test one image at a time for a user interface, but when I try to do tha... | https://stackoverflow.com/questions/79925632/pytorch-engine-saves-the-batch-size-how-do-i-save-the-model-in-a-way-allowing | python, pytorch, pytorch-ignite | 1,776,199,624 |
se_79930751 | stackoverflow | MACHINE_LEARNING | How to reduce the perceptual discontinuity at end-of-speech in MuseTalk real-time lip sync? | How to reduce the perceptual discontinuity at end-of-speech in MuseTalk real-time lip sync?
I'm running MuseTalk v1.5 for real-time avatar lip sync on an RTX 4090 at 25fps, streamed over WebRTC. Code is forked from Linly-Talker-Stream (a fork of LiveTalking).
How the pipeline works: during speech, MuseTalk generates a... | https://stackoverflow.com/questions/79930751/how-to-reduce-the-perceptual-discontinuity-at-end-of-speech-in-musetalk-real-tim | python, opencv, pytorch, computer-vision | 1,776,951,614 |
se_79926183 | stackoverflow | MACHINE_LEARNING | PyTorch training issue with EfficientNetB3 | Validation Accuracy plateu | PyTorch training issue with EfficientNetB3 | Validation Accuracy plateu
Metrics
Before I start, I wanted to add that Iβm relatively new to deep learning, so my setup may be overly complex or suboptimal.
Iβm training an image classification model (EfficientNet-B3 on grayscale Kanji images) using PyTorch with:
AMP (tor... | https://stackoverflow.com/questions/79926183/pytorch-training-issue-with-efficientnetb3-validation-accuracy-plateu | python, machine-learning, pytorch | 1,776,273,744 |
se_79929510 | stackoverflow | MACHINE_LEARNING | Do you use raw pytorch or some wrapper or such? | Do you use raw pytorch or some wrapper or such?
I recently started a course about machine-learning as a part of my master that is apparently essentially a course in PyTorch, since starting the course i have learned that PyTorch is actually used a lot in industry and thus this course have become more important to me...... | https://stackoverflow.com/questions/79929510/do-you-use-raw-pytorch-or-some-wrapper-or-such | python, deep-learning, pytorch | 1,776,780,449 |
se_78104756 | stackoverflow | MACHINE_LEARNING | How to Properly Manage GPU Memory Between Successive PyTorch Training Phases using accelerate? | How to Properly Manage GPU Memory Between Successive PyTorch Training Phases using accelerate?
I'm encountering a challenging issue with GPU memory not being released properly between successive training phases in PyTorch, leading to CUDA out of memory errors.
My project involves fine-tuning a model in two consecutive... | https://stackoverflow.com/questions/78104756/how-to-properly-manage-gpu-memory-between-successive-pytorch-training-phases-usi | python, pytorch, accelerate | 1,709,598,959 |
se_70141850 | stackoverflow | MACHINE_LEARNING | Why am I getting the message "UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors."? | Why am I getting the message "UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors."?
I'm building my own dataset:
class MyDataset(Dataset):
def __init__(self, folders):
self.folders = folders
... | https://stackoverflow.com/questions/70141850/why-am-i-getting-the-message-userwarning-the-given-numpy-array-is-not-writeabl | pytorch | 1,638,089,209 |
se_79928341 | stackoverflow | MACHINE_LEARNING | Kaggle Wheel Build Failed while installing causal-conv1d and mamba-ssm | Kaggle Wheel Build Failed while installing causal-conv1d and mamba-ssm
I am trying to install the mamba-ssm in the kaggle. I am using the h100 GPU. These are the current configuration
pytorch-ignite 0.5.3
pytorch-lightning 2.6.1
torch ... | https://stackoverflow.com/questions/79928341/kaggle-wheel-build-failed-while-installing-causal-conv1d-and-mamba-ssm | python, pytorch, kaggle, python-wheel, mamba-ssm | 1,776,613,305 |
se_79926835 | stackoverflow | MACHINE_LEARNING | 'mat1 and mat2 shapes cannot be multiplied', but shape doesn't actually match the data? | 'mat1 and mat2 shapes cannot be multiplied', but shape doesn't actually match the data?
I'm using PyTorch to train a regression model on 5 datasets separately, each 10x3361.
However, when I run PyTorch, it returns the error RuntimeError: mat1 and mat2 shapes cannot be multiplied (10x[some multiple of 1499,... | https://stackoverflow.com/questions/79926835/mat1-and-mat2-shapes-cannot-be-multiplied-but-shape-doesnt-actually-match-th | python, machine-learning, pytorch | 1,776,360,403 |
se_79927828 | stackoverflow | MACHINE_LEARNING | Why does my LSTM time series prediction show periodic sharp downward spikes on test data? | Why does my LSTM time series prediction show periodic sharp downward spikes on test data?
I am trying to predict google stock price using LSTM model from PyTorch.
However after training my model and plotting the predicted results vs the real value, I see periodic sharp downward spikes.
Here is notebook I have wrote in... | https://stackoverflow.com/questions/79927828/why-does-my-lstm-time-series-prediction-show-periodic-sharp-downward-spikes-on-t | deep-learning, pytorch, lstm, stock | 1,776,504,516 |
se_79924583 | stackoverflow | MACHINE_LEARNING | Book Recommendation in PyTorch | Book Recommendation in PyTorch
I am looking to find a book on PyTorch that is suitable for beginners, Ive used sklearn in the past for ML its a simple workflow for me prepare the X and Y data, fit/train a model, and make predictions (different workflow if you are using it for NLP or Images obviously). I know how to ma... | https://stackoverflow.com/questions/79924583/book-recommendation-in-pytorch | python, deep-learning, pytorch, artificial-intelligence | 1,776,056,423 |
se_57223818 | stackoverflow | MACHINE_LEARNING | How to solve strange cuda error in PyTorch? | How to solve strange cuda error in PyTorch?
Here's my code; first I define my u-net model as a class of nn.Module like the following code:
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
class unet(nn.Module... | https://stackoverflow.com/questions/57223818/how-to-solve-strange-cuda-error-in-pytorch | python, deep-learning, pytorch | 1,564,158,160 |
se_68274836 | stackoverflow | MACHINE_LEARNING | pytorch, AttributeError: module 'torch' has no attribute '_utils_internal' | pytorch, AttributeError: module 'torch' has no attribute '_utils_internal'
I need to test some fastai models in an environment without GPU, specifically in a windows server. I trained some fastai models in Google colab, and now need to test them in real time, connected to an industrial process. Neverth... | https://stackoverflow.com/questions/68274836/pytorch-attributeerror-module-torch-has-no-attribute-utils-internal | python-3.x, deep-learning, pytorch, anaconda, fast-ai | 1,625,591,646 |
se_79923565 | stackoverflow | MACHINE_LEARNING | DLL initialization routine failed on package import | DLL initialization routine failed on package import
I have tried loading PyTorch in iPython but get a DLL initialization error. In a normal python console it works fine, as below. Windows 10, Miniconda installation.
Can anyone advise how I need to configure ipython to get the package import to work?
Python 3.14.4 | pa... | https://stackoverflow.com/questions/79923565/dll-initialization-routine-failed-on-package-import | pytorch, ipython, miniconda | 1,775,832,370 |
se_79922326 | stackoverflow | MACHINE_LEARNING | How to make a 2 Label Confusion Matrix and exporting into a json file? | How to make a 2 Label Confusion Matrix and exporting into a json file?
I have to train a convolutional neural network on a dataset. The NN itself works and does what it's supposed to but now I want to make a confusion matrix and export it into a json file for further viewing.
I tried using the ConfusionMatrix function... | https://stackoverflow.com/questions/79922326/how-to-make-a-2-label-confusion-matrix-and-exporting-into-a-json-file | python, machine-learning, scikit-learn, pytorch | 1,775,663,708 |
se_79918952 | stackoverflow | MACHINE_LEARNING | Reproducibility Hugging Face Transformer models | Reproducibility Hugging Face Transformer models
If I'm using any transformer model loaded from the Hugging Face Hub with Python, is it somehow possible to reproduce all the seeds, that have been used for the model training/fine-tuning?
Seeds/information like:
- in training arguments: seed and data_seed
- e.g., in all ... | https://stackoverflow.com/questions/79918952/reproducibility-hugging-face-transformer-models | pytorch, huggingface-transformers, seeding | 1,775,125,472 |
se_57229054 | stackoverflow | MACHINE_LEARNING | How to implement my own ResNet with torch.nn.Sequential in Pytorch? | How to implement my own ResNet with torch.nn.Sequential in Pytorch?
I want to implement a ResNet network (or rather, residual blocks) but I really want it to be in the sequential network form.
What I mean by sequential network form is the following:
## mdl5, from cifar10 tutorial
mdl5 = nn.Sequential(OrderedDict([
... | https://stackoverflow.com/questions/57229054/how-to-implement-my-own-resnet-with-torch-nn-sequential-in-pytorch | machine-learning, neural-network, deep-learning, conv-neural-network, pytorch | 1,564,200,513 |
se_79916898 | stackoverflow | MACHINE_LEARNING | Is the torch.fx traced graph topologically sorted? | Is the torch.fx traced graph topologically sorted?
Dependency layer: The layers whose outputs are passed to the current layer. Basically, The current layer is dependent on the outputs of the dependency layers.
For a project, I need to know if the graph traced by torch.fx is topologically sorted(because i want the depe... | https://stackoverflow.com/questions/79916898/is-the-torch-fx-traced-graph-topologically-sorted | machine-learning, pytorch, torch | 1,774,849,272 |
se_54216920 | stackoverflow | MACHINE_LEARNING | How to use multiple GPUs in pytorch? | How to use multiple GPUs in pytorch?
I use this command to use a GPU.
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
But, I want to use two GPUs in jupyter, like this:
device = torch.device("cuda:0,1" if torch.cuda.is_available() else "cpu") | https://stackoverflow.com/questions/54216920/how-to-use-multiple-gpus-in-pytorch | python, pytorch | 1,547,641,045 |
se_58926054 | stackoverflow | MACHINE_LEARNING | How to get the device type of a pytorch module conveniently? | How to get the device type of a pytorch module conveniently?
I have to stack some my own layers on different kinds of pytorch models with different devices.
E.g. A is a cuda model and B is a cpu model (but I don't know it before I get the device type). Then the new models are C and D respectively, where
class NewModul... | https://stackoverflow.com/questions/58926054/how-to-get-the-device-type-of-a-pytorch-module-conveniently | python, gpu, pytorch | 1,574,132,963 |
se_79916641 | stackoverflow | MACHINE_LEARNING | How to use NeuralForecast and PyTorch Lightning on Intel GPU (XPU / torch.xpu)? | How to use NeuralForecast and PyTorch Lightning on Intel GPU (XPU / torch.xpu)?
PyTorch supports Intel GPU through torch.xpu, but PyTorch Lightning does not currently have built-in XPU accelerator support.
Because NeuralForecast uses Lightning under the hood, that also blocks NeuralForecast on native XPU.
I want a min... | https://stackoverflow.com/questions/79916641/how-to-use-neuralforecast-and-pytorch-lightning-on-intel-gpu-xpu-torch-xpu | python, pytorch, intel, pytorch-lightning | 1,774,800,832 |
se_79916292 | stackoverflow | MACHINE_LEARNING | How do you effectively reuse helper functions and training pipelines across multiple PyTorch projects? | How do you effectively reuse helper functions and training pipelines across multiple PyTorch projects?
Iβve been working on multiple machine learning projects using PyTorch, and I keep running into the same issue: a lot of code ends up being repeated across projects.
This includes things like:
training and evaluation... | https://stackoverflow.com/questions/79916292/how-do-you-effectively-reuse-helper-functions-and-training-pipelines-across-mult | pytorch | 1,774,716,926 |
se_79914822 | stackoverflow | MACHINE_LEARNING | Torch c++ binding cordump with torch c++ extension binding | Torch c++ binding cordump with torch c++ extension binding
I found torch-text is archived, and I still want to use it ,because there is a course that uses it. but Since it was archived, I always meet signture missing problem, so I want to fork and fix it for my learning.
Now I am meeting serious cordump problems in ht... | https://stackoverflow.com/questions/79914822/torch-c-binding-cordump-with-torch-c-extension-binding | pytorch, torch, ffi | 1,774,509,135 |
se_59153248 | stackoverflow | MACHINE_LEARNING | why is my Neural Network stuck at high loss value after the first epochs | why is my Neural Network stuck at high loss value after the first epochs
I'm doing regression using Neural Networks. It should be a simple task for NN to do, I have 10 features and 1 output that I want to predict. I'm using pytorch for my project but my Model is not learning well. the loss start with a very high value... | https://stackoverflow.com/questions/59153248/why-is-my-neural-network-stuck-at-high-loss-value-after-the-first-epochs | neural-network, deep-learning, regression, pytorch, skorch | 1,575,363,101 |
se_71669183 | stackoverflow | MACHINE_LEARNING | How to insert a value in a fixed position of pytorch | How to insert a value in a fixed position of pytorch
I have a PyTorch tensor
x = [[1,2,3,4,5]]
Now I want to add a value to a fixed position of the tensor x, for example, I want to add 11 in position 3 then the x will be
x= [[1,2,3,11,4,5]]
How can I perform this operation in Pytorch? | https://stackoverflow.com/questions/71669183/how-to-insert-a-value-in-a-fixed-position-of-pytorch | python, pytorch, tensor | 1,648,590,682 |
se_79907549 | stackoverflow | MACHINE_LEARNING | How to robustly intercept PyTorch GPU OOM in a Python subprocess and dynamically adjust batch_size within an autonomous AI Agent loop? | How to robustly intercept PyTorch GPU OOM in a Python subprocess and dynamically adjust batch_size within an autonomous AI Agent loop?
I am building an autonomous AI Agent (managing training workflows) that automatically generates PyTorch/OpenMMLab training scripts and executes them in a background subprocess.
One of ... | https://stackoverflow.com/questions/79907549/how-to-robustly-intercept-pytorch-gpu-oom-in-a-python-subprocess-and-dynamically | python, pytorch, multiprocessing, automl | 1,773,507,261 |
se_78583755 | stackoverflow | MACHINE_LEARNING | PyTorch F.interpolate for many dimensions (e.g. 4D, 5D, 6D, 7D, ..., n-D) | PyTorch F.interpolate for many dimensions (e.g. 4D, 5D, 6D, 7D, ..., n-D)
I want to apply N-d interpolation to an (N+2)-d tensor for N>3.
import torch
import torch.nn.functional as F
x = torch.randn(1, 1, 2, 3, 4, 5, 6, 7)
output_size = (7, 6, 5, 4, 3, 2)
y = F.interpolate(x, size=output_size, mode="linear")
The abo... | https://stackoverflow.com/questions/78583755/pytorch-f-interpolate-for-many-dimensions-e-g-4d-5d-6d-7d-n-d | python, pytorch, interpolation | 1,717,626,259 |
se_79910591 | stackoverflow | MACHINE_LEARNING | XTTS v2 produces hallucinations when running multiple inferences sequentially, but works fine individually | XTTS v2 produces hallucinations when running multiple inferences sequentially, but works fine individually
I'm using XTTS v2 fine-tuned for Vietnamese (vnTTS).
Problem:
- Running inference on a single sentence β perfect output
- Running inference on multiple sentences in a loop β weird sounds/hallucinations appear on ... | https://stackoverflow.com/questions/79910591/xtts-v2-produces-hallucinations-when-running-multiple-inferences-sequentially-b | python, pytorch, text-to-speech, coqui | 1,773,916,954 |
se_74388129 | stackoverflow | MACHINE_LEARNING | How to deal with hardware dependent libraries in Poetry | How to deal with hardware dependent libraries in Poetry
I'm trying to configure my Poetry pyproject.toml in a way that we can choose between a CPU and a GPU version of the dependencies. The reason for that is that PyTorch needs to be installed by specifying the hardware you want to use (see Poetry's Instructions for i... | https://stackoverflow.com/questions/74388129/how-to-deal-with-hardware-dependent-libraries-in-poetry | pytorch, python-poetry | 1,668,079,096 |
se_78076239 | stackoverflow | MACHINE_LEARNING | How to efficiently calculate gradients of all outputs with respect to parameters? | How to efficiently calculate gradients of all outputs with respect to parameters?
I have a relatively simple requirement but surprisingly this does not seem to be straightforward to implement in pytorch. Given a neural network with $P$ parameters that outputs a vector of length $Y$ and a batch of $B$ data inputs, I wo... | https://stackoverflow.com/questions/78076239/how-to-efficiently-calculate-gradients-of-all-outputs-with-respect-to-parameters | python, machine-learning, deep-learning, pytorch | 1,709,138,847 |
se_77860041 | stackoverflow | MACHINE_LEARNING | How to depend on two versions of PyTorch using Poetry? | How to depend on two versions of PyTorch using Poetry?
I'm using Poetry as my dependency manager. The project is a small computer vision model for object detection.
I would like to publish it as a Python package and, when the end user installs my package I would like to let her choose between the GPU/CPU versions, som... | https://stackoverflow.com/questions/77860041/how-to-depend-on-two-versions-of-pytorch-using-poetry | pytorch, python-packaging, python-poetry | 1,705,928,393 |
se_79910052 | stackoverflow | MACHINE_LEARNING | How to convert the MLP in MoE to 4 bit quantization? | How to convert the MLP in MoE to 4 bit quantization?
I'm doing some research about the information encoding with LLMs and need to find a way to quantize the weights of the MLP layers(MoE) to 4 bits and even customized mixed precision. Consider
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesC... | https://stackoverflow.com/questions/79910052/how-to-convert-the-mlp-in-moe-to-4-bit-quantization | pytorch, huggingface-transformers, quantization | 1,773,844,697 |
se_79892291 | stackoverflow | MACHINE_LEARNING | ModelCheckpoint not saving last validating checkpoint when save_last=True | ModelCheckpoint not saving last validating checkpoint when save_last=True
I am using pytorch lightning to train my model, here I use the lightning callback ModelCheckpoint, with the following settings:
ModelCheckpoint(
dirpath="path/to/dir",
monitor="val_loss",
mode="min",
filename="best_model",
sa... | https://stackoverflow.com/questions/79892291/modelcheckpoint-not-saving-last-validating-checkpoint-when-save-last-true | python, machine-learning, pytorch, pytorch-lightning | 1,771,512,631 |
se_79908211 | stackoverflow | MACHINE_LEARNING | Is there a way to prioritise --index-url but still look at other places in pip install / download? | Is there a way to prioritise --index-url but still look at other places in pip install / download?
I want to setup to use only CPU (saves e.g. space) and for a package it's described in e.g. How to install torch without nvidia? pip install p --index-url https://download.pytorch.org/whl/cpu. Now I have a project with l... | https://stackoverflow.com/questions/79908211/is-there-a-way-to-prioritise-index-url-but-still-look-at-other-places-in-pip-i | python, pip, pytorch | 1,773,632,653 |
se_61244613 | stackoverflow | MACHINE_LEARNING | RuntimeError: CUDA out of memory. Tried to allocate 2.86 GiB (GPU 0; 10.92 GiB total capacity;...9.06 GiB reserved in total by PyTorch) | RuntimeError: CUDA out of memory. Tried to allocate 2.86 GiB (GPU 0; 10.92 GiB total capacity;...9.06 GiB reserved in total by PyTorch)
What does it mean by 9.06 GiB reserved in total by PyTorch.
If i use a GPU of smaller size 7.80 GiB total capacity for the same script, it says 6.20 GiB reserved in total by PyTorch
... | https://stackoverflow.com/questions/61244613/runtimeerror-cuda-out-of-memory-tried-to-allocate-2-86-gib-gpu-0-10-92-gib-t | pytorch, gpu, nvidia | 1,587,021,219 |
se_57942507 | stackoverflow | MACHINE_LEARNING | How to save GPU memory usage in PyTorch | How to save GPU memory usage in PyTorch
In PyTorch I wrote a very simple CNN discriminator and trained it. Now I need to deploy it to make predictions. But the target machine has a small GPU memory and got out of memory error. So I think that I can set requires_grad = False to prevent PyTorch from storing the gradient... | https://stackoverflow.com/questions/57942507/how-to-save-gpu-memory-usage-in-pytorch | out-of-memory, pytorch | 1,568,537,189 |
se_79906686 | stackoverflow | MACHINE_LEARNING | Can half-precision fp16 can transfer hyperparameter that tuned to fp32 directly or not? | Can half-precision fp16 can transfer hyperparameter that tuned to fp32 directly or not?
I use google colab to train my model
I have trained the model on fp32 and use random grid to search the hyperparameter. the training phase is slow; it takes around 3.24it/s.
I want to ask can I use the tuned hyperparameter from fp1... | https://stackoverflow.com/questions/79906686/can-half-precision-fp16-can-transfer-hyperparameter-that-tuned-to-fp32-directly | machine-learning, pytorch, artificial-intelligence, hyperparameters, automatic-mixed-precision | 1,773,382,684 |
se_79033052 | stackoverflow | MACHINE_LEARNING | Can't load my YOLOv8n model, trained on custom dataset | Can't load my YOLOv8n model, trained on custom dataset
I use Ultralytics YOLOv8 with the model, trained on custom dataset, and run the following python code:
import cv2
from ultralytics import YOLO
model = YOLO("/home/github/ultralytics/ultralytics/runs/detect/train3/weights/best.pt")
and get this error:
require... | https://stackoverflow.com/questions/79033052/cant-load-my-yolov8n-model-trained-on-custom-dataset | python, pytorch, yolov8 | 1,727,475,882 |
se_79905540 | stackoverflow | MACHINE_LEARNING | Optimizing a Gaussian penalty function for HSL color compatibility in PyTorch/NumPy | Optimizing a Gaussian penalty function for HSL color compatibility in PyTorch/NumPy
I am currently developing an AI-driven fashion recommendation system, specifically focusing on a "Multi-modal Context-Aware Decision Model." A critical component of my recommendation engine involves calculating aesthetic compatibility ... | https://stackoverflow.com/questions/79905540/optimizing-a-gaussian-penalty-function-for-hsl-color-compatibility-in-pytorch-nu | python, algorithm, numpy, pytorch, artificial-intelligence | 1,773,245,496 |
se_79889838 | stackoverflow | MACHINE_LEARNING | What does it mean that Pytorch's torch.mul is "unbound"? | What does it mean that Pytorch's torch.mul is "unbound"?
Running help(torch.Tensor.mul) gives:
Help on method_descriptor:
mul(...) unbound torch._C.TensorBase method
mul(value) -> Tensor
See :func:`torch.mul`.
What does unbound mean in this context? Version info:
python: 3.12.6
torch: 2.8.0+... | https://stackoverflow.com/questions/79889838/what-does-it-mean-that-pytorchs-torch-mul-is-unbound | python, python-3.x, pytorch, unbound | 1,771,181,048 |
se_76838254 | stackoverflow | MACHINE_LEARNING | An example of how pytorch clip_grad_norm_ works | An example of how pytorch clip_grad_norm_ works
I'd like to see a simple example to illustrate how gradient clipping via clip_grad_norm_ works. From this post, I found that if the norm of a gradient is greater than a threshold, then it simply takes the unit vector of the gradient and multiplies it with the threshold. ... | https://stackoverflow.com/questions/76838254/an-example-of-how-pytorch-clip-grad-norm-works | pytorch, gradient, gradient-exploding | 1,691,172,290 |
se_75738722 | stackoverflow | MACHINE_LEARNING | onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT | onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT
I tried to convert a torch model to onnx and got this error:
raise errors.UnsupportedOperatorError(
torch.onnx.errors.UnsupportedOperatorError: ONNX export failed on an operator with unrecognized namespace 'torch_sca... | https://stackoverflow.com/questions/75738722/onnxruntime-capi-onnxruntime-pybind11-state-invalidargument-onnxruntimeerror | python, pytorch, torch, onnx, torch-scatter | 1,678,830,702 |
se_52145992 | stackoverflow | MACHINE_LEARNING | How do we analyse a loss vs epochs graph? | How do we analyse a loss vs epochs graph?
I'm training a language model and the loss vs epochs is plotted each time of training. I'm attaching two samples from it.
Obviously, the second one is showing better performance. But, from these graphs, when do we take a decision to stop training (early stopping)?
Can w... | https://stackoverflow.com/questions/52145992/how-do-we-analyse-a-loss-vs-epochs-graph | machine-learning, nlp, lstm, pytorch, recurrent-neural-network | 1,535,963,680 |
se_79893338 | stackoverflow | MACHINE_LEARNING | Problem of freeze metrics after first epoch | Problem of freeze metrics after first epoch
I encountered a problem with metrics fading after the first training epoch. During the first epoch, the model training proceeds normally. The loss metrics decrease, and the accuracy increases. The accuracy reaches 20% for training and 6% for validation. After that, the accur... | https://stackoverflow.com/questions/79893338/problem-of-freeze-metrics-after-first-epoch | python, pytorch, conv-neural-network, conv1d | 1,771,633,988 |
se_79898374 | stackoverflow | MACHINE_LEARNING | Sentence Transformer Stuck at Loading (Google Cloud Instance) | Sentence Transformer Stuck at Loading (Google Cloud Instance)
I use this code to load sentence transformer in a GCP VM instance (no GPU). This is a dask plugin used on dask worker.:
class NLPSetup(WorkerPlugin):
def __init__(self, bucket_uri):
self.bucket_uri = bucket_uri
self.emb_model = None
... | https://stackoverflow.com/questions/79898374/sentence-transformer-stuck-at-loading-google-cloud-instance | google-cloud-platform, pytorch, nlp, dask, sentence-transformers | 1,772,276,652 |
se_79896938 | stackoverflow | MACHINE_LEARNING | Is clothing-invariant person recognition possible using still images only? | Is clothing-invariant person recognition possible using still images only?
I am working on a person recognition system for learning purposes.
My goal is:
Maintain a small gallery of known people (multiple images per person)
Given a new query image, return the most similar person with a confidence score
The system s... | https://stackoverflow.com/questions/79896938/is-clothing-invariant-person-recognition-possible-using-still-images-only | python, deep-learning, pytorch, computer-vision, feature-extraction | 1,772,104,241 |
se_79885063 | stackoverflow | MACHINE_LEARNING | GluonTS DeepAREstimator fails to load checkpoint in PyTorch 2.6 | GluonTS DeepAREstimator fails to load checkpoint in PyTorch 2.6
I am currently working on a project where I have to use GluonTS (the DeepAREstimator and DLinearEstimator). At the beginning it worked well. But now, even when I use the example code from the GluonTS Website, I always get the following error message:
Trac... | https://stackoverflow.com/questions/79885063/gluonts-deeparestimator-fails-to-load-checkpoint-in-pytorch-2-6 | python, error-handling, pytorch, neural-network, gluonts | 1,770,498,481 |
se_79891066 | stackoverflow | MACHINE_LEARNING | CUDA error: CUBLAS_STATUS_INVALID_VALUE in cublasGemmEx() with PyTorch, fp16=False | CUDA error: CUBLAS_STATUS_INVALID_VALUE in cublasGemmEx() with PyTorch, fp16=False
I am using an RTX 3060 (12GB VRAM) and implementing a RAG pipeline with the BGE-M3 embedding model.
Initially, I installed PyTorch with the CUDA 12.8 wheel (my NVIDIA driver supports CUDA 12.9). However, I encountered the following erro... | https://stackoverflow.com/questions/79891066/cuda-error-cublas-status-invalid-value-in-cublasgemmex-with-pytorch-fp16-fal | python, pytorch, nvidia, rag | 1,771,348,203 |
se_79893806 | stackoverflow | MACHINE_LEARNING | Implemented PPO algorithm fails to train | Implemented PPO algorithm fails to train
I wrote a PPO-based reinforcement learning code for the Gymnasium CarRacing-v3 environment.
(The code was generated with the help of Gemini)
However, even after 200,000 frames, the training does not seem to improve.
Result:
Frame: 40000 | Mean Reward: 0.07 | Loss: 3.1248
Frame:... | https://stackoverflow.com/questions/79893806/implemented-ppo-algorithm-fails-to-train | python, machine-learning, pytorch, reinforcement-learning, gymnasium | 1,771,731,080 |
se_79584485 | stackoverflow | MACHINE_LEARNING | Unable to torch.load due to pickling/safety error | Unable to torch.load due to pickling/safety error
I am trying to use a pytorch model present on this link:
https://drive.google.com/drive/folders/121kucsuGxoYQu03-Jmy6VCDcPzqlG4cG
since it is used by this project I am trying to run:
https://github.com/amaljoseph/EndToEnd_Signature-Detection-Cleaning-Verification_Syste... | https://stackoverflow.com/questions/79584485/unable-to-torch-load-due-to-pickling-safety-error | python, numpy, pytorch, deserialization, pickle | 1,745,233,365 |
se_79778716 | stackoverflow | MACHINE_LEARNING | Getting βSizes of tensors must matchβ error when using ComfyUI WanVideoWrapper (wan2.2) to generate video | Getting βSizes of tensors must matchβ error when using ComfyUI WanVideoWrapper (wan2.2) to generate video
I am trying to generate a video using Wan 2.2. My goal is to take a motion sequence from an input video and a single reference image, and then generate a new video where the character in the reference image perfor... | https://stackoverflow.com/questions/79778716/getting-sizes-of-tensors-must-match-error-when-using-comfyui-wanvideowrapper | deep-learning, pytorch, artificial-intelligence | 1,759,208,695 |
se_72343472 | stackoverflow | MACHINE_LEARNING | How can I change my environment architecture to arm64 from x86-64? | How can I change my environment architecture to arm64 from x86-64?
I am an MacBook M1 user and I am trying to use M1 GPU (MPS) supported by Pytorch. I read that I need to make sure my system is arm64 rather than x86 so I created my env as below:
CONDA_SUBDIR=osx-arm64 conda create -n nlp2 --clone nlp
(nlp2) twan... | https://stackoverflow.com/questions/72343472/how-can-i-change-my-environment-architecture-to-arm64-from-x86-64 | python, pytorch, gpu, apple-m1, arm64 | 1,653,282,241 |
se_69742930 | stackoverflow | MACHINE_LEARNING | RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Int': Pytorch | RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Int': Pytorch
So, I was trying to code a chatbot using Pytorch following this tutorial.
Code: (Minimal, Reproducible one)
tags = []
for intent in intents['intents']:
tag = intent['tag']
tags.append(tag)
tags = ... | https://stackoverflow.com/questions/69742930/runtimeerror-nll-loss-forward-reduce-cuda-kernel-2d-index-not-implemented-for | python, pytorch, nltk | 1,635,354,992 |
se_64507404 | stackoverflow | MACHINE_LEARNING | Defining named parameters for a customized NN module in Pytorch | Defining named parameters for a customized NN module in Pytorch
This question is about how to appropriately define the parameters of a customized layer in PyTorch. I am wondering how one can make the parameter to end up being named parameter?
class My_layer(torch.nn.Module):
def __init__(self):
self.mu =... | https://stackoverflow.com/questions/64507404/defining-named-parameters-for-a-customized-nn-module-in-pytorch | parameters, module, neural-network, pytorch, customization | 1,603,487,778 |
se_79889994 | stackoverflow | MACHINE_LEARNING | PyTorch ValueError: optimizer got an empty parameter list when building a Logistic Regression Model | PyTorch ValueError: optimizer got an empty parameter list when building a Logistic Regression Model
I tried making a logistic regression model using nn.Module
class LogisticRegressionModel(nn.Module):
def __init__(self, input_dim= None) -> None:
super().__init__()
if input_dim is not None:
... | https://stackoverflow.com/questions/79889994/pytorch-valueerror-optimizer-got-an-empty-parameter-list-when-building-a-logist | python, optimization, deep-learning, pytorch, neural-network | 1,771,213,568 |
se_68356565 | stackoverflow | MACHINE_LEARNING | How to iterate through composed dataset in pytorch with no overlapped batches? | How to iterate through composed dataset in pytorch with no overlapped batches?
I am looking for a way to connect two DataSets to one, so that it can be trained in one loop. However the batches are not allowed to mix between the datasets. In the following example should only be batches in range 1 to 10 and 41 to 50:
im... | https://stackoverflow.com/questions/68356565/how-to-iterate-through-composed-dataset-in-pytorch-with-no-overlapped-batches | python, pytorch, pytorch-dataloader | 1,626,151,169 |
se_78042236 | stackoverflow | MACHINE_LEARNING | Silero TTS model loading fails with ValueError: not enough values to unpack | Silero TTS model loading fails with ValueError: not enough values to unpack
This code for Silero TTS used to work before, but after creating a new folder and rewriting it, I get an error when loading the model.
Code:
import time, torch, speech_recognition as sr, sounddevice as sd, random
language = 'ru'
model_id = 'r... | https://stackoverflow.com/questions/78042236/silero-tts-model-loading-fails-with-valueerror-not-enough-values-to-unpack | python, windows, pytorch, valueerror | 1,708,616,242 |
se_79888711 | stackoverflow | MACHINE_LEARNING | why can't I pass input and target tensors directly to nn.CrossEntropyLoss? | why can't I pass input and target tensors directly to nn.CrossEntropyLoss?
on Python 3.13, torch 2.10.0+cu130
import torch
loss = nn.CrossEntropyLoss()
loss(torch.tensor((.1, .2)), torch.tensor((.3, .4)))
returns -
tensor(0.4811)
but why does
nn.CrossEntropyLoss(torch.tensor((.1, .2)), torch.tensor((.3, .4)))
ret... | https://stackoverflow.com/questions/79888711/why-cant-i-pass-input-and-target-tensors-directly-to-nn-crossentropyloss | python, pytorch | 1,770,981,998 |
se_75517324 | stackoverflow | MACHINE_LEARNING | RuntimeError: Inference tensors cannot be saved for backward. To work around you can make a clone to get a normal tensor and use it in autograd | RuntimeError: Inference tensors cannot be saved for backward. To work around you can make a clone to get a normal tensor and use it in autograd
when: the program start the next epoch after validation
How to modify or set for this? | https://stackoverflow.com/questions/75517324/runtimeerror-inference-tensors-cannot-be-saved-for-backward-to-work-around-you | pytorch | 1,676,963,977 |
se_79887750 | stackoverflow | MACHINE_LEARNING | Why does BatchNorm1d fail with batch size 1 in training mode? | Why does BatchNorm1d fail with batch size 1 in training mode?
I am training a small PyTorch model and want to use nn.BatchNorm1d.
When the batch size is 1 and the model is in training mode, I get the error below;
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 20])
impor... | https://stackoverflow.com/questions/79887750/why-does-batchnorm1d-fail-with-batch-size-1-in-training-mode | python, deep-learning, pytorch, neural-network, batch-normalization | 1,770,847,520 |
se_79885047 | stackoverflow | MACHINE_LEARNING | "from torch_geometric.data import Data" throwing an error | "from torch_geometric.data import Data" throwing an error
If I run a py module with only these imports (no additional code) it works fine and the output is Process finished with exit code 0:
import torch.utils.data
from torch.utils.data.dataloader import default_collate
But if I add this third import:
impor... | https://stackoverflow.com/questions/79885047/from-torch-geometric-data-import-data-throwing-an-error | python, pytorch | 1,770,495,952 |
se_54374935 | stackoverflow | MACHINE_LEARNING | How can I fix this strange error: "RuntimeError: CUDA error: out of memory"? | How can I fix this strange error: "RuntimeError: CUDA error: out of memory"?
I successfully trained the network but got this error during validation:
RuntimeError: CUDA error: out of memory | https://stackoverflow.com/questions/54374935/how-can-i-fix-this-strange-error-runtimeerror-cuda-error-out-of-memory | python, pytorch | 1,548,466,786 |
se_59722983 | stackoverflow | MACHINE_LEARNING | How to calculate geometric mean in a differentiable way? | How to calculate geometric mean in a differentiable way?
How to calculate goemetric mean along a dimension using Pytorch? Some numbers can be negative. The function must be differentiable. | https://stackoverflow.com/questions/59722983/how-to-calculate-geometric-mean-in-a-differentiable-way | pytorch | 1,578,943,730 |
se_79886152 | stackoverflow | MACHINE_LEARNING | Trained and loaded CycleGAN model is giving distorted output images | Trained and loaded CycleGAN model is giving distorted output images
I trained a CycleGAN model on Google Colab using this repository - https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix
The model should enhance dark images. I tested the model on my test dataset within Google Colab using the test.py script from th... | https://stackoverflow.com/questions/79886152/trained-and-loaded-cyclegan-model-is-giving-distorted-output-images | python, deep-learning, pytorch, generative-adversarial-network | 1,770,669,271 |
se_78863577 | stackoverflow | MACHINE_LEARNING | How to install PyTorch and run .pt file in Raspberry Pi 4 B? | How to install PyTorch and run .pt file in Raspberry Pi 4 B?
So i am trying to implement my yolov5 object detection model "best.pt" which i trained in custom roboflow collab notebook file which i have already downloaded in my desktop since it is where i trained it. Now im trying to pass the .pt file using different me... | https://stackoverflow.com/questions/78863577/how-to-install-pytorch-and-run-pt-file-in-raspberry-pi-4-b | python, pytorch, torch, raspberry-pi4 | 1,723,496,308 |
se_79876043 | stackoverflow | MACHINE_LEARNING | Docker load fails with wrong diff id calculated on extraction for large CUDA/PyTorch image (Ubuntu 22.04 + CUDA 12.8 + PyTorch 2.8) | Docker load fails with wrong diff id calculated on extraction for large CUDA/PyTorch image (Ubuntu 22.04 + CUDA 12.8 + PyTorch 2.8)
About
I am trying to create a Docker image with the same Dockerfile with Python 3.10, CUDA 12.8, and PyTorch 2.8 that is portable between two machines:
Local Machine: NVIDIA RTX 5070 (Bla... | https://stackoverflow.com/questions/79876043/docker-load-fails-with-wrong-diff-id-calculated-on-extraction-for-large-cuda-pyt | python, docker, pytorch | 1,769,392,763 |
se_79884369 | stackoverflow | MACHINE_LEARNING | post training quantized model gets the error "Copying from quantized Tensor to non-quantized Tensor is not allowed" even though I'm not copying tensor | post training quantized model gets the error "Copying from quantized Tensor to non-quantized Tensor is not allowed" even though I'm not copying tensor
I got a pretrained resnet 18 model from this lane detection repo in order to use it as an ADAS(advanced driver assistance systems) function for an electri... | https://stackoverflow.com/questions/79884369/post-training-quantized-model-gets-the-error-copying-from-quantized-tensor-to-n | python, pytorch, tensor, torchvision, quantization | 1,770,386,549 |
se_79883792 | stackoverflow | MACHINE_LEARNING | How to properly handle LSTM states during training with SliceSampler in TorchRL? | How to properly handle LSTM states during training with SliceSampler in TorchRL?
I am implementing a Reinforcement Learning environment using torchrl where the agent uses an LSTM-based policy. My goal is to train the agent on sequences sampled from a replay buffer. While I have the components working, I am unsure how ... | https://stackoverflow.com/questions/79883792/how-to-properly-handle-lstm-states-during-training-with-slicesampler-in-torchrl | python, pytorch | 1,770,316,989 |
se_74212925 | stackoverflow | MACHINE_LEARNING | Does checkpointing with torch.save fail with hugging face -- if not what is the right way to checkpoint and load a hugging face (HF) model? | Does checkpointing with torch.save fail with hugging face -- if not what is the right way to checkpoint and load a hugging face (HF) model?
Does torch.save work on hugging face models (I am using vit)? I assumed yes.
My error:
File "/home/miranda9/miniconda3/envs/metalearning_gpu/lib/python3.9/site-packages/torch/se... | https://stackoverflow.com/questions/74212925/does-checkpointing-with-torch-save-fail-with-hugging-face-if-not-what-is-the | python, pytorch, huggingface-transformers, huggingface-tokenizers, huggingface | 1,666,810,596 |
se_79882282 | stackoverflow | MACHINE_LEARNING | Why does .view() fail after permuting dimensions for a GRU? | Why does .view() fail after permuting dimensions for a GRU?
I'm trying to train a character-level GRU on Linux kernel source but the training loop keeps crashing with this error:
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces... | https://stackoverflow.com/questions/79882282/why-does-view-fail-after-permuting-dimensions-for-a-gru | python, pytorch | 1,770,152,624 |
se_79881685 | stackoverflow | MACHINE_LEARNING | PyTorch and NVIdia Flare is taking all computing resource on machine learning experiments | PyTorch and NVIdia Flare is taking all computing resource on machine learning experiments
I am utilizing PyTorch for federated experiments. As my experiments involves 50 datasets with models, so, I have to run multiple ML models experiments parallelly.
The code for training ML model is shared here:
def train(dataloade... | https://stackoverflow.com/questions/79881685/pytorch-and-nvidia-flare-is-taking-all-computing-resource-on-machine-learning-ex | python, numpy, pytorch, cpu, federated-learning | 1,770,100,366 |
se_79878442 | stackoverflow | MACHINE_LEARNING | torch dataloader next-method when using multiple workers | torch dataloader next-method when using multiple workers
I have a Dataset that is based on IterableDataSet, looking like that
class MyDataSet(torch.utils.data.IterableDataset):
def __init__(self):
# doing init stuff here
def __iter__(self):
# infinite loop here, creating random pictures
... | https://stackoverflow.com/questions/79878442/torch-dataloader-next-method-when-using-multiple-workers | python, pytorch, multiprocessing, dataloader | 1,769,666,810 |
se_78097861 | stackoverflow | MACHINE_LEARNING | How to solve RuntimeError: Couldn't find appropriate backend to handle uri in python | How to solve RuntimeError: Couldn't find appropriate backend to handle uri in python
I want to work with audiofiles in pytorch.
If I try running this line: metadata = torchaudio.info(SAMPLE_WAV_PATH) i get the error message RuntimeError: Couldn't find appropriate backend to handle uri _assets\steam.wav and format ... | https://stackoverflow.com/questions/78097861/how-to-solve-runtimeerror-couldnt-find-appropriate-backend-to-handle-uri-in-py | python, pytorch, torchaudio | 1,709,497,840 |
se_79851886 | stackoverflow | MACHINE_LEARNING | DiffProtect: How to fix "No module named 'numpy.lib.function_base'" when loading PyTorch Lightning model from 2023 checkpoint in Google Colab? | DiffProtect: How to fix "No module named 'numpy.lib.function_base'" when loading PyTorch Lightning model from 2023 checkpoint in Google Colab?
I'm trying to load a pre-trained PyTorch Lightning model from the DiffProtect repository (published in 2023) in Google Colab, but I'm encountering a numpy com... | https://stackoverflow.com/questions/79851886/diffprotect-how-to-fix-no-module-named-numpy-lib-function-base-when-loading | python, pytorch, google-colaboratory, pytorch-lightning | 1,766,251,249 |
se_79878226 | stackoverflow | MACHINE_LEARNING | Why do we use requires_grad=True in the input here? | Why do we use requires_grad=True in the input here?
# Example of target with class indices
loss = nn.CrossEntropyLoss()
input = torch.randn(3, 5, requires_grad=True) <=============== WHY ?
target = torch.empty(3, dtype=torch.long).random_(5)
output = loss(input, target)
output.backward()
This code block is taken from... | https://stackoverflow.com/questions/79878226/why-do-we-use-requires-grad-true-in-the-input-here | pytorch | 1,769,626,984 |
se_66588715 | stackoverflow | MACHINE_LEARNING | RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED using pytorch | RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED using pytorch
I am trying to run a simple pytorch sample code. It's works fine using CPU. But when using GPU, i get this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/torch/n... | https://stackoverflow.com/questions/66588715/runtimeerror-cudnn-error-cudnn-status-not-initialized-using-pytorch | python, pytorch, gpu | 1,615,488,621 |
se_79875563 | stackoverflow | MACHINE_LEARNING | Memory access fault by GPU node-1 (Agent handle: 0x26f5dbf0) on address 0x7749d0333000. Reason: Write access to a read-only page | Memory access fault by GPU node-1 (Agent handle: 0x26f5dbf0) on address 0x7749d0333000. Reason: Write access to a read-only page
I am currently on a project to segment 3D-LSM images using self-supervised model and i have been trying to perform a dryrun(testing pre-training) on the AMD GPU droplet on digitalocean. the ... | https://stackoverflow.com/questions/79875563/memory-access-fault-by-gpu-node-1-agent-handle-0x26f5dbf0-on-address-0x7749d0 | pytorch, digital-ocean, jupyter-lab, amd-gpu, amd-rocm | 1,769,326,314 |
se_79875321 | stackoverflow | MACHINE_LEARNING | Why does PyTorch GPU matmul give correct results without torch.cuda.synchronize()? | Why does PyTorch GPU matmul give correct results without torch.cuda.synchronize()?
I'm learning GPU programming with PyTorch and I'm confused about when torch.cuda.synchronize() is actually necessary.
I have this code that compares CPU and GPU matrix multiplication:
import torch
import time
size = 5000
# CPU computa... | https://stackoverflow.com/questions/79875321/why-does-pytorch-gpu-matmul-give-correct-results-without-torch-cuda-synchronize | python, pytorch | 1,769,276,043 |
se_79653147 | stackoverflow | MACHINE_LEARNING | pip does not find new version of torch | pip does not find new version of torch
I have a Mac M1 laptop, where I have conda env with python=3.9.21, and pip=25.1.1.
Currently I have torch=2.2.0 and I wanted to update it to the latest version, but when I tried pip install -U torch it shows that I have the latest version, and trying pip install -U torch==2.7.0 e... | https://stackoverflow.com/questions/79653147/pip-does-not-find-new-version-of-torch | python, macos, pytorch, pip | 1,749,053,751 |
se_73327048 | stackoverflow | MACHINE_LEARNING | Memory access fault by GPU node-4 (Agent handle: 0x5618a9f81270) on address 0x7fd1000e5000. Reason: Page not present or supervisor privilege | Memory access fault by GPU node-4 (Agent handle: 0x5618a9f81270) on address 0x7fd1000e5000. Reason: Page not present or supervisor privilege
I am getting this error trying to run pytorch using rocm on a Radeon VII. I am trying to run disco-diffusion | https://stackoverflow.com/questions/73327048/memory-access-fault-by-gpu-node-4-agent-handle-0x5618a9f81270-on-address-0x7f | pytorch, amd-rocm | 1,660,253,169 |
se_79872212 | stackoverflow | MACHINE_LEARNING | torch.matmul(S, v) where S is symmetric and v is a vector: how to speed up computations? | torch.matmul(S, v) where S is symmetric and v is a vector: how to speed up computations?
Let S be a nxn symmetric matrix and v a n 1-dimensional vector.
We need to compute inside a pytorch loss function the vector (S x v) in an efficient manner.
Do you know if there is a way to keep tensors grads and use a fast and sp... | https://stackoverflow.com/questions/79872212/torch-matmuls-v-where-s-is-symmetric-and-v-is-a-vector-how-to-speed-up-compu | python, pytorch, matrix-multiplication | 1,768,929,906 |
se_76014621 | stackoverflow | MACHINE_LEARNING | Converting an ONNX model to PyTorch with the onnx2pytorch library gives huge differences | Converting an ONNX model to PyTorch with the onnx2pytorch library gives huge differences
I have found an ONNX model (already trained) for pupil identification in eye images, which works very well. But I would like to use it as a PyTorch model, so I am trying to convert it from ONNX to PyTorch.
As displayed in the foll... | https://stackoverflow.com/questions/76014621/converting-an-onnx-model-to-pytorch-with-the-onnx2pytorch-library-gives-huge-dif | pytorch, conv-neural-network, onnx | 1,681,471,591 |
se_79825818 | stackoverflow | MACHINE_LEARNING | PyTorch fails on Windows Server 2019: βError loading c10.dllβ (works fine on Windows 10) | PyTorch fails on Windows Server 2019: βError loading c10.dllβ (works fine on Windows 10)
I'm trying to deploy a Python project on Windows Server 2019, but PyTorch fails to import with a DLL loading error.
On my local machine (Windows 10, same Python version), everything works perfectly.
Environment
Working machine
Wi... | https://stackoverflow.com/questions/79825818/pytorch-fails-on-windows-server-2019-error-loading-c10-dll-works-fine-on-win | python, pytorch, windows-server-2019 | 1,763,661,580 |
se_67570573 | stackoverflow | MACHINE_LEARNING | After installing Pytorch cuda , torch.cuda.is_available() show false. What to do? | After installing Pytorch cuda , torch.cuda.is_available() show false. What to do?
I have installed pytorch cuda by running this command:
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia
My cuda version is 11.2 . I am using windows 10 .
Pytorch cuda 11.2 is not available right now . (... | https://stackoverflow.com/questions/67570573/after-installing-pytorch-cuda-torch-cuda-is-available-show-false-what-to-do | python, anaconda, pytorch | 1,621,257,789 |
se_55717751 | stackoverflow | MACHINE_LEARNING | Torch.cuda.is_available() keeps switching to False | Torch.cuda.is_available() keeps switching to False
I have tried several solutions that hinted at what to do when the CUDA GPU is available and CUDA is installed but the Torch.cuda.is_available() returns False. They did help but only temporarily, meaning torch.cuda.is_available() reported True but after some time, it s... | https://stackoverflow.com/questions/55717751/torch-cuda-is-available-keeps-switching-to-false | pytorch | 1,555,456,192 |
se_71689095 | stackoverflow | MACHINE_LEARNING | How to solve the pytorch RuntimeError: Numpy is not available without upgrading numpy to the latest version because of other dependencies | How to solve the pytorch RuntimeError: Numpy is not available without upgrading numpy to the latest version because of other dependencies
I am running a simple CNN using Pytorch for some audio classification on my Raspberry Pi 4 on Python 3.9.2 (64-bit). For the audio manipulation needed I am using librosa. librosa de... | https://stackoverflow.com/questions/71689095/how-to-solve-the-pytorch-runtimeerror-numpy-is-not-available-without-upgrading | python, python-3.x, numpy, pytorch, librosa | 1,648,714,296 |
se_79856726 | stackoverflow | MACHINE_LEARNING | Why does this PyTorch model produce non-identical outputs on identical inputs even with fixed random seeds? | Why does this PyTorch model produce non-identical outputs on identical inputs even with fixed random seeds?
I am running inference on a trained PyTorch model using the same input tensor, fixed random seeds, and evaluation mode enabled.
import torch
torch.manual_seed(42)
torch.cuda.manual_seed_all(42)
model.eval()
Des... | https://stackoverflow.com/questions/79856726/why-does-this-pytorch-model-produce-non-identical-outputs-on-identical-inputs-ev | machine-learning, pytorch, neural-network, floating-point | 1,767,005,814 |
se_79868995 | stackoverflow | MACHINE_LEARNING | Proper utilization of sliding window inferer | Proper utilization of sliding window inferer
I am training an Encoder-Decoder network to reconstruct brain CT images. Due to OOM (Out of Memory) errors with full-sized images, I implemented a sliding window approach for training and inference.
While the model is training, the final reconstructed full image looks like ... | https://stackoverflow.com/questions/79868995/proper-utilization-of-sliding-window-inferer | pytorch, medical-imaging, encoder-decoder | 1,768,520,152 |
se_59149725 | stackoverflow | MACHINE_LEARNING | How can I save model weights to mlflow tracking sever using pytorch-lightning? | How can I save model weights to mlflow tracking sever using pytorch-lightning?
I would like to save model weights to mlflow tracking using pytorch-lightning.
pytorch-lightning supports logging.
However, it seems that saving model weights as a artifact on mlflow is not supported.
At first, I planed to override ModelCh... | https://stackoverflow.com/questions/59149725/how-can-i-save-model-weights-to-mlflow-tracking-sever-using-pytorch-lightning | pytorch | 1,575,343,245 |
se_79868216 | stackoverflow | MACHINE_LEARNING | PyTorch: trying to create a joint dataset with different transforms results in both datasets having same transform | PyTorch: trying to create a joint dataset with different transforms results in both datasets having same transform
I'm very new to PyTorch and am attempting to create a dataset for which a given sample has both unmasked and masked data associated with it, or in other words, the first piece of data is just the original... | https://stackoverflow.com/questions/79868216/pytorch-trying-to-create-a-joint-dataset-with-different-transforms-results-in-b | python, pytorch | 1,768,447,072 |
se_79847329 | stackoverflow | MACHINE_LEARNING | Custom GRPO Trainer not Learning | Custom GRPO Trainer not Learning
I am new to reinforcement learning. So, as an educational exercise, I am implementing the GRPO from scratch with PyTorch. My goal is mimic how TRL works, but boil it down to just the loss function and training loop (more or less), and replicate the simple example where they optimize fo... | https://stackoverflow.com/questions/79847329/custom-grpo-trainer-not-learning | pytorch, artificial-intelligence, huggingface-transformers, reinforcement-learning | 1,765,760,861 |
se_79866124 | stackoverflow | MACHINE_LEARNING | How can the backward function in tensor influence the matrix in model | How can the backward function in tensor influence the matrix in model
class SoftmaxRegission(torch.nn.Module):
linear: torch.nn.Linear
def __init__(self, num_features: int, num_classes: int):
super(SoftmaxRegission, self).__init__()
self.linear = torch.nn.Linear(num_features, num_classes)
... | https://stackoverflow.com/questions/79866124/how-can-the-backward-function-in-tensor-influence-the-matrix-in-model | python, pytorch | 1,768,221,050 |
se_77855742 | stackoverflow | MACHINE_LEARNING | How to convert safetensors model to onnx model? | How to convert safetensors model to onnx model?
I want to convert a model.safetensors to ONNX, unfortunately I haven't found enough information about the procedure. The documentation of safetensors package isn't enough and actually is not clear even how to get the original (pytorch in my case) model, since when I try ... | https://stackoverflow.com/questions/77855742/how-to-convert-safetensors-model-to-onnx-model | python, pytorch, onnx, huggingface, safe-tensors | 1,705,855,665 |
se_75633662 | stackoverflow | MACHINE_LEARNING | How do you load a specific GPU from CUDA_AVAILABLE_DEVICES in PyTorch? | How do you load a specific GPU from CUDA_AVAILABLE_DEVICES in PyTorch?
I came up with this code but it's resulting in never ending bugs:
def get_device_via_env_variables(deterministic: bool = False, verbose: bool = True) -> torch.device:
device: torch.device = torch.device("cpu")
if torch.cuda.is_available():
... | https://stackoverflow.com/questions/75633662/how-do-you-load-a-specific-gpu-from-cuda-available-devices-in-pytorch | python, machine-learning, deep-learning, pytorch | 1,677,904,437 |
se_78721195 | stackoverflow | MACHINE_LEARNING | AttributeError: `np.string_` was removed in the NumPy 2.0 release. Use `np.bytes_` instead.. Did you mean: 'strings'? | AttributeError: `np.string_` was removed in the NumPy 2.0 release. Use `np.bytes_` instead.. Did you mean: 'strings'?
I m interested in seeing neural network as graph using tensorboard. I have constructed a network in pytorch with following code-
import torch
BATCH_SIZE = 16
DIM_IN = 1000
HIDDEN_SIZE = 100
DIM... | https://stackoverflow.com/questions/78721195/attributeerror-np-string-was-removed-in-the-numpy-2-0-release-use-np-bytes | python, numpy, pytorch, tensorboard | 1,720,446,262 |
se_79863744 | stackoverflow | MACHINE_LEARNING | Difference between torch.nn.Module and torch.Tensor? | Difference between torch.nn.Module and torch.Tensor?
Iβm learning PyTorch and I see two common classes: torch.Tensor and torch.nn.Module. Iβm a bit confused about their differences and when to use each.
Hereβs what I understand so far:
torch.Tensor represents data, usually a multi-dimensional array, and supports oper... | https://stackoverflow.com/questions/79863744/difference-between-torch-nn-module-and-torch-tensor | python, machine-learning, pytorch | 1,767,905,698 |
se_79081885 | stackoverflow | MACHINE_LEARNING | Unable to install Torch using pip | Unable to install Torch using pip
I using Windows
I installed Python 3.13
I am trying to pip install torch
However, when attempting to do so, I encounter this error.
F:\Kit>pip install torch
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found... | https://stackoverflow.com/questions/79081885/unable-to-install-torch-using-pip | python, pytorch, pip | 1,728,765,434 |
se_79864557 | stackoverflow | MACHINE_LEARNING | In PyTorch how do I perform bf16 or f16 matmul with accumulation in f32 explicitly? | In PyTorch how do I perform bf16 or f16 matmul with accumulation in f32 explicitly?
I need fast compute but the resulting sums need higher precision for downstream tasks just for one specific op out of many in the model.
torch.bmm has an out_dtype parameter but the documentation does not specify its behaviour.
torch.a... | https://stackoverflow.com/questions/79864557/in-pytorch-how-do-i-perform-bf16-or-f16-matmul-with-accumulation-in-f32-explicit | pytorch, half-precision-float | 1,767,981,616 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.