23,953 questions
0
votes
2
answers
52
views
pytorch Module B=A, A.to('cpu'), but the tensor in B is still in GPU, why?
After converting module A to CPU, the origin parameter tensor still stays on the GPU? When it is released? Is it wrong if I reuse the parameter?
My code:
import torch.nn as nn
class A(nn.Module):
...
1
vote
1
answer
74
views
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.
...
Advice
0
votes
2
replies
42
views
Fixing a UNET in pytorch that doesn't work in eval mode due to BatchNorm2d layers
I have a UNET model trained in pytorch (by someone else) that produces quite different results in eval mode to train mode (train mode results look good, eval mode they are rubbish). A bit of googling ...
0
votes
0
answers
79
views
My SimSiam is collapsing- SimSiam on CUB-200-2011 with ViT
I'm trying to implement SimSiam using a ViT backbone on the CUB-200-2011 dataset. However, during training, the embeddings collapse to a single direction despite using stop-gradient. Here’s what I ...
0
votes
1
answer
60
views
Is passing ray resources as options when calling the function equivalent to setting them in the function's decorator?
Is
@ray.remote
def run_experiment(...):
(...)
if __name__ == '__main__':
ray.init()
exp_config = sys.argv[1]
params_tuples, num_cpus, num_gpus = load_exp_config(exp_config)
ray.get(...
0
votes
0
answers
29
views
Where is EXECUTORCH_LIBRARY defined in ExecuTorch v1.0?
I’m trying to register a custom operator for ExecuTorch (v1.0, built from the PyTorch 2.5 source tree).
My goal is to create a shared library that defines a few quantum operators and runs them from a ....
1
vote
1
answer
109
views
How to configure uv via pyproject.toml to lock PyTorch (+cu118) to a custom index and prevent uv run from using the CPU-only version?
I am managing a project with uv (v0.9.4) that requires a specific PyTorch CUDA build. The generic installation works, but using uv run causes a package conflict, despite the environment being correct.
...
0
votes
1
answer
26
views
How can I get torch.set_grad_enabled(True) to work in ComfyUI?
I just spent hours figuring out that the following code fails when included in a ComfyUI custom node, but works perfectly fine outside (using the same Python venv). I finally found out that someone ...
1
vote
0
answers
66
views
Should I use torch.inference_mode() in a prediction method even when using model.eval()? [duplicate]
I'm following the book "Deep Learning with PyTorch Step By Step" and I have a question about the predict method in the StepByStep class (from this repository: GitHub).
The current ...
Advice
2
votes
0
replies
77
views
How should I balance DSA, ML fundamentals, PyTorch implementation, and Kaggle practice for ML Engineer interviews?
I’m a Computer Science graduate preparing for ML/AI Engineer roles.
I’m facing a dilemma about what to focus on, how much to allocate time to each area, and what exact roadmap to follow to prepare ...
2
votes
2
answers
91
views
Decoder only model AI making repetitive responses
I am making a Decoder only transformer using Pytorch and my dataset of choice is the fullEnglish dataset from kaggle Plaintext Wikipedia (full English).
The problem is that my model output is ...
2
votes
1
answer
35
views
AttributeError: 'NoneType' object has no attribute 'blocks' when running Cache-DiT example with Wan2.2 model
I’m trying to use
Cache-DiT
to accelerate inference for the Wan2.2 model.
However, when I run the example script,
python run_wan_2.2_i2v.py --steps 28 --cache
I get the following error.
Namespace(...
2
votes
0
answers
54
views
Having problems computing PDE Residuals
I'm computing PDE residuals for The_Well datasets (e.g. turbulent_radiative_layer_2D and shear_flow) using finite differences, but the residuals are much larger than I expect. The data are generated ...
1
vote
1
answer
98
views
Can uv integrate with e.g. pytorch prebuilt docker env?
So, pytorch requires a rather large bundle of packages. The prebuilt docker pytorch gpu images (https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/running.html) are quite helpful in ...
0
votes
0
answers
90
views
ModuleNotFoundError: No module named 'losses.loss'; 'losses' is not a package error when training MAT model (PyTorch, NVIDIA repo)
I'm trying to fine-tune the MAT (Masked Attention Transformer) model from the official repository:
https://github.com/fenglinglwb/MAT
However, I keep getting the following error during training:
...
0
votes
0
answers
87
views
Torch example transformer with TransformerDecoder
In the torch example provided here https://github.com/pytorch/examples/tree/main/word_language_model, tansformer only uses torch.TransformerEncoder and torch.TransformerDecoder is overwritten with a ...
0
votes
0
answers
70
views
Torchvision save segmentation masks to png
There is a tutorial i try to follow https://docs.pytorch.org/tutorials/intermediate/torchvision_tutorial.html
working with .png files as segmentation masks.
The png files can be found here:
https://...
1
vote
0
answers
68
views
How to pass P_map: dict[str, torch.Tensor] to PEFT (LoRA)?
My proxy goal is to change LoRA from h = (W +BA)x to h = (W + BAP)x. Preliminary code attached for your reference
My actual goal is to train a model with the following loss: 〖Θ ̃=(arg min)┬Δ ̂ 〗〖‖𝑓_(...
0
votes
0
answers
47
views
How do I create a multitask GPyTorch model with a user-specified noise covariance matrix?
I've implemented standard homoskedastic multitask Gaussian process regression using GPyTorch as follows:
class MyModel(gpytorch.models.ExactGP):
def __init__(self, X, Y, likelihood):
super(...
3
votes
1
answer
73
views
Matching PyTorch and ONNX outputs layer-wise for debugging inference drift
I want to debug layer-by-layer to see where the ONNX model starts deviating from the PyTorch model outputs.
I can extract intermediate outputs in PyTorch using forward hooks, like:
def get_activation(...
0
votes
0
answers
37
views
Required support for Detectron2 to ONNX conversion
Currently I am working on Object Detection model. I have trained a model, want to convert to ONNX format for real time inference and deploy in the field but I am unable to determine how to convert to ...
1
vote
0
answers
106
views
Struggling to run a ONNX model in rust
I'm trying to run a ONNX model, using the rust crate ort
The model I'm trying to use is braai/RMBG-1.4
Below is the code I'm using. Apologies in advance for the variable names
let mut model = ...
0
votes
2
answers
825
views
Python 3.13 cuda Pytorch 2.8 support
I am trying to use Torch to find my GPU for machine learning/training.
Right now, my code is using the CPU for training, which will take a long time with the large amounts of data I have.
import torch
...
3
votes
2
answers
186
views
Multimodal embedding requires video first, then image - why?
I am working with OmniEmbed model (https://huggingface.co/Tevatron/OmniEmbed-v0.1), which is built on Qwen2.5 7B. My goal is to get a multimodal embedding for images and videos. I have the following ...
0
votes
1
answer
122
views
Preventing GPU memory leak due to a custom neural network layer
I am using the MixStyle methodology for domain adaptation, and it involves using a custom layer that is inserted after every encoder stage. However, it is causing VRAM to grow linearly, which causes ...