What does model.eval() do in pytorch?
When should I use .eval() ? I understand it is supposed to allow me to "evaluate my model". How do I turn it back off for training? Example training code using .eval() .
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
When should I use .eval() ? I understand it is supposed to allow me to "evaluate my model". How do I turn it back off for training? Example training code using .eval() .
I am trying to initialize a tensor on Google Colab with GPU enabled. device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') t = torch.tensor([1,2], device=device) But I am getting this strange error. RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors might be asynchronously reported at some other API call,so the stacktra
The torch.profiler.profile context manager provides detailed operator-level latency and memory consumption data via Kineto integration. While the profiler includes a schedule configuration to mitigate initial warmup overhead, the measurement accuracy for extremely small, high-frequency operators remains a concern. When capturing traces for models with many l
In PyTorch Distributed Data Parallel (DDP), the find_unused_parameters flag is used to handle models where some parameters do not contribute to the loss in every forward pass. When enabled, DDP must traverse the autograd graph to identify these unused parameters and exclude them from the all-reduce synchronization process. While this ensures correctness for
I'm trying to run Pytorch on a laptop that I have. It's an older model but it does have an Nvidia graphics card. I realize it is probably not going to be sufficient for real machine learning but I am trying to do it so I can learn the process of getting CUDA installed. I have followed the steps on the installation guide for Ubuntu 18.04 (my specific distribu
Goal: obtain identical interpolation outputs from torch.nn.functional.interpolate with mode='bilinear' and the default align_corners=None when running the same model on CPU and CUDA devices. Constraint: the default value leaves the interpolation kernel unspecified, causing the CPU and CUDA backends to use different resampling schemes, which produces non‑iden
Gradient Accumulation Behavior PyTorch supports simulating larger batch sizes by summing gradients over multiple forward and backward passes before executing an optimizer step. This technique is intended to keep memory consumption proportional to the micro-batch size rather than the effective total batch size. While the .grad attribute accumulates values acr
Goal: assess whether the forkserver start method can be employed with PyTorch DataLoader workers to avoid per‑worker CUDA context re‑initialization while maintaining safe GPU usage in distributed training. Constraints: the official documentation warns that fork‑ing a process holding CUDA resources is unsafe, and there is no stable API for forkserver in PyTor
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://download.pytorch.org/whl/torch_stable.html But I get: >>> import torch >>> torch.cuda.is_available() False