user_q stringlengths 3 20 | question stringlengths 20 31k | user_a stringclasses 5
values | answer stringlengths 18 302 |
|---|---|---|---|
kendal | I had to download new version of pytorch because of the Slurm server’s limitation.Then I planed to use dassl to train a model, but got warning “UserWarning: The verbose parameter is deprecated” and it seems that the config VERBOSE have been deprecated in recent versions of Pytorch.I’m a rookie of coding in Machine Lear... | ptrblck | Thank you!
It seems the verbose argument is directly passed to all learning rate schedulers as seen e.g.here. I don’t know if dassl is still maintained, but you could create an issue in their GitHub repo or submit a fix. |
Zhewen_Hu | I’m currently training multiple small models across several CUDA streams to achieve parallelism with Libtorch. However, each kernel execution is very short (lasting only a few microseconds) and scattered across the timeline, which means they rarely overlap or parallelize effectively. I’ve attached a screenshot showing ... | ptrblck | No, I don’t think torch.compile or any of its stack is exposed as a pure C++ API. You could try to torch.export your model as describedhere. |
Shinnosuke_Uesaka | Hi! I have two tensors:tensor_a([batch_size, seq_len_a, embedding_dim])tensor_b([batch_size, seq_len_b, embedding_dim])The total sequence length isseq_len_total = seq_len_a + seq_len_b. I also have a boolean tensormask([batch_size, seq_len_total]) whereTruecorresponds to positions fortensor_aandFalsecorresponds to posi... | ptrblck | I’m unsure if I understand your use case correctly, but direct indexing with the mask should work:
batch_size, seq_len_a, seq_len_b, embedding_dim = 2, 3, 4, 5
a = torch.ones(batch_size, seq_len_a, embedding_dim)
b = torch.ones(batch_size, seq_len_b, embedding_dim) * 2
# create mask
mask = torch.… |
Sebastien_Maraux | Hello,I am building and training a model with a nn parameter set at init with a tensor, which matches a PCA Lowrank output :self.PCA_matrix_V_Inv = torch.nn.Parameter(PCAMatrix.clone().transpose(0,1), requires_grad=False)I do mention requires_grad=False, but torch info summary displays that this parameter count as trai... | ptrblck | The requires_grad attribute can easily be changed by calling .requires_grad_(True) on the parent module which is why I guess it’s returned as a trainable parameter:
class MyModel(nn.Module):
def __init__(self):
super().__init__()
self.param = nn.Parameter(torch.randn(1), require… |
sim | I am tracing a model to export it to c++ via the command:torch.jit.trace(model.eval(), example_inp).Does the tracing done as above still work if I include in the forward pass of the model something like the following code snippet?def forward(self,x):if self.eval:return x + 5else:return xOr I have to go through annotati... | ptrblck | The traced model would take the else path even if you want to switch back to training mode:
class MyModel(nn.Module):
def __init__(self):
super().__init__()
def forward(self,x):
if self.training:
return x
else:
return x + 5
x = torch.one… |
shaoyu_young | Hi, guys.I want to know how to collect all theoperatorsof torch (torch.nn.Conv2d,torch.clamp, etc.)NOT include other APIs liketorch.utils.model_zoo.load_urlThx in advance | ptrblck | @Chilleecreated this figure inthis post, but I’m unsure if the scripts to create the data are available. |
sgolodetz | Performing the same 32-bit floating-point sums in PyTorch and NumPy gives me noticeably different results in some cases (both yield the same results in 64-bit). The difference in results between 64-bit and 32-bit is expected, as are differences between some of the other sums, but the difference betweentorch.sum(xs_f_32... | ptrblck | Yes, since different algorithms could be used leading to a different expected error compared to a wider dtype. |
Michael_Zakhary | Hello, just wanted to ask what is the correct order to call loss.item() and loss.backward(). I read a forum post saying that if you call item() after backward() execution is slower, however I also read that if you use .item() before backward() then the gradient does not flow. Can someone help me find a concrete answer ... | ptrblck | Most likely the order won’t matter.
Calling item() on a CUDATensor will synchronize your code and will thus potentially slow it down (e.g. if it wasn’t synchronized before anyway). I wouldn’t expect to see a large difference in speed if you synchronize the code before or after the backward call.
C… |
Rajatavaa | Training code``import osimport torchfrom Prepro import Data_origimport torch.nn as nnimport torch.nn.functional as Ffrom sklearn.model_selection import train_test_splitdevice = torch.device(“cuda” if torch.cuda.is_available() else “cpu”)print(“Using device:”, device)class RNNModel(nn.Module):definit(self, vocab_size, n... | ptrblck | Your code is unfortunately not properly formatted, but I assume you are using separate files for the training and sampling.
It then seems that running python sampling.py is again training the model instead of executing the sample_and_infer function as you would expect?
If that’s the case, use if … |
Thomas_J | Context: Learning pytorch, I’m trying to predict the next character given the past 1 character (Shakespeare input). ; I’m aware that there are smarter ways to predict things but this is a good toy example to learn the ins and outs of pytorch.At first, there is just 1 embedding layer (number of chars as input, number o... | ptrblck | Yes, since indexing and torch.cat are differentiable operations. |
Rebantadey | Hi, I am facing an issue with my code.RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [16, 64, 128]], which is output 0 of AddBackward0, is at version 6; expected version 5 instead. Hint: the backtrace further above shows the operatio... | ptrblck | If e.g. self.norm1/2 need the original input tensor x for the gradient computation your code will manipulate x inplace and thus disallowing the right gradient computation raising the error. |
emerth | I am reasonably knowledgeable with Caffe and pretty strong with Python and C++, but a fair newbie to PyTorch. I have questions about performance - and expected performance - of different hardware while training networks like ResNet34 using PyTorch. Is there a forum where the focus is on hardware for PyTorch and tuning ... | ptrblck | You can just ask here.
To your question about performance of different devices: profile your workload to isolate where the bottleneck if your code is. E.g. if all use cases are CPU-limited, a better GPU will hardly improve the end2end performance. |
Ram5 | Hi Team,Does pytorch use 2.X.0a0 type of version suffixes?Is nightly build suffices X.Y.0.devdate > X.Y.0a0 ?Does custom pytorch build versions use .0a0 type of suffices | ptrblck | The versions are created according toPEP 440. |
Aakira | Hi, I have node with 2 gpu on it, assume that I have a following code :from torch.nn.parallel import DistributedDataParallel as DDP
import torch.distributed as dist
from torch.utils.data.distributed import DistributedSampler
dist.init_process_group("nccl")
local_rank = int(os.environ["LOCAL_RANK"])
global_rank = int(... | ptrblck | The GPU won’t run a process but processes can use GPUs.
The standard approach for DDP is to use a single GPU per process, but there are other use cases where multiple GPUs are used in a single process (e.g. think about naive pipeline parallel approaches).
You could try to make a single GPU visibl… |
seraj | I am working on parallelizing my training using DP, however within a single instance (with 4 GPUs) it it not working when selecting more than 1 GPUs. Following is my code snippet:def main():
# Set CUDA_VISIBLE_DEVICES to limit the GPUs used
if args.num_of_gpu > 0:
os.environ["CUDA_VISIBL... | ptrblck | Thanks for the code! Your code works fine for me:
if __name__=="__main__":
model = UNet(n_channels=3,n_classes=1)
model = nn.DataParallel(model).cuda()
x = torch.randn(128,3, 10, 10).cuda()
out = model(x)
print(out.shape)
and the proper output shape is shown without any errors … |
Ajaikrish | Is there an built-in weighted loss function for regression tasks? If there are third party weighted loss functions, please let me know.I am trying to use Weighted Mean Absolute Error for Unet for semantic segmentation. I need to assign weights so that my model ignores background and focuses on poorly predicted regions... | ptrblck | You might want to normalize the loss e.g. by dividing by the weights.sum() as otherwise the target distribution (the frequency of 0s and 1s) would influence the loss scale. |
janssenn | Hi,i want to calculate a jacobian of an linear layer using torch.func.jacrev(). Unfortunately when doing so i get the warning shown in my minimal example below. Why does this warning occur? When I use it in my main code the runtime of different code blocks changes.import torch
dummy = torch.tensor(1.0).cuda() # dummy ... | ptrblck | PyTorch uses a separate thread in the backward pass. If no other CUDA operation was used before the cuBLAS call, the warning will be raised as we will set the primary context to the current one. |
Rahul_Raman | Provided 3 tensors A, B, C of shape (N, N) on CUDA device, I have a simple function which doesA * B + CTo understand torch.compile I have tried to run and profile this code with and without torch.compileWithout torch.compile, the code runs as expected, i.e. there are 2 kernel launches one for element-wise addition (tem... | ptrblck | Return the output as otherwise torch.compile might be smart enough to eliminate dead code.
Adding return D I see:
------------------------------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ ------------ ------------ ------------ -… |
Qmin-Lee | class RNN(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(RNN, self).__init__()
self.hidden_size = hidden_size
self.i2h = nn.Linear(input_size, hidden_size)
self.h2h = nn.Linear(hidden_size, hidden_size)
self.h2o = nn.Linear(hidden_size, output_s... | ptrblck | Yes, since you are assigning the output to itself:
self.hidden = differentiable_operations(self.hidden)
Yes, but their result is not assigned to themselves (which also wouldn’t make sense assuming these are layers, not state tensors such as self.hidden).
Their parameters are used in the comput… |
fengpings | I tried to convert a Conv3d to Conv2d by splitting 3D kernels by the temporal axis, but outputs from the two differ:I expect output1 and output2 should be the same. Any details I’ve overlooked?code:t = torch.randn(1, 1, 4, 4, dtype=torch.float32)
conv3d = torch.nn.Conv3d(out_channels=1, in_channels=1, kernel_size=(2,2,... | ptrblck | Your image is not displayed for me, but keep in mind that small numerical mismatches would be expected if different kernels are selected for the different workloads.
Thus check the .abs().max() error in your comparison instead of assuming equal results. |
Rebantadey | I am facing an issue where my training loop suddenly freezes after certain epoch, when my dataset is large. I am currently training a model using the BYOL strategy, when I am running a test run with smaller dataset (6 datapoints), the training loop freezes after 6th epoch and continues after sometime, but when I use th... | ptrblck | Could you remove the usage of tqdm as well as the profiling to check if the memory increase could be related to these packages? |
Butanium | mwe:a = th.randn(16, 8, 1024, 1024, dtype=th.float16, device="cuda") # switch to bfloat fails
b = th.randn(16, 8, 1024, 256, dtype=th.float16, device="cuda") # switch to bfloat fails
c = a @ b
print(c.shape)
CUDA error: CUBLAS_STATUS_NOT_SUPPORTED when calling `cublasGemmStridedBatchedEx(handle, opa, opb, (int)m, (in... | ptrblck | Yes, maybe fallback kernels are used for specific shapes. However, since the support was added for Ampere and later devices, don’t depend on it for Maxwell or any other generation before Ampere. |
shaoyu_young | Hi, guys!I know I can track every official release version of pytorch here (Releases · pytorch/pytorch · GitHub)But if I want to know the nightly version is doing (e.g., what new features are added, what bugs are fixed). I mean is there any doc of these things?Thx in advance! | ptrblck | No, release notes are not created daily, but you can use torch.version.git_version to check the commit the nightly is based on and check the commit history onGitHub. |
dsp_torch | Hello Everyone,I am using a time-series data for binary class classification. I have a training dataset of 4917 x 244 where 244 are the feature columns and 4917 are the onsets. For example if I am using a sliding window of 2048 then it calculates 1 x 244 feature vector for one window. Therefore we have such 4917 windo... | ptrblck | Thanks for the update.
I assume the preprocessing is already done and your X_train/test as well as y_train/test datasets are already created.
If I understand your question correctly you now want to pass this data (from the DataLoader) into a 1d-CNN.
nn.Conv1d layers expect a 3D input in the shape… |
aerialmyth | I am trying to load and run themeta-llama/Meta-Llama-3-8Bon a 16 GB Nvidia RTX 4060 Ti.I am using the followingBitsAndBytesConfigto load the model in 4-bit and usetorch.bfloat16for compute.bnb_config = BitsAndBytesConfig(
# load_in_8bit=True,
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_q... | ptrblck | Besides the model parameters and buffers, the model execution will also use memory to store intermediate forward activations needed to compute the gradients. You could use e.g.this until.to estimate the memory usage.
If you don’t want to compute the gradients at all, you should wrap the forward p… |
songsong0425 | Hi, I think it is too minor problem, but I want to notify a typo in the CUDA error message.image1176×67 5.21 KBAs you can see, I found thatcapacitywas misspelled ascapacty.Can anyone notice it to the corresponding administrator?Thank you. | ptrblck | This was already fixed a year ago inthis PR. You might want to update PyTorch to see the fixed error message. |
lazysloth | Hi,I would like to apply the code below to nn.Embedding.However, the forward function still calls the original nn.Embedding forward, instead of calling the one I created.I would appreciate your help. Could you tell me why the model behaves like this?class Linear(nn.Linear):
def __init__(self, in_features, out_feat... | ptrblck | The code works for me and calls the custom forward:
class Embedding(nn.Embedding):
def __init__(self, num_embeddings, embedding_dim):
super(Embedding, self).__init__(num_embeddings, embedding_dim)
self.weight.fast = None
def forward(self, user_id):
print("c… |
J_Nic | Hello there!For a ongoing research project, we are utilizing a NF-ResNet 26 model and training it to classify two outcomes (yes/no). We’d like to follow this approach: Take a fraction of the dataset (1%-10%), and train each fraction for a number of 50 epochs. Afterwards the model is tested on the whole validation datas... | ptrblck | Yes, this is the case as long as you don’t recreate the model or re-initialize its parameters explicitly. |
YM2132 | Hello,The following code:class mod_demod(nn.Module):
def __init__(self, latent_dim, out_channels):
super().__init__()
self.map_layer = EqualLRLinear(latent_dim, out_channels)
self.bias = nn.Parameter(torch.zeros(1, out_channels, 1, 1))
self.out_channels = out_channels
def f... | ptrblck | I’m not familiar with your code but note that in_channels=256 in Conv2d_mod while the actual input uses only 128 channels. Using:
conv2d_mod = Conv2d_mod(256, 256//2, 3, 256)
x = torch.randn(4, 256, 128, 128)
w = torch.randn(4, 256)
out = conv2d_mod(x, w)
fixes the shape mismatch. |
ilykuleshov | The title says it all. Zero-division in pytorch returns NaNs, while mathematically it should return infinity. In certain cases,torch.infwould convert to normal values further on (e.g.exp(-torch.inf),1/torch.inf, etc.), while NaNs on the other hand propagate endlessly, messing up model gradients. Pytorch functions alrea... | ptrblck | Additionally to@Soumya_Kundu’s recommendation I also see that Inf is returned:
x = torch.tensor(1.)
y = torch.tensor(0.)
print(x / y)
# tensor(inf) |
jkdev | I have the following toy code:testx = torch.tensor([[1.0, 2.0, 3.0]], requires_grad=True)testw = torch.tensor([[0.1, 0.2, 0.3]], requires_grad=True)testb = torch.tensor([0.5], requires_grad=True)testy = F.linear(testx, testw, bias=testb)print([a.requires_grad for a in [testx, testw, testb, testy]])When I run it standal... | ptrblck | You might have disabled gradient computation globally, e.g. via:
torch.set_grad_enabled(False)
testx = torch.tensor([[1.0, 2.0, 3.0]], requires_grad=True)
testw = torch.tensor([[0.1, 0.2, 0.3]], requires_grad=True)
testb = torch.tensor([0.5], requires_grad=True)
testy = F.linear(testx, testw, bias=… |
SorenSc | Givenimport torch
import torch.nn as nn
nof_samples = 1
nof_features = 2
input = torch.rand(nof_samples, nof_features)I have two feature networks (one for each feature), which look like this:feature_networks = nn.ModuleList()
for _ in range(nof_features):
feature_networks.append(
nn.Sequential(
... | ptrblck | Yes, your approach seems to be valid based on this quick check by loading the trainable parameters:
import torch
import torch.nn as nn
nof_samples = 1
nof_features = 2
input = torch.rand(nof_samples, nof_features)
bias = True
feature_networks = nn.ModuleList()
for _ in range(nof_features):
f… |
rahul_ol | I am trying to run the following repository for text detection:CRAFT-pytorch text detectionThe requirements include PyTorch=1.9 which I am trying to install in a conda environment this is resulting in errors since 1.9 install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.My current GPU is A100-SXM4-40GB with CUDA ... | ptrblck | I would recommend updating PyTorch to a recent release which ships with CUDA 12.4 runtime dependencies. Did you try updating and if so did you see any issues in your code? |
Vinicius_Moreira | I’m working on a PyTorch model that involves a double loop for calculations. The problem is that I’m getting an error related to in-place operations when I try to perform backpropagation.Here’s a simplified example of my code:import torch
length = 1000
dx = 100
num_rows = 5
num_cols = int(length / dx) + 1
C = torch.r... | ptrblck | You could try to work around this issue by cloning the termX tensors:
for j in range(1, num_cols):
for n in range(1, num_rows):
term1 = C2[n] * qprop[n-1, j-1].clone()
term2 = C1[n] * qprop[n, j-1].clone()
term3 = C0[n] * qprop[n-1, j].clone()
qprop[n, j] = term… |
liampour | Hello guysI am using this example,import torch
import os
from PIL import Image
import random
list_file='C/.../file_names.txt' #A txt's files path that contains the names of the images Dataset
raw_dir='C/.../DirImageA' # the path of the folder where the A type images of the dataset are located
expert_dir='... | ptrblck | Transform the images to tensors first e.g. via:
image = PIL.Image.open("image.jpeg")
torch.stack([image, image])
# TypeError: expected Tensor as element 0 in argument 0, but got JpegImageFile
x = transforms.ToTensor()(image)
y = torch.stack([x, x])
print(y.shape)
# torch.Size([2, 3, 800, 800]) |
joohyunglee | Thank you much ahead… | ptrblck | Yes, it does:
x = torch.randn(2, 2, requires_grad=True)
out = torch.rot90(x)
out.grad_fn
# <Rot90Backward0 at 0x7f21c7f4e110>
out.mean().backward()
print(x.grad)
# tensor([[0.2500, 0.2500],
# [0.2500, 0.2500]]) |
Toby-Kang | Hi, I wonder if it is possible to backpropagate with noise. For example, I may have a network look like this:class ThreeLayerNetwork(nn.Module):
def __init__(self):
super(ThreeLayerNetwork, self).__init__()
self.fc1 = nn.Linear(1, 2)
self.fc2 = nn.Linear(2, 1)
def forward(self, ... | ptrblck | You could usetorch.nn.Module.register_full_backward_hookto access the gradients and manipulate the input_grad before returning it. |
kad | I noticed that I can’t set thetrainingproperty toFalsefor modules that I have compiled, regardless of the state of the property when the module was compiled.Is this expected behaviour?A demo:import torch
import torch.nn as nn
print(torch.__version__)
class M(nn.Module):
def __init__(self):
super().__init_... | ptrblck | This is a known issue trackedhere. |
TeDataPro | Dear all,I am working with TransformerEncoder module. I understood the “mask” parameter from the forward function can be a boolean tensor whereTrueindicates that it is forbidden to attend the token andFalseis the inverse.In my case, I am working with sequence-to-sequece mask. Initially, I was converting my mask to floa... | ptrblck | You might run intothis limitationdisallowing the fast path if floating point masks are used. |
whoab | I am curious how Pytorch sequences together modules.The application is, suppose I have a module structure A->B->C->D-E.Then, I want to inject new modules A->B->G->H->C->D->E in the middle.In general, I want to take any existing module and splice new modules into it.I know I can replace modules by modifying the attribut... | ptrblck | It depends on the model implementation and while simple models can be created using an nn.Sequential container, the majority of the models use custom nn.Modules defining the forward pass in their forward method as seenherefor e.g. ResNet models. |
Giuseppe_Sarno | Hello,first of all let me say that I have seen different issues related to this problem however I cannot get it to work for my use case.I am using a resnet network with a single output and therefore trying to use BCEWithLogitsLoss for binary classification (1 or 0). This is some code snippets:THE LOSS FUNCTION...
loss_... | ptrblck | You are right and I misread the weight argument as pos_weight.
Based on thedocsthe weight will rescale the loss of each batch element and should thus have the same shape as the batch size.
Unsure, but you might want to use pos_weight instead which is used to balance e.g. an class imbalance in th… |
marcpg | Hi all,I am training a model (~25M params) which takes ~1day to train on the full dataset. In my attempt to reduce the training time I am testing half precision. In using half precision, it allowed me to double the batch size, yet the overall training time remains the same.I was under the impression that doubling the b... | ptrblck | Yes, this is correct as bfloat16 is supported on Ampere and newer devices. Older devices could emulate it but you should not expect to see a speedup. |
arnabsinha | Hi everyone,I am trying to reproduce identical random numbers using torch.manual_seed() but it does not seem to be working. I tried the below method afte referring a few existing forum posts. Please let me know what is wrong.import torch
from torch import nn, optim
import numpy as np
device = "cuda" if torch.cuda.is_a... | ptrblck | Thanks for the model definition. Your code works as expected and returns the same random values after seeding the code:
python tmp.py
OrderedDict([('layer1.weight', tensor([[0.7645]], device='cuda:0')), ('layer1.bias', tensor([0.8300], device='cuda:0')), ('layer2.weight', tensor([[-0.2343]], device… |
vdw | After installingtorchext, I get the following error when trying to import anything from itOSError: <path>/anaconda3/envs/py311/lib/python3.11/site-packages/torchtext/lib/libtorchtext.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSsAccording this thisreport, it could be a compatibility issues. So have check t... | ptrblck | Yes, these issues are indeed usually caused by mismatched versions. Just to confirm before I try to reproduce it: are you seeing this error while simply importing torchtext? |
Samarth_Mishra | Hi,The code I’m working on randomly used to get stuck. I was able to come up with aminimal examplethat I found had similar behavior. (ran a loop of 100 runs and it got stuck at some point; In the example, I used the Office-Home dataset, but I suppose the specific dataset doesn’t matter)Here’s the stack trace when I Ctr... | ptrblck | You should see the best performance using an optimal number of workers. Increasing the number of workers beyond the number of cores might yield bad performance as explainedhere.
torch.set_num_threads should set the number of threads for intraop parallelism on the CPU, so for MKL and OpenMP etc… |
vivekjoshy | I don’t seepytorch/pytorch:2.4.1-cuda12.4-cudnn8-develimage in docker hub. I’m trying to run my pytorch lightning setup on 4 RTX 4090s.I was told RTX 4090 only supports 8.9 compute capability…is this different from cuDNN9 and cuDNN8? Can I usepytorch/pytorch:2.4.1-cuda12.4-cudnn9-develwith RTX 4090? | ptrblck | That’s wrong since compute capability 8.9 is binary compatible with 8.6 and 8.0.
Yes, the compute capability of a GPU is not directly related to cuDNN versions (the library itself needs to build their kernels for a compatible GPU architecture but cuDNN8 does not correspond to compute capability 8… |
LDN | Hi everyone! I’m trying to implement LISTA network (deepunfolded Iterative Soft Thresholding): in order to do so I implemented a custom layer and a network as follows:Custom layer:class LISTA_LAYER(nn.Module):
def __init__(self, A):
super().__init__()
# Initialization of the learnable parameters
... | ptrblck | I cannot reproduce the issue using your model definition and this minimal code snippet:
A = torch.randn(1, 1)
model = LISTA_Net(A)
x = torch.randn(1, 1)
out = model(x)
out.mean().backward()
for name, param in model.named_parameters():
print(name, param.grad.abs().sum())
# LISTA_layers.0.beta … |
raghavm1 | I had a doubt about the impact resuming fine-tuning/training from checkpoints might have.Is there anything that resets like the optimizer state, or perhaps some other parameter in the case of resuming training from a checkpoint instead of a model fine-tuning continuously without interruptions? I wanted to figure out th... | ptrblck | Resuming from a checkpoint should not break the training run and you should see the same model convergence if all states are restored. Besides restoring the state_dicts of the model and optimizer you could also check if you need to seed the code carefully to restore the data loading state as well. |
HYUL | I understand that in PyTorch, dropout is automatically disabled when not in training mode. However, I observed that changing the dropout value during inference affects the results. Are the conditions for disabling dropout only being not in training mode, or is it specifically wheneval()is activated? | ptrblck | If you don’t explicitly call model.eval() the default training mode is active, dropout thus also activated, and it’s expected to see different outputs. |
rbelew | i see this exception mentioned in some older and more exotic contexts but this is as straight-forward as it gets:import torch
for package in [torch]:
print(package.__name__, package.__version__)
tstList = [10,20,30,40,50]
tstTensor = torch.tensor(tstList)
print('tst',type(tstTensor),tstTe... | ptrblck | This error is expected since torch.long==torch.int64 corresponds to a max. value of 9223372036854775807 while your values are larger than this:
torch.iinfo(torch.long).max > 10239237003504588839
# False
Use torch.uint64 if you really need such large values:
indexedTst = [10239237003504588839, 992… |
Vinc | I am trying to implementfp16training for a VQ-GAN. The issue is:NaNsappear in the first batch when using gradient scaler. I tracked down the issue to a specificConv2dlayer. I also saved the input coming to it which can be downloaded here:drive.google.cominf.ptGoogle Drive file.Code to reproduceNaNs:from torch.nn import... | ptrblck | Are you seeing the same issue after updating PyTorch to the latest stable or nightly release? |
pryce | I’ve combed through a few forum posts on this topic, but none of the solutions I’ve seen have worked. I installed PyTorch to my environment with the following command:pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124.Output from ‘torch.__version__’:2.4.0+cpuOutput from ‘nvcc -... | ptrblck | You’ve most likely installed multiple PyTorch binaries and the CPU-only one is being picked. Uninstall all previous PyTorch installations and reinstall the latest release with CUDA only.
No, since the PyTorch binary itself shows it does not have CUDA support: 2.4.0+cpu. |
Clarence_Ng | Hi, I’m working on a stock forecasting project and trying to build a Conv1D model using residual blocks. I’m using Optuna to find the best hyperparameters and save the best model. However, I’m facing a shape/channel error when running the trial.Some printout outputUsing device: cudaprocess_conv1d - Input shape after re... | ptrblck | This definition:
self.blocks = nn.Sequential(
*[ResidualBlock(in_channels, out_channels, kernel_size, l2_lambda=l2_lambda) for _ in range(num_blocks)]
)
won’t work for multiple ResidualBlocks since each of these will expect an input with in_channels channels while the p… |
songyuc | Hi guys,I am training a model these days, and I find that there is another format of.t7for saving a model.So, I am wondering what is the difference between the.t7format and.pthformat for saving a model, and more specifically, which would be a better choice?Your answer and idea will be appreciated! | ptrblck | .t7 was used in Torch7 and is not used in PyTorch. If I’m not mistaken the file extension does not change the behavior of torch.save. |
veritas | Recent PyTorch support for FP8 in thetorch._scaled_mmhas ause_fast_accumflag that I have found to increase throughput by a noticable amount.However, even after going through the CUDA code, I was unable to find out what this option does and what potential effects it may have on the matrix multiplication outputs.May I as... | ptrblck | This flag enables CUBLASLT_MATMUL_DESC_FAST_ACCUMherewhich is defined as:
Flag for managing FP8 fast accumulation mode. When enabled, problem execution might be faster but at the cost of lower accuracy because intermediate results will not periodically be promoted to a higher precision. Default … |
abdula2523 | Hello Community.I’ve got a way different NVLink bandwidth onNVIDIA’s p2pBandwidthLatencyTestand just simple pytorch Tensor.to() microbenchmark.import torch
n_test = 50
size = 1 * 1024**3
src_stream = torch.cuda.Stream(0)
dst_stream = torch.cuda.Stream(1)
begin = [torch.cuda.Event(enable_timing=True) for _ in range(... | ptrblck | I don’t believe your code is measuring what you are expecting since just executing it on my system shows:
True True
0 1.8611069056223566e+20 GiB/s
1 2.858158028990284e+20 GiB/s
2 2.8896318645194097e+20 GiB/s
3 2.879378253393044e+20 GiB/s
4 2.88518891328474e+20 GiB/s
5 2.885281356930677e+20 GiB/s
6 … |
shaoyu_young | Hi, guys.I want to calculatehow many lines of python code (I mean the code in .py file)in a specific pytorch version.(Exclude blank lines, comments, docstrings, etc. that will not be executed)Is there any way to count easily?Thx in advance | ptrblck | You could clone the repository, filter for the needed files, and coins the lines in them as describedhere. |
Amos_Haviv_Hason | We have a cluster of GPU nodes at the university, so consequent runs are most probably executed on different nodes, but all have the same software and package versions.One of my models started to produce inconsistent results between runs after a recent change.A fix in one line finally solved the issue, but I have no id... | ptrblck | Yes, there is no guarantee to see the same random numbers between different platforms, CPUs, GPUs, etc. as described in thedocs. |
benoriol | Hello,I am profiling my training code and I’m struggling to understand the output. The different steps seem to be taking different amount of time and I am not sure why.image3082×1044 378 KBA simplified version of my code would be:with profiler.profile(activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA], ...) as p:... | ptrblck | This is expected since the item() call is synchronizing the GPU.
Yes, this seems to be the case and I would expect to see different time lines: one for the host and another one for the device.
I’m not familiar with the native PyTorch profiler visualization as I am using Nsight Systems for profil… |
Craig_Hicks | For example with a tensor[ [0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]]create a view exposing[ [0,2],[4,6],[8,10],[12,14]]Obviously this is not a reshaping with AFAIK is all you can do with view. However, it doesn’t seem like it would be impossible so I though I would ask. | ptrblck | Direct indexing should work:
x = torch.tensor([[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]])
y = x[:, ::2]
print(y)
# tensor([[ 0, 2],
# [ 4, 6],
# [ 8, 10],
# [12, 14]])
y[0, 0].fill_(100)
print(x)
# tensor([[100, 1, 2, 3],
# [ 4, 5, 6, 7],
# … |
Lue-C | I am using a laptop with two GPUs. The first one is a Intel(R) UHD Graphics and the second one is a NVIDIA GeForce RTX 4090 Laptop GPU. I want to run a RAG application using a llama3 model using the second GPU. When I run it, the model is loaded into memory. Afterwards the second GPU is used only until the streaming of... | ptrblck | I doubt it as your Intel UHD Graphics seems to be an integrated GPU, which does not support CUDA (and I don’t know if any other Intel backends are supported on it).
Make sure to check the compute tab in your Task Manager or use nvidia-smi to see the utilization of your GPU. |
EarlyBird | Hello all,When I run the tutorial code>https://pytorch.org/tutorials/beginner/nn_tutorial.htmlthe cell for “pickel.load” causes an error:After my mac loaded the file and uncompressed it automatically, I compressed it back in Terminal with gzip. Still causes the error.How can I fix it?RegardsSven | ptrblck | No, I doubt it as it’s working fine for me using torch==2.4.0 and a recent nightly binary:
from pathlib import Path
import requests
DATA_PATH = Path("data_lala")
PATH = DATA_PATH / "mnist"
PATH.mkdir(parents=True, exist_ok=True)
URL = "https://github.com/pytorch/tutorials/raw/main/_static/"
FIL… |
Nima_Chelongar | hi guys.i want to train LSTM network for filling a form using a given text.now when i turn my inputs and labels to tokens, i have something like:tensor([[ 0, 15, 14, ..., 0, 0, 0],
[ 0, 15, 14, ..., 0, 0, 0],
[ 0, 15, 14, ..., 0, 0, 0],
...,
[ 0, 15, 14, ..., 0, 0, 0],
... | ptrblck | Assuming you want to classify each token in a sentence, the model outputs should have the shape [batch_size, nb_classes, seq_len]. |
Codenamics | HeyCan I ask if this is the correct way to assigned weights for unbalanced dataset?my class weights are{0: 1.94, 1: 0.67}criterion = torch.nn.BCEWithLogitsLoss(pos_weight = torch.FloatTensor([1.94 / 0.67]).to(device))above is correct? | ptrblck | Yes, thedocsare also giving the example:
For example, if a dataset contains 100 positive and 300 negative examples of a single class, then pos_weight for the class should be equal to 300/100=3. The loss would act as if the dataset contains 3×100=300 positive examples. |
EarlyBird | There is a Cuda driver at NVIDIA available for MAC.Is there any support for pytorch on MAC for Cuda?My MAC:Power Book 15"OSX 10.15.7 | ptrblck | No, since macOS support was dropped in CUDA 11.0. |
trns1997 | The opencv and torch problem continues to persist with the libtorch that comes torch installed via pip. I use conan as my package manager for most packages, so naturally i install opencv via conan. But when i try to link both torch installed via pip (cmake … -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=python3 -c 'im... | ptrblck | The wheels support manylinux based on CentOS7 as describedhereand thus are build without the CXX11 ABI. Since CentOS7 is EOL already, future releases could relax the requirement and use the CXX11 ABI. |
Amal1 | I’m trying to get cuda working on Nvidia Jetson AGX Xavier with PyTorch but torch.cuda.is_available() keeps returning false. I have installed Cuda 11.4 along with the standard Jetpack (v5.1.3-b29) installation. I have also installed Python 3.9, PyTorch 2.0.1 compiled with Cuda 11.8 and TorchVision 0.15.I would apprecia... | ptrblck | Did you install the PyTorch binaries fromhereor somewhere else? |
JosephSav | Hi,I’m currently trying to implement a simple SGD without using a built in optimizer.What I’m running into is that after the first mini-batch, my loss loses its requires_grad status, and thus throws an error.Here is my code:import numpy as np
import torch
def generate_data():
data = torch.rand(1000, 2)
label = ((d... | ptrblck | Since you are already using deprecated Variable objects you could also use the internal .data attribute, but note that I would strongly recommend updating your code and to use supported approaches. |
Bodo | I created model to do custom edge detection and the forward pass works fine and produces the right result.However training does not work because the gradients of the parameters can not be computed. I made a minimal reproducer below, which throws the error. I think the issue here is that my output tensor has no gradient... | ptrblck | Good catch! Indeed, replacing the tensor with constants won’t work. The threshold is not usefully differentiable since its gradient would be zeros everywhere and undefined or Inf at the rounding points.This postmight be useful. |
727948828 | The code is as follows. I have hidden some irrelevant code. When training with DDP, I printed the network parameters of different ranks in the same iteration. The update results of the model parameters on each GPU were different. Strangely, I only found this problem after upgrading from torch1.13.1 to torch2.0.1. I am ... | ptrblck | Yes, this is a common reason since calling internal modules will skip the distributed logic. Call the model directly via output = model(input) and check the parameters again. |
YuA | HiI am currently using bfloat16 for inference and the model seems to be performing well (with torch.amp.autocast).Is it a common practice to use reduce precision for inference as well as for training? I am not confident enough because most articles about reduced precision are focusing on training. | ptrblck | Yes, lower dtypes can be used for inference, too. |
JimW | In my project, I used nn.KLDiv(A.log(), B) to calculate the KL divergence between A and B.But now I have to rewrite this part as numpy or other general python libraries in order to some model conversion.I did a lot of search on google, and tried the following implementations:(1) First method
def KL(a, b):
a = np.a... | ptrblck | Using the formula from thedocs, I get the same results (up to floating point precision):
def KL(a, b):
return b * (np.log(b) - a)
kl_loss = nn.KLDivLoss(reduction="batchmean")
# input should be a distribution in the log space
input = F.log_softmax(torch.randn(3, 5, requires_grad=True), dim=1)… |
mahmoodn | Hi,I am running many difficulties while installing from source and most of them are about incompatible libraries.The question is what is the correct version of PyTorch, TorchVision and CUDA 12.2? | ptrblck | You could check the commits from successfully built nightly binaries as discussed inthis topic. Generally, staying close to the same commit dates should also work. I.e. I usually pull all repositories after each other and haven’t seen a lot of issues in source building due to torch being incompatib… |
asor-1 | I have tried to uninstall Pytorch and reinstall it. I have uninstalled cuda and reinstalled it and nothing has worked for me. I have provided the error. What am I doing wrong.(myenv) PS C:\Users\adida\Desktop\OpenMind_bot> python flask_app.pyTraceback (most recent call last):File “C:\Users\adida\Desktop\OpenMind_bot\fl... | ptrblck | This topicmight be relevant. |
h_jie | During the process of attempting to extract table lines (which I divided into horizontal and vertical lines), I found that when I used CrossEntropyLoss, the loss value remained at a constant level without changing. However, when I used BCELoss, the loss gradually decreased with each iteration.For example:Input: (bat... | ptrblck | In this case it sounds like a multi-class segmentation use case and nn.CrossEntropyLoss would be the commonly used criterion.
The target would then contain class indices in [0, 1] and have the shape [batch_size, height, width] (note the missing class dimension) or would contain “soft” targets (i.e.… |
gragris | Hello people. Im fairly new at anything related to python. Im trying to install CUDA for my GTX 1660. I installed Cuda Toolkit 12.5 first but then i downgraded it to 12.1. I still can’t get it to work.Here is the error. You can also see the versions.image892×570 59.2 KB | ptrblck | Your don’t need to install a CUDA toolkit as the PyTorch binaries ship with their own CUDA dependencies.
As shown in your screenshot you’ve installed a CPU-only binary: 2.3.1+cpu. Install a PyTorch binary with CUDA support and it should work. |
DeraDeru | I am learning PyTorch and I want to write a custom data loader for my training. My training data is saved in to two numpy arrays. Input_images.npy and Output_images.npy. Each of them has a shape of (N,W,H,C), where N is number of samples, e.g. 2000. I have wrote the following:import torch
import numpy as np
from torc... | ptrblck | Repeatedly loading arrays in __getitem__ before indexing it is expensive and you won’t have any benefit from it, as you are already loading the entire array.
Move it to the __init__ and just index the array in the __getitem__.
Alternatively, revisit your approach and check if you can split the dat… |
TaeYeon_Lee | In pytorch,even = total_real[:, :, :, :, 0] # extract even elementsodd = total_real[:, :, :, :, 1] # extract odd elementstotal_real.shapetorch.Size([1, 1, 1023, 64, 2])even.shapetorch.Size([1, 1, 1023, 64])odd.shapetorch.Size([1, 1, 1023, 64])In C++ Torch lib,How to convert it as same ? | ptrblck | auto even = total_real.index({"...", 0});
auto odd = total_real.index({"...", 1});
should work based on thedocs. |
jfrancis79 | It seems that transforms.ToTensor ignores set_default_device.Here is an example:import torch
import torchvision.transforms as transforms
import torchvision.datasets as datasets
torch.set_default_device("cuda")
transform = transforms.ToTensor()
dataset = datasets.MNIST("~/datasets", train=True, download=False, transfo... | ptrblck | Yes, this is expected as explained in thedocs:
This doesn’t affect functions that create tensors that share the same memory as the input, like: torch.from_numpy() and torch.frombuffer() |
khaquan_sh | Hi, my team and I were working with a ViT for a project but ran into a OOM issue. We have a couple of variants of ViT:Normal ViTViT with some form of cachingThe OOM error only occurs for ViT with caching but only on model sizes larger than 200M parameters (works fine for ViT of upto 76M parameters, i.e. it works fine f... | ptrblck | Detaching the curr_cache is a good idea, but since this does not seem to fix the issue, you could check if other tensors (which are accumulated or stored in any container) have a valid .grad_fn. If so, you could also detach these (assuming they are not needed in the backward pass).
If this does not… |
qq-me | Before posting a query, check theFAQs- it might already be answered!This functiontorch._foreach_addis not mentioned anywhere, like on documentation, etc, except a few of foreach functions are mentioned in the Foreach section of this pagetorch — PyTorch 2.3 documentation, but most like_foreach_addare not mentioned there... | ptrblck | These methods are tagged as internal/private indicated by the underscore at the front of the function names, since their interface can easily change and break.
You can of course use these, but should not depend on backwards compatibility and might need to change some calls in future versions if the… |
nicaushaz | Hi there.I have implemented a sequential neural network that has an MLP feature extractor prior to the recurrent blocks. Intuitively I found out that the torch.nn.Linear can handle data of shapes (L, B, N)where L is the time-series length, B is the batch size and N is the feature shape.For instance the following block ... | ptrblck | Yes, this should be the case as seenhereandhere. |
abdulkadirkaraca | Hi. I am getting an output by using anomaly detection model which is unsupervised learning model. When I control with time.time(), model inference is looking fast, but when I would like to get image score from model output by using torch.max() or something, fps is decreasing suddenly. What is cause of that. I think thi... | ptrblck | Assuming your are using your GPU for the model execution, using host timers requires a device synchronization since CUDA operations are executed asynchronously. |
AMIRA_BEDOUI | Hello everyone,I have a question regarding backpropagation. If I have a tensorXthat I’m using for backpropagation, and there’s a constantc, if during an operation I computenp.sqrt (c) × X, will this cause any issue with the backpropagation process?Thanks in advance, | ptrblck | I assume you are wrapping this numpy * torch operation into torch.compile which will translate it to pure PyTorch ops? If so, multiplying with a constant won’t cause any issues during the backpropagation. |
Ph_m_Vi_t_Ti_n | for cat in sem_class_to_idx.keys():
if cat == '__background__':
continue
car_category = sem_class_to_idx[cat]
car_mask = output[0, :, :, :].argmax(axis=0).detach().cpu().numpy()
car_mask_uint8 = 255 * np.uint8(car_mask == car_c... | ptrblck | Unsure where and how you’ve added it, but keep in mind that cuda() and to() operations are not performed inplace on tensors. You would thus need to reassign the tensor via input_tensor = input_tensor.cuda(). |
ahmedius2 | I am trying to make the inductor backend of torchdynamo work on Jetson AGX Orin (aarch64 iGPU system). I have to use torch version 2.3, and I compiled triton v2.1 and also the main branch from the source and installed it. However, both have compatibility issues, resulting in errors like no such package found triton.com... | ptrblck | You can find the Triton commit in.ci/docker/ci_commit_pins/triton.txt. |
babak_abad | I’m new to pytorch. I tried to run this code:import torchvision.transforms
from torch.utils.data import DataLoader
import torch.utils.data.dataloader
from torch import nn
from torchsummary import summary
def train(
mdl,
train_dataloader,
valid_dataloader,
n_epoch,
opt,
... | ptrblck | MNIST is a multi-class classification dataset where each sample belongs to 1 of 10 targets.
Your model looks alright and you should use nn.NLLLoss as the criterion instead of nn.BCELoss (which is used for a binary classification or a multi-label classification where each target belongs to 0, 1, or … |
wxystudio | Hello, I know it’s because the tensors are on the different device, but I don’t know why. Here is my code:import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributions as dist
# Xavier initializer
def xavier(shape):
return torch.normal(mean=0.0, std=torch.sqrt(torch.tensor(2.0 / su... | ptrblck | You are creating new tensors in the forward which will be created on the CPU by default.
Use the .device attribute of any parameter and move the newly created tensors to this device:
def forward(self, x, sampling=True):
"""Perform the forward pass"""
if sampling:
d… |
nexync | I am training a model with DDP and found that my gradients were not being synced after loss.backward() call. After debugging, I found that the reason was because I was manually turning off the gradients of parameters I did not want updated. This somehow prevents the synchronization of the param.grad fields of parameter... | ptrblck | Run a second iteration and the code will properly fail:
[rank1]: RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection b… |
michaelala | Hey all! Let’s suppose I have a non-jagged array of scalar tensors each with gradient information (e.g. the losses of a couple of different models). Is there an intended way of aggregating these together into a single tensor without losing gradient information?Here’s a minimal example to demonstrate:import torch
x1, x2... | ptrblck | Using torch.stack or torch.cat to create a single tensor in a differentiable way is the right approach. |
AKT_TARAFDER | import torch
import torch.nn as nn
import itertools
import torch.nn.functional as F
import datetime
import argparse
import numpy as np
from torch.cuda.amp import autocast, GradScaler
x= torch.randn(5).cuda()
x=x.to(torch.float16)
print('x type: ', x.dtype)
use_fp16= True
with autocast(enabled = True, dtype=torch.f... | ptrblck | This section of the docsmight be helpful as it describes which operators are eligible. |
iftg | Does the order of with torch.no_grad(): and model.eval() matter?Let models be saved in a list model_list.for m in model_list:
m.eval()
with torch.no_grad():
netout = m(x)
print(netout)ORwith torch.no_grad():
for m in model_list:
m.eval()
netout = m(x)
print(netout)In ... | ptrblck | No, the order would not matter here and both codes should yield the same results.
Personally, I would move the no_grad() to the top to indicate that the following code won’t track any gradients. |
ThibaultDECO | I have the following code, but CUDA keeps running out of memory after a few steps (can be 3 steps, can be 50 steps). Is there something I’m doing wrong?import torch
from torch import Tensor
from torch.nn import BCELoss
from torch.optim import Optimizer
from torch.utils.data import DataLoader
def _evaluate_single_batch... | ptrblck | You could check the shape of all input batches and see if the OOM error is raised for a specifically large input. |
Abhinav_Reddy | When attempting to run a training run for a 7 billion parameter model, I receive this error:OutOfMemoryError: CUDA out of memory. Tried to allocate 344.00 MiB. GPU 0 has a total capacity of 95.00 GiB of which 238.12 MiB is free. Including non-PyTorch memory, this process has 0 bytes memory in use. Of the allocated memo... | ptrblck | No, you would need to use a custom allocator or custom memory pool as described inthis WIP PR. |
gewa24 | Hi all,I’m currently working on two models that train on separate (but related) types of data. I’d like to make a combined model that than take in an instance of each of the types of data, runs them through each of the models that was pre-trained individually, and then has a few feed-forward layers at the top that proc... | ptrblck | The logic you described seems to be reasonable.
I’m not sure I understand the issue correctly, but it seems you are not sure, how to restore the pretrained models and use them in the new model.
If that’s the case, you could instantiate both pretrained models, load the state_dicts, and pass them to… |
giorgoskeme | Hi, I am trying to build an LSTM model. I am encountering this error:File “spam_detection_LSTM_01.py”, line 131, inloss.backward()File “/gpfs/software/Anaconda/envs/pytorch-latest/lib/python3.8/site-packages/torch/_tensor.py”, line 487, in backwardtorch.autograd.backward(File “/gpfs/software/Anaconda/envs/pytorch-lates... | ptrblck | Your code works fine for me after adding the missing pieces:
class Network(nn.Module):
def __init__(self, input_size=40, hidden_size=10, num_layers=1, batch_first=True):
super(Network, self).__init__()
self.hidden_size = hidden_size
# our LSTM model
self.LSTM = n… |
alighato | I have a model that takes an input tensor , along with other inputs k and D. The model outputs several tensors, including cs_hat. When I compute gradients of cs_hat with respect to the first slice of inputs (inputs[:,:,0]), the gradient computation only succeeds if I compute it with respect to the entire tensor inputs ... | ptrblck | This is expected since slicing a tensor is a differentiable operation creating a computation graph.
In your case the output of inputs[:,:,0] was indeed never used to create cs_hat.
You could explicitly create the slice and recreate a stacked tensor passed to the model as seen here:
a = inputs[:,:… |
AfroJadocusKwak | I try training a 1D convolutional neural network, which has a bare size of about 183MB.My data are wav files, which are of ± 70KB per file. I prepare them with DataLoaders and then want to train the model as I would do for other projects.Now if I set the batch size to 64, about 4GB of my GPU memory is in use. My GPU ut... | ptrblck | I cannot reproduce any issues using your code and see:
Device used: cuda
epoch 0, loss 0.7132615447044373
epoch 1, loss 0.7382615208625793
epoch 2, loss 0.7882614731788635
epoch 3, loss 0.6882615089416504
epoch 4, loss 0.9382616877555847
epoch 5, loss 0.7382615208625793
epoch 6, loss 0.638261616230… |
lzm2256 | It seems that the iteration behavior of dataset depends on the idx variable ingetitemfunction. Is it expected or a bug?import torch
from torch.utils.data import Dataset
class MyDataset(Dataset):
def __init__(self):
self.A = torch.randn(3,4)
def __len__(self):
return 3
def __getitem__(self,... | ptrblck | Iterating a raw Dataset depends on a StopIteration signal coming from e.g. an out of bounds index. Wrap the Dataset into DataLoader or make sure a StopIteration will be raised. |
Jonathan1 | I use NVTX and Nsight when training with PyTorch and the level of detail from traces is just outstanding, those system details have beencriticalto my research. Kudos to the team on such great work!My question is, how can I reuse some of this infrastructure for a Python/CUDA project? That is, how do I get up and running... | ptrblck | CUDA kernels will be recorded by default of course, but you can add markers around calls to add more details. Your first example shows hownvFuseradds nvtx markers and you can check the code to see how the backend handles it. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.