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_79305311 | stackoverflow | MACHINE_LEARNING | Keras Attention layer not returning attention scores | Keras Attention layer not returning attention scores
I'm using keras=3.7.0 and trying to implement a custom Temporal Convolutional Attention Network (TCAN) block. While the Attention layer works in a standalone test case, I encounter an issue when integrating it into my custom model. Specifically, the error occurs whe... | https://stackoverflow.com/questions/79305311/keras-attention-layer-not-returning-attention-scores | python, tensorflow, keras, deep-learning | 1,735,034,927 |
se_79274817 | stackoverflow | MACHINE_LEARNING | ValueError: Only instances of 'keras.Layer' can be added to a Sequential model | ValueError: Only instances of 'keras.Layer' can be added to a Sequential model
ValueError: Only instances of `keras.Layer` can be added to a Sequential model.
Received: <tensorflow_hub.keras_layer.KerasLayer object at 0x7c61f819f590>
(of type <class 'tensorflow_hub.keras_layer.KerasLayer'>)
code:
import kag... | https://stackoverflow.com/questions/79274817/valueerror-only-instances-of-keras-layer-can-be-added-to-a-sequential-model | python, tensorflow, tf.keras, keras-layer, sequential | 1,734,000,800 |
se_60148001 | stackoverflow | MACHINE_LEARNING | What does Conv2D(32, (3, 3) in TensorFlow mean? | What does Conv2D(32, (3, 3) in TensorFlow mean?
On the CNN image classification example from a tensor's flow tutorial page (https://www.tensorflow.org/tutorials/images/cnn),
There is a code that goes like
model.add(layers.Conv2D(32, (3, 3), activation='relu', input_shape=(32, 32, 3)))
I understand that the image i... | https://stackoverflow.com/questions/60148001/what-does-conv2d32-3-3-in-tensorflow-mean | tensorflow, keras | 1,581,329,125 |
se_79271959 | stackoverflow | MACHINE_LEARNING | UPOS Mappings - Tensorflow Datasets TDFS | UPOS Mappings - Tensorflow Datasets TDFS
I am using the tensorflow tdfs dataset extreme/pos which I retrieve using the code below. It is annotated with universal part of speech POS labels. These are int values. Its fairly easy to map them back to their part of speech by creating my own mapping (0 = ADJ, 7 = NOUN, e... | https://stackoverflow.com/questions/79271959/upos-mappings-tensorflow-datasets-tdfs | python, tensorflow | 1,733,925,006 |
se_66513819 | stackoverflow | MACHINE_LEARNING | Obtain the output of intermediate layer (Functional API) and use it in SubClassed API | Obtain the output of intermediate layer (Functional API) and use it in SubClassed API
In the keras doc, it says that if we want to pick the intermediate layer's output of the model (sequential and functional), all we need to do as follows:
model = ... # create the original model
layer_name = 'my_layer'
intermediate_... | https://stackoverflow.com/questions/66513819/obtain-the-output-of-intermediate-layer-functional-api-and-use-it-in-subclasse | python, tensorflow, keras, deep-learning | 1,615,098,431 |
se_65153712 | stackoverflow | MACHINE_LEARNING | Cannot import tensorflow in vscode | Cannot import tensorflow in vscode
I have installed tensorflow in a virtual environment and can import Tensorflow in jupyter notebook or terminal. I am now learning to use VScode, so I try to launch it in the jupyter notebook within the VScode, but Tensorflow cannot be imported.
It shows ModuleNotFoundError: No module... | https://stackoverflow.com/questions/65153712/cannot-import-tensorflow-in-vscode | python, tensorflow, visual-studio-code | 1,607,141,508 |
se_79280552 | stackoverflow | MACHINE_LEARNING | How to use a Dense layer with an input that has a dynamically sized dimension? | How to use a Dense layer with an input that has a dynamically sized dimension?
I have a model with an input (batch of images w/ shape (height, width, time)) that has a dynamically sized dimension (time), which is only determined at runtime. However, the Dense layer requires fully defined spatial dimensions. Code snipp... | https://stackoverflow.com/questions/79280552/how-to-use-a-dense-layer-with-an-input-that-has-a-dynamically-sized-dimension | tensorflow, machine-learning, keras, neural-network, tf.keras | 1,734,175,895 |
se_79297188 | stackoverflow | MACHINE_LEARNING | How do I display the images generated by an autoencoder? | How do I display the images generated by an autoencoder?
I created an autoencoder using python, with no errors. However, I do not know the code for how do display the generated images from the autoencoder. The code of the autoencoder is shown below:
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.... | https://stackoverflow.com/questions/79297188/how-do-i-display-the-images-generated-by-an-autoencoder | python, tensorflow, machine-learning, autoencoder | 1,734,696,650 |
se_75370648 | stackoverflow | MACHINE_LEARNING | tensorflow-gpu install error T.T python:3.10 tensorflow: 2.11.0 CUDA 10.1 cuDNN 8.0.3 | tensorflow-gpu install error T.T python:3.10 tensorflow: 2.11.0 CUDA 10.1 cuDNN 8.0.3
C:\Users\CITADEL>pip install tensorflow-gpu
Collecting tensorflow-gpu
Using cached tensorflow-gpu-2.12.0.tar.gz (2.6 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: python_version>"3.7" in c:\users\citad... | https://stackoverflow.com/questions/75370648/tensorflow-gpu-install-error-t-t-python3-10-tensorflow-2-11-0-cuda-10-1-cudnn | tensorflow | 1,675,758,293 |
se_79297031 | stackoverflow | MACHINE_LEARNING | Tensorflow: Accuracy around 0.75 but loss not below 0.5 | Tensorflow: Accuracy around 0.75 but loss not below 0.5
I've implemented in Python a FCNN.
My database is made of around 5000 football matches with the following features: shots, corners, cards, fouls, big chances created, passes, cross and saves.
My outcome is binary: how wins or away wins or draws.
I am using "binar... | https://stackoverflow.com/questions/79297031/tensorflow-accuracy-around-0-75-but-loss-not-below-0-5 | python, tensorflow, loss | 1,734,693,177 |
se_77556183 | stackoverflow | MACHINE_LEARNING | TypeError: __init__() got an unexpected keyword argument 'metaclass' | TypeError: __init__() got an unexpected keyword argument 'metaclass'
When I use python 3.9 in pycharm and try to import packages, I get the error.
The problem occurs after running to the second line of code:
import tensorflow as tf
from tensorflow.keras.models import Sequential
This is the output from the con... | https://stackoverflow.com/questions/77556183/typeerror-init-got-an-unexpected-keyword-argument-metaclass | python, tensorflow, keras | 1,701,081,094 |
se_78733059 | stackoverflow | MACHINE_LEARNING | Broadcasting multiple versions of X_data that pair with the same y_data | Broadcasting multiple versions of X_data that pair with the same y_data
My deep learning architecture accepts an input vector with size 512 and an output vector with size 512 too.
The problem is I have X_data version that pairs with the same y_data.
I have these tensors:
(4, 8, 512) -> (batch_size, number of X_data ve... | https://stackoverflow.com/questions/78733059/broadcasting-multiple-versions-of-x-data-that-pair-with-the-same-y-data | python, numpy, tensorflow, keras, deep-learning | 1,720,654,708 |
se_78462277 | stackoverflow | MACHINE_LEARNING | Total params: 0 , on doing model.summary() keras | Total params: 0 , on doing model.summary() keras
model = Sequential()
model.add(Embedding(283, 100, input_length=56))
model.add(LSTM(150))
model.add(LSTM(150))
model.add(Dense(283, activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam',metrics=['accuracy'])
model.summary()
Tensorflow... | https://stackoverflow.com/questions/78462277/total-params-0-on-doing-model-summary-keras | python, tensorflow, machine-learning, keras, lstm | 1,715,370,593 |
se_55320567 | stackoverflow | MACHINE_LEARNING | Validation loss increases after 3 epochs but validation accuracy keeps increasing | Validation loss increases after 3 epochs but validation accuracy keeps increasing
Training and validation is healthy for 2 epochs but after 2-3 epochs the Val_loss keeps increasing while the Val_acc keeps increasing.
I'm trying to train a CNN model to classify a given review to a single class of 1-5. Therefore, I cons... | https://stackoverflow.com/questions/55320567/validation-loss-increases-after-3-epochs-but-validation-accuracy-keeps-increasin | python, tensorflow, deep-learning, classification, multilabel-classification | 1,553,399,364 |
se_79292180 | stackoverflow | MACHINE_LEARNING | Mismatch 'target' and 'output shape' on object detection using ssd and mobilenetv2 | Mismatch 'target' and 'output shape' on object detection using ssd and mobilenetv2
I try to train custom object detection model using ssd and mobilenetv2, though the ssd_loss functions seems mismatch the output shape of the model. how do i fix it ?
model preparation
import tensorflow as tf
from tensorf... | https://stackoverflow.com/questions/79292180/mismatch-target-and-output-shape-on-object-detection-using-ssd-and-mobilenet | tensorflow, machine-learning, classification, object-detection, mobilenet | 1,734,547,854 |
se_79295278 | stackoverflow | MACHINE_LEARNING | Error when trying to get an action from a loaded Tensorflow Policy | Error when trying to get an action from a loaded Tensorflow Policy
I get this error when trying to get an action from a Tensorflow policy that I previously trained:
ValueError: Could not find matching concrete function to call loaded from the SavedModel. Got:
Positional arguments (2 total):
* TimeStep(
{'step_ty... | https://stackoverflow.com/questions/79295278/error-when-trying-to-get-an-action-from-a-loaded-tensorflow-policy | python, tensorflow | 1,734,633,210 |
se_79293738 | stackoverflow | MACHINE_LEARNING | Excessively increased training time for multiple Keras Conv1d networks within a for loop | Excessively increased training time for multiple Keras Conv1d networks within a for loop
I am training several Keras models inside a for loop. Check the following code:
import os
import time
import pandas as pd
import tensorflow as tf
import numpy as np
import unicodedata
from keras.models import Sequential
from keras... | https://stackoverflow.com/questions/79293738/excessively-increased-training-time-for-multiple-keras-conv1d-networks-within-a | python, tensorflow, keras | 1,734,600,558 |
se_79267466 | stackoverflow | MACHINE_LEARNING | Why do I keep getting an unrecognized data type when running the fit method in this CNN code using Keras 3 API? | Why do I keep getting an unrecognized data type when running the fit method in this CNN code using Keras 3 API?
I am following an online course and running the following code in python 3.11 to build a CNN for image classification using Keras 3.6 and TensorFlow 2.18:
# Convolutional Nueral Network
import tensorflow as... | https://stackoverflow.com/questions/79267466/why-do-i-keep-getting-an-unrecognized-data-type-when-running-the-fit-method-in-t | tensorflow, keras, conv-neural-network, tensor | 1,733,818,511 |
se_40050397 | stackoverflow | MACHINE_LEARNING | Deep-Learning Nan loss reasons | Deep-Learning Nan loss reasons
What would cause a Convolutional Neural Network to diverge?
Specifics:
I am using Tensorflow's iris_training model with some of my own data and keep getting
ERROR:tensorflow:Model diverged with loss = NaN.
Traceback...
tensorflow.contrib.learn.python.learn.monitors.NanLossDuringTraining... | https://stackoverflow.com/questions/40050397/deep-learning-nan-loss-reasons | python, tensorflow, machine-learning, keras, theano | 1,476,472,038 |
se_71215965 | stackoverflow | MACHINE_LEARNING | How to save checkpoints for thie transformer gpt2 to continue training? | How to save checkpoints for thie transformer gpt2 to continue training?
I am retraining the GPT2 language model, and am following this blog :
https://towardsdatascience.com/train-gpt-2-in-your-own-language-fc6ad4d60171
Here, they have trained a network on GPT2, and I am trying to recreate a same. However, my dataset i... | https://stackoverflow.com/questions/71215965/how-to-save-checkpoints-for-thie-transformer-gpt2-to-continue-training | tensorflow, nlp, gpt-2 | 1,645,504,561 |
se_42356396 | stackoverflow | MACHINE_LEARNING | ImportError: No module named 'matplotlib' -- Using Anaconda tensorflow environment | ImportError: No module named 'matplotlib' -- Using Anaconda tensorflow environment
I'm just trying to learn Tensorflow, but am totally new to Python, so I'm using Anaconda
I created a conda environment:
$ conda create −n tensorflow python =3.5
Of course I activated my conda environment
$ source activate t... | https://stackoverflow.com/questions/42356396/importerror-no-module-named-matplotlib-using-anaconda-tensorflow-environme | python, matplotlib, tensorflow, importerror, conda | 1,487,635,640 |
se_58676082 | stackoverflow | MACHINE_LEARNING | How to make TensorFlow use 100% of GPU? | How to make TensorFlow use 100% of GPU?
I have a laptop that has an RTX 2060 GPU and I am using Keras and TF 2 to train an LSTM on it. I am also monitoring the gpu use by nvidia-smi and I noticed that the jupyter notebook and TF are using maximum 35% and usually the gpu is being used between 10-25%.
With current cond... | https://stackoverflow.com/questions/58676082/how-to-make-tensorflow-use-100-of-gpu | tensorflow, keras, deep-learning, gpu, nvidia | 1,572,736,441 |
se_64182533 | stackoverflow | MACHINE_LEARNING | Getting the error "Saver not created because there are no variables in the graph to restore" | Getting the error "Saver not created because there are no variables in the graph to restore"
I'm using this tf implementation of OpenPose model for my project.
From the models/graph/mobilenet_thin directory, I'm trying to use the graph.pb file by loading it in tensorflow with the
tf.saved_model.load() functi... | https://stackoverflow.com/questions/64182533/getting-the-error-saver-not-created-because-there-are-no-variables-in-the-graph | tensorflow, machine-learning, keras, tensorflow2.0 | 1,601,716,105 |
se_79993970 | stackoverflow | MACHINE_LEARNING | How to get medical advice model in pytorch? | How to get medical advice model in pytorch?
I am a doctor and I write 586 symptom to medicine items. and want to use pytorch to get a advice model and it will only answer questions about the 586 items.
the item is like this
if you have sweated and retch and diarrhea this is the disease A and you should take A_A but i... | https://stackoverflow.com/questions/79993970/how-to-get-medical-advice-model-in-pytorch | pytorch | 1,786,672,831 |
se_79981039 | stackoverflow | MACHINE_LEARNING | Accessing inputs to pytorch module during optimization step | Accessing inputs to pytorch module during optimization step
I'm trying to implement a custom optimization algorithm using PyTorch. The parameters that I need to optimize are located in a custom nn.Module subclass. In order for my optimizer to work, I will need access to the input vectors for each input in the batch th... | https://stackoverflow.com/questions/79981039/accessing-inputs-to-pytorch-module-during-optimization-step | pytorch, neural-network | 1,784,128,162 |
se_66807131 | stackoverflow | MACHINE_LEARNING | How to solve the famous `unhandled cuda error, NCCL version 2.7.8` error? | How to solve the famous `unhandled cuda error, NCCL version 2.7.8` error?
I've seen multiple issue about the:
RuntimeError: NCCL error in: /opt/conda/conda-bld/pytorch_1614378083779/work/torch/lib/c10d/ProcessGroupNCCL.cpp:825, unhandled cuda error, NCCL version 2.7.8
ncclUnhandledCudaError: Call to CUDA function fail... | https://stackoverflow.com/questions/66807131/how-to-solve-the-famous-unhandled-cuda-error-nccl-version-2-7-8-error | pytorch, distributed-computing, distributed-system | 1,616,704,120 |
se_67724544 | stackoverflow | MACHINE_LEARNING | RuntimeError: CUDA error: invalid device ordinal | RuntimeError: CUDA error: invalid device ordinal
When I try to run my program I get an error saying:
RuntimeError: CUDA error: invalid device ordinal
The full error is below.
I don't have much experience with this sort of thing; furthermore it's neither my own program, nor my own machine.
Based on this question on git... | https://stackoverflow.com/questions/67724544/runtimeerror-cuda-error-invalid-device-ordinal | python, pytorch | 1,622,126,693 |
se_76606392 | stackoverflow | MACHINE_LEARNING | Encountering ImportError when trying to import 'BioGptModel' from 'transformers' | Encountering ImportError when trying to import 'BioGptModel' from 'transformers'
I am working with the Transformers library in Python. My goal is to use the BioGptModel model. Here's the code I've written:
from transformers import AutoTokenizer, BioGptModel
import torch
tokenizer = AutoTokenizer.from_... | https://stackoverflow.com/questions/76606392/encountering-importerror-when-trying-to-import-biogptmodel-from-transformers | python, pytorch, importerror, transformer-model, huggingface | 1,688,399,745 |
se_55639955 | stackoverflow | MACHINE_LEARNING | PyTorch Error The size of tensor a (128) must match the size of tensor b (9) at non-singleton dimension 0 | PyTorch Error The size of tensor a (128) must match the size of tensor b (9) at non-singleton dimension 0
I am running an CNN model of HAR using PyTorch 1.01 in Anaconda with GPU
While doing the iteration it's giving me the error
The size of tensor a (128) must match the size of tensor b (9) at non-singleton dimensi... | https://stackoverflow.com/questions/55639955/pytorch-error-the-size-of-tensor-a-128-must-match-the-size-of-tensor-b-9-at | pytorch, tensor, datamodel | 1,555,011,324 |
se_72595052 | stackoverflow | MACHINE_LEARNING | RuntimeError: For unbatched 2-D input, hx and cx should also be 2-D but got (3-D, 3-D) tensors | RuntimeError: For unbatched 2-D input, hx and cx should also be 2-D but got (3-D, 3-D) tensors
hey I have some problems with my LSTM. I have 6 features and I´m sending all my data (29002 rows) in the LSTM at once (is this a good idea?).
My Input is of size:
Training Shape torch.Size([290002, 1, 6]) torch.Size([290002,... | https://stackoverflow.com/questions/72595052/runtimeerror-for-unbatched-2-d-input-hx-and-cx-should-also-be-2-d-but-got-3-d | python, pytorch, runtime-error, lstm | 1,655,060,251 |
se_68679806 | stackoverflow | MACHINE_LEARNING | AttributeError: Can't pickle local object 'pre_datasets.<locals>.<lambda>' when implementing Pytorch framework | AttributeError: Can't pickle local object 'pre_datasets.<locals>.<lambda>' when implementing Pytorch framework
I was trying to implement a pytorch framework on CNN.
I'm sure the code is right because it's from a tutorial and it works when I ran it on Jupyter Notebook on GoogleDrive.
But when ... | https://stackoverflow.com/questions/68679806/attributeerror-cant-pickle-local-object-pre-datasets-locals-lambda-when | python, pytorch, pickle, attributeerror | 1,628,244,282 |
se_79989890 | stackoverflow | MACHINE_LEARNING | Llama model generation always skips 1 token during inference | Llama model generation always skips 1 token during inference
I am pretraining a Llama-based causal language model from scratch on a custom tokenized binary dataset (where data is stored as raw integer IDs).
However, during inference, the generated sequence consistently skips the first expected token and starts from a ... | https://stackoverflow.com/questions/79989890/llama-model-generation-always-skips-1-token-during-inference | python, pytorch, huggingface-transformers, training-data | 1,785,674,602 |
se_70396187 | stackoverflow | MACHINE_LEARNING | PyTorch GPU install with 11.2 CUDA | PyTorch GPU install with 11.2 CUDA
How to install PyTorch if my CUDA version is 11.2 and CudNN version is 8.1.0?
Offical documentation at https://pytorch.org/get-started/locally/ suggests only CUDA 10.2 and 11.3 versions.
Should I try to install it with v10.2 with next command?
conda install pytorch torchvision torcha... | https://stackoverflow.com/questions/70396187/pytorch-gpu-install-with-11-2-cuda | pytorch | 1,639,758,603 |
se_78438315 | stackoverflow | MACHINE_LEARNING | No module named ‘torch._custom_ops’ in Jupyter Notebooks | No module named ‘torch._custom_ops’ in Jupyter Notebooks
I'm not sure if this is the right place to ask, but I just installed cuda tools to run some GPU-based machine learning stuff on my computer, and I'm running into an issue importing torch.
I'm on Ubuntu 22.04
I've tried installing torch within a conda environment... | https://stackoverflow.com/questions/78438315/no-module-named-torch-custom-ops-in-jupyter-notebooks | python, jupyter-notebook, pytorch | 1,715,017,717 |
se_72496224 | stackoverflow | MACHINE_LEARNING | Is SGD optimizer in PyTorch actually does Gradient Descent algorithm? | Is SGD optimizer in PyTorch actually does Gradient Descent algorithm?
I'm working on trying to compare the converge rate of SGD and GD algorithms for the neural networks. In PyTorch, we often use SGD optimizer as follows.
train_dataloader = torch.utils.data.DataLoader(train_dataset, batch_size=64, shuffle=True)
optimi... | https://stackoverflow.com/questions/72496224/is-sgd-optimizer-in-pytorch-actually-does-gradient-descent-algorithm | python, pytorch, gradient-descent | 1,654,301,773 |
se_78471663 | stackoverflow | MACHINE_LEARNING | What do these TORCH_USE_CUDA_DSA and frozen_modules errors mean and how to fix them? | What do these TORCH_USE_CUDA_DSA and frozen_modules errors mean and how to fix them?
I'm trying to run a Mask R-CNN model with aerial imagery. To optimise this, I run everything with CUDA. But this creates a few errors. Here is my code:
# Python
import torch
import torchvision
from torchvision.models.detection import ... | https://stackoverflow.com/questions/78471663/what-do-these-torch-use-cuda-dsa-and-frozen-modules-errors-mean-and-how-to-fix-t | python, memory, pytorch, torchvision, mask-rcnn | 1,715,596,580 |
se_76917728 | stackoverflow | MACHINE_LEARNING | F.cross_entropy raised "RuntimeError: CUDA error: device-side assert triggered. Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions." | F.cross_entropy raised "RuntimeError: CUDA error: device-side assert triggered. Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions."
I met this error in loss function. An example below:
import torch
device = "cuda" if torch.cuda.is_available() else "cpu"
a = torch.Tensor([[-10.3353, -28.4371... | https://stackoverflow.com/questions/76917728/f-cross-entropy-raised-runtimeerror-cuda-error-device-side-assert-triggered | python, pytorch, loss-function | 1,692,230,741 |
se_60133809 | stackoverflow | MACHINE_LEARNING | Speed up SVD in PyTorch | Speed up SVD in PyTorch
I am doing some classification task for CIFAR10 with Pytorch and for each iteration I have to do some preprocessing on each batch before I would be able to feed forward to the model.
Below is the code for the preprocessing part on each batch:
S = torch.zeros((batch_size, C, H, W))
for i in ran... | https://stackoverflow.com/questions/60133809/speed-up-svd-in-pytorch | python, pytorch, batch-processing, matrix-multiplication, svd | 1,581,226,961 |
se_77590660 | stackoverflow | MACHINE_LEARNING | CUDA out of memory when using Optuna | CUDA out of memory when using Optuna
Half month ago, I can use Optuna without a problem to do a 48-Hour study, with around 150+ trials. Yesterday I tried Optuna again on the same model, same dataset, same batch size and same device (A100 40GB or V100 32GB), but I always got torch.cuda.OutOfMemoryError: CUDA out of mem... | https://stackoverflow.com/questions/77590660/cuda-out-of-memory-when-using-optuna | pytorch, hyperparameters, pytorch-geometric, optuna | 1,701,525,865 |
se_79765261 | stackoverflow | MACHINE_LEARNING | How to handle "Could not initialize NNPACK! Reason: Unsupported hardware" warning in PyTorch / Silero VAD on cloud CPU? | How to handle "Could not initialize NNPACK! Reason: Unsupported hardware" warning in PyTorch / Silero VAD on cloud CPU?
I’m running Silero VAD (via PyTorch + torchaudio) on a Linode cloud instance (2 dedicated CPUs, 4 GB RAM). When I process 10-minute audio chunks, I always get repeated warnings like this an... | https://stackoverflow.com/questions/79765261/how-to-handle-could-not-initialize-nnpack-reason-unsupported-hardware-warnin | pytorch, cpu, torch, torchaudio | 1,757,945,763 |
se_79981714 | stackoverflow | MACHINE_LEARNING | Why does NVIDIA LocateAnything-3B only produce valid output with torch==2.7.0 + transformers==4.57.1 | Why does NVIDIA LocateAnything-3B only produce valid output with torch==2.7.0 + transformers==4.57.1
The problem
I downloaded NVIDIA LocateAnything-3B (3.8B parameter vision-language grounding model released May 2026 on HF). The model loads successfully across multiple environments, but inference only produces correct... | https://stackoverflow.com/questions/79981714/why-does-nvidia-locateanything-3b-only-produce-valid-output-with-torch-2-7-0 | python, pytorch, huggingface-transformers, backwards-compatibility | 1,784,324,203 |
se_67060448 | stackoverflow | MACHINE_LEARNING | RuntimeError: unexpected EOF, expected 3302200 more bytes. The file might be corrupted | RuntimeError: unexpected EOF, expected 3302200 more bytes. The file might be corrupted
I am trying to implement pretrained model of following repository. I need your assistance to rectify the error.
RuntimeError: unexpected EOF, expected 3302200 more bytes. The file might be corrupted.
I tried to implement pretrained ... | https://stackoverflow.com/questions/67060448/runtimeerror-unexpected-eof-expected-3302200-more-bytes-the-file-might-be-cor | pytorch, pre-trained-model, torchvision | 1,618,238,484 |
se_63600423 | stackoverflow | MACHINE_LEARNING | Cannot import torch module | Cannot import torch module
I cannot seem to properly install pytorch on my computer, so here is the background of what I have done:
I had already installed python on my computer and it worked. I used it in Eclipse, using pyDev, so I don't know if that could be the problem. Now I want to install pytorch, so I installed... | https://stackoverflow.com/questions/63600423/cannot-import-torch-module | python, installation, pytorch | 1,598,454,083 |
se_79981390 | stackoverflow | MACHINE_LEARNING | PyTorch/Captum: RuntimeError: gather(): Expected dtype int32/int64 for index | PyTorch/Captum: RuntimeError: gather(): Expected dtype int32/int64 for index
I'm using captum to do feature attribution using IntegratedGradients on a 1-d regression model I built and trained in PyTorch . To avoid memory errors, I've been running it with the recommended internal_batch_size , based on the number of exa... | https://stackoverflow.com/questions/79981390/pytorch-captum-runtimeerror-gather-expected-dtype-int32-int64-for-index | python, machine-learning, pytorch | 1,784,228,266 |
se_79448910 | stackoverflow | MACHINE_LEARNING | Why facing "CUDA error: device-side assert triggered" while training LSTM model? | Why facing "CUDA error: device-side assert triggered" while training LSTM model?
I am learning Pytorch and deep learning, I am working on a dataset containing 4-features. My problem statement is multiclass classification problem, total 9 possible output 1 to 9.
Gene which is categorical type.
Variation which... | https://stackoverflow.com/questions/79448910/why-facing-cuda-error-device-side-assert-triggered-while-training-lstm-model | python, machine-learning, deep-learning, pytorch | 1,739,894,755 |
se_51160386 | stackoverflow | MACHINE_LEARNING | Unable to create a tensor using torch.Tensor | Unable to create a tensor using torch.Tensor
i was trying to create a tensor as below.
import torch
t = torch.tensor(2,3)
i got the following error.
TypeError Traceback (most recent call
last) in ()
----> 1 a=torch.tensor(2,3)
TypeError: tensor() takes 1 positional argu... | https://stackoverflow.com/questions/51160386/unable-to-create-a-tensor-using-torch-tensor | python, runtime-error, pytorch, tensor | 1,530,640,189 |
se_79980408 | stackoverflow | MACHINE_LEARNING | How to create a custom dataset and dataloader in pytorch geometric for files with different dimensions? | How to create a custom dataset and dataloader in pytorch geometric for files with different dimensions?
I have several files that stores graphs, each of different dimension on axis=0 (eg. torch.Size([9852, 400]), torch.Size([6740, 400])). I am trying to create a Dataset and a Dataloader in pytorch geometric to map the... | https://stackoverflow.com/questions/79980408/how-to-create-a-custom-dataset-and-dataloader-in-pytorch-geometric-for-files-wit | python, pytorch, pytorch-dataloader, pytorch-geometric | 1,783,958,793 |
se_54014220 | stackoverflow | MACHINE_LEARNING | AssertionError: Torch not compiled with CUDA enabled | AssertionError: Torch not compiled with CUDA enabled
For installing pytorch on MacOS the following is stated in the official documentation:
conda install pytorch torchvision -c pytorch
# MacOS Binaries dont support CUDA, install from source if CUDA is needed
Why would anyone want to install pytorch without CUDA enabl... | https://stackoverflow.com/questions/54014220/assertionerror-torch-not-compiled-with-cuda-enabled | python, pytorch, cuda | 1,546,469,556 |
se_52468956 | stackoverflow | MACHINE_LEARNING | How do I visualize a net in Pytorch? | How do I visualize a net in Pytorch?
Consider:
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as data
import torchvision.models as models
import torchvision.datasets as dset
import torchvision.transforms as transforms
from torch.autograd import Variable
from torchvision.models.v... | https://stackoverflow.com/questions/52468956/how-do-i-visualize-a-net-in-pytorch | python, pytorch | 1,537,726,504 |
se_75933732 | stackoverflow | MACHINE_LEARNING | ImportError: Failed to load PyTorch C extensions | ImportError: Failed to load PyTorch C extensions
I have a problem with importing torch into my project, when I try to import it I get the following error:
ImportError: Failed to load PyTorch C extensions:
It appears that PyTorch has loaded the `torch/_C` folder
of the PyTorch repository rather than the C ext... | https://stackoverflow.com/questions/75933732/importerror-failed-to-load-pytorch-c-extensions | python, pytorch | 1,680,641,315 |
se_78168447 | stackoverflow | MACHINE_LEARNING | Placeholder storage has not been allocated on MPS device | Placeholder storage has not been allocated on MPS device
I understand I need to allocate both the input tensor and the model parameters to the mps device in order for PyTorch to use my Mac M1 GPU for training. I did just that and it still gave me this error message:
*Placeholder storage has not been allocated on MPS ... | https://stackoverflow.com/questions/78168447/placeholder-storage-has-not-been-allocated-on-mps-device | pytorch, gpu, apple-m1 | 1,710,520,776 |
se_79958966 | stackoverflow | MACHINE_LEARNING | How to handle class imbalance in PyTorch when using ImageFolder for medical image classification? | How to handle class imbalance in PyTorch when using ImageFolder for medical image classification?
Problem Description: I am building a pneumonia detection model using the chest-xray-pneumonia dataset. My dataset is imbalanced: the 'PNEUMONIA' class has significantly more samples than the 'NORMAL' class. I am using tor... | https://stackoverflow.com/questions/79958966/how-to-handle-class-imbalance-in-pytorch-when-using-imagefolder-for-medical-imag | python, pytorch | 1,781,493,939 |
se_75701437 | stackoverflow | MACHINE_LEARNING | Why do we multiply learning rate by gradient accumulation steps in PyTorch? | Why do we multiply learning rate by gradient accumulation steps in PyTorch?
Loss functions in pytorch use "mean" reduction. So it means that the model gradient will have roughly the same magnitude given any batch size. It makes sense that you want to scale the learning rate up when you increase batch size because your... | https://stackoverflow.com/questions/75701437/why-do-we-multiply-learning-rate-by-gradient-accumulation-steps-in-pytorch | python, deep-learning, pytorch, gradient-descent, learning-rate | 1,678,486,502 |
se_72417747 | stackoverflow | MACHINE_LEARNING | ModuleNotFoundError: No module named 'torchvision.models.feature_extraction' | ModuleNotFoundError: No module named 'torchvision.models.feature_extraction'
I want to extract features in ResNet101, however, I have trouble importing torchvision.models.feature_extraction.
Here is my code:
from torchvision import models
from torchvision.models.feature_extractor import create_feature_extr... | https://stackoverflow.com/questions/72417747/modulenotfounderror-no-module-named-torchvision-models-feature-extraction | deep-learning, pytorch, feature-extraction, torchvision | 1,653,758,340 |
se_79966857 | stackoverflow | MACHINE_LEARNING | CUDA error: device-side assert triggered" during backward pass, but error points to an unrelated .to(device) call | CUDA error: device-side assert triggered" during backward pass, but error points to an unrelated .to(device) call
I'm fine-tuning a HuBERT model with a linear classification head on a 50-class audio dataset (ESC-50). I'm getting a device-side assert error that, on first glance, points to a completely unrelated li... | https://stackoverflow.com/questions/79966857/cuda-error-device-side-assert-triggered-during-backward-pass-but-error-points | python, pytorch | 1,782,393,872 |
se_76199688 | stackoverflow | MACHINE_LEARNING | How to allocate more memory to pytorch | How to allocate more memory to pytorch
i keep getting Cuda out of memory errors, i have a 3090 with 24gb of vram, torch only allocates 7gb, 15gb is always free.
RuntimeError: CUDA out of memory. Tried to allocate 92.00 MiB (GPU 0; 24.00 GiB total capacity; 6.90 GiB already allocated; 14.90 GiB free; 6.98 GiB reserved ... | https://stackoverflow.com/questions/76199688/how-to-allocate-more-memory-to-pytorch | memory, pytorch, torch | 1,683,541,788 |
se_48152674 | stackoverflow | MACHINE_LEARNING | How do I check if PyTorch is using the GPU? | How do I check if PyTorch is using the GPU?
How do I check if PyTorch is using the GPU?
The nvidia-smi command can detect GPU activity, but I want to check it directly from inside a Python script. | https://stackoverflow.com/questions/48152674/how-do-i-check-if-pytorch-is-using-the-gpu | python, memory-management, gpu, nvidia, pytorch | 1,515,423,013 |
se_79761589 | stackoverflow | MACHINE_LEARNING | How to install torch on MacOS (Intel) | How to install torch on MacOS (Intel)
On my M2-based Mac I can install torch simply with:
pip install torch
(pip is an alias for pip3)
However, on my Xeon-based iMac I get this error:
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for t... | https://stackoverflow.com/questions/79761589/how-to-install-torch-on-macos-intel | python, pytorch | 1,757,575,196 |
se_56702873 | stackoverflow | MACHINE_LEARNING | Is there an function in PyTorch for converting convolutions to fully-connected networks form? | Is there an function in PyTorch for converting convolutions to fully-connected networks form?
I'm trying to convert a convolution layer to a fully-connected layer.
For example, there is an example of 3×3 input and 2x2 kernel:
which is equivalent to a vector-matrix multiplication,
Is there a function in PyTorch ... | https://stackoverflow.com/questions/56702873/is-there-an-function-in-pytorch-for-converting-convolutions-to-fully-connected-n | neural-network, conv-neural-network, pytorch | 1,561,117,731 |
se_79972195 | stackoverflow | MACHINE_LEARNING | Is it safe to reuse the same PyTorch loss module across multiple environments in a single training iteration? | Is it safe to reuse the same PyTorch loss module across multiple environments in a single training iteration?
I'm training a model where each training iteration processes two independent mini-batches (call them environment A and environment B). Both environments contribute to the same optimization step. I'm currently... | https://stackoverflow.com/questions/79972195/is-it-safe-to-reuse-the-same-pytorch-loss-module-across-multiple-environments-in | python, pytorch | 1,782,917,680 |
se_79956384 | stackoverflow | MACHINE_LEARNING | MH attention (MHA) with pytorch to process a sequence | MH attention (MHA) with pytorch to process a sequence
I am learning about neural networks and want to learn more about MHAs. i wrote this code to process a sequence. is it correct
import torch
import torch.nn as nn
import seaborn as sns
import matplotlib.pyplot as plt
# (a) Setup MultiheadAttention
embed_dim = 64
num... | https://stackoverflow.com/questions/79956384/mh-attention-mha-with-pytorch-to-process-a-sequence | python, pytorch, neural-network, seaborn | 1,781,167,544 |
se_79902067 | stackoverflow | MACHINE_LEARNING | can V-JEPA be used to detect audience engagement during a seminar from live video | can V-JEPA be used to detect audience engagement during a seminar from live video
I am experimenting with the V-JEPA model developed by Meta for video understanding.
My goal is to analyze a live video stream of people attending a seminar and determine their engagement level (for example: bored, attentive, or intereste... | https://stackoverflow.com/questions/79902067/can-v-jepa-be-used-to-detect-audience-engagement-during-a-seminar-from-live-vide | machine-learning, deep-learning, pytorch, computer-vision, video-processing | 1,772,782,100 |
se_79956997 | stackoverflow | MACHINE_LEARNING | Trigram Language Model :Two implementations give different loss, are they equivalent? | Trigram Language Model :Two implementations give different loss, are they equivalent?
I am implementing a trigram character-level language model following Andrej Karpathy's makemore series. I have two implementations and I want to understand if they are mathematically equivalent or fundamentally different models( i ga... | https://stackoverflow.com/questions/79956997/trigram-language-model-two-implementations-give-different-loss-are-they-equiva | machine-learning, deep-learning, pytorch, neural-network, cross-entropy | 1,781,254,604 |
se_73449288 | stackoverflow | MACHINE_LEARNING | When using torch.autocast, how do I force individual layers to float32 | When using torch.autocast, how do I force individual layers to float32
I'm trying to train a model in mixed precision. However, I want a few of the layers to be in full precision for stability reasons. How do I force an individual layer to be float32 when using torch.autocast? In particular, I'd like for this to be on... | https://stackoverflow.com/questions/73449288/when-using-torch-autocast-how-do-i-force-individual-layers-to-float32 | python, pytorch, onnx | 1,661,191,412 |
se_79949769 | stackoverflow | MACHINE_LEARNING | Problem in tensor shape difference between training and and testing data when running a CNN model | Problem in tensor shape difference between training and and testing data when running a CNN model
I have a problem when running the saved model of a CNN. When I train the model and the input tensor size of the first linear layer is set to the shape for the training data after it is flattened and went through the convo... | https://stackoverflow.com/questions/79949769/problem-in-tensor-shape-difference-between-training-and-and-testing-data-when-ru | python, deep-learning, jupyter-notebook, pytorch, data-science | 1,780,326,439 |
se_79965556 | stackoverflow | MACHINE_LEARNING | Why might PyTorch batch_isend_irecv have poor performance on AWS G5 instances? | Why might PyTorch batch_isend_irecv have poor performance on AWS G5 instances?
I found the following function in a distributed PyTorch checkpointing implementation:
def _snapshot_torch_p2p_fn(input_tensor: Tensor,
output_tensor: Tensor,
snapshot_group: Snapshot... | https://stackoverflow.com/questions/79965556/why-might-pytorch-batch-isend-irecv-have-poor-performance-on-aws-g5-instances | amazon-ec2, pytorch, distributed-computing, nccl | 1,782,175,116 |
se_67440324 | stackoverflow | MACHINE_LEARNING | Pytorch TypeError: only integer tensors of a single element can be converted to an index | Pytorch TypeError: only integer tensors of a single element can be converted to an index
I am trying to use pytorch in a case for nlp binary classification and i need help to finish the neural network training and validate. I am newbie and this is my first time using pytorch, see the code below and the error...
X_trai... | https://stackoverflow.com/questions/67440324/pytorch-typeerror-only-integer-tensors-of-a-single-element-can-be-converted-to | python, neural-network, nlp, pytorch, tensor | 1,620,413,660 |
se_79963063 | stackoverflow | MACHINE_LEARNING | Feature-Level Fusion | Feature-Level Fusion
I am working on a mango ripeness classification project using PyTorch.
My architecture is:
Arsitektur Hybrid MobileNetV2 + HSV
+----------------------+
| Input RGB Image |
+----------+-----------+
|
... | https://stackoverflow.com/questions/79963063/feature-level-fusion | python, pytorch, ml | 1,781,859,502 |
se_63233726 | stackoverflow | MACHINE_LEARNING | Print random sample from dataloader in PyTorch | Print random sample from dataloader in PyTorch
I have a certain dataset loaded into a dataloader. For example, if I wanted to save 100 images from this dataloader, how should I iterate over the dataloader to save them? | https://stackoverflow.com/questions/63233726/print-random-sample-from-dataloader-in-pytorch | python, dataset, pytorch, dataloader | 1,596,473,774 |
se_61819013 | stackoverflow | MACHINE_LEARNING | How to reset a CUDA GPU in python | How to reset a CUDA GPU in python
Is there a way to restart CUDA GPU within python ? or release it so that another script can get access to it ?
I sometimes get an error using the GPU in python, and the only solution to get access to the GPU again is to restart my Jupyter notebook.
PS: I am using the GPU for some co... | https://stackoverflow.com/questions/61819013/how-to-reset-a-cuda-gpu-in-python | python, pytorch, gpu | 1,589,545,022 |
se_79956827 | stackoverflow | MACHINE_LEARNING | What are the essential PyTorch CNN components and syntax I should know for building image classification models? | What are the essential PyTorch CNN components and syntax I should know for building image classification models?
I'm creating a personal PyTorch CNN cheat sheet for image classification tasks (e.g., CIFAR-10) and want to verify that I've covered the most important layers and syntax.
So far, I have included:
1. CNN Cla... | https://stackoverflow.com/questions/79956827/what-are-the-essential-pytorch-cnn-components-and-syntax-i-should-know-for-build | python, pytorch, neural-network | 1,781,225,998 |
se_79956021 | stackoverflow | MACHINE_LEARNING | Why is my training loss not decreasing while fine-tuning Qwen with Unsloth? | Why is my training loss not decreasing while fine-tuning Qwen with Unsloth?
I'm guys training AI here, but the loss isn't decreasing. What should I do? Here's the notebook I'm using. I would appreciate your help. "
==((====))== Unsloth - 2x faster free finetuning | Num GPUs used = 1
\\ /| Num examples = 99,89... | https://stackoverflow.com/questions/79956021/why-is-my-training-loss-not-decreasing-while-fine-tuning-qwen-with-unsloth | python, pytorch, artificial-intelligence | 1,781,096,277 |
se_59749991 | stackoverflow | MACHINE_LEARNING | PyTorch - Custom ReLU squared Implementation | PyTorch - Custom ReLU squared Implementation
I work on a project and I want to implement the ReLU squared activation function (max{0,x^2}). Is it ok to call it like:
# example code
def forward(self, x):
s = torch.relu(x**2)
return s
Or should I implement the activation function on my own? In the... | https://stackoverflow.com/questions/59749991/pytorch-custom-relu-squared-implementation | python, machine-learning, deep-learning, neural-network, pytorch | 1,579,085,934 |
se_78703313 | stackoverflow | MACHINE_LEARNING | segment_anything causing error with numpy.uint8 | segment_anything causing error with numpy.uint8
I am trying to run https://github.com/facebookresearch/segment-anything/blob/main/notebooks/onnx_model_example.ipynb locally, on an M2 MacBook with Sonoma 14.5. However, I keep running into the following error at step 11:
-------------------------------------------------... | https://stackoverflow.com/questions/78703313/segment-anything-causing-error-with-numpy-uint8 | python, numpy, machine-learning, pytorch, segment-anything | 1,720,024,997 |
se_79951333 | stackoverflow | MACHINE_LEARNING | How can I leverage torch.cuda.Stream() to control CUDA streams for parallel task execution? | How can I leverage torch.cuda.Stream() to control CUDA streams for parallel task execution?
I have prepared test code that defines three functions to compare matrix computation elapsed time under PyTorch’s default CUDA stream versus custom user-created streams. The three functions differ in the number of instantiated ... | https://stackoverflow.com/questions/79951333/how-can-i-leverage-torch-cuda-stream-to-control-cuda-streams-for-parallel-task | python, pytorch, parallel-processing, cuda, cuda-streams | 1,780,569,483 |
se_74552442 | stackoverflow | MACHINE_LEARNING | Cannot import torch Error loading ..\caffe2_nvrtc.dll" or one of its dependencies | Cannot import torch Error loading ..\caffe2_nvrtc.dll" or one of its dependencies
I am on a Windows 10 64 bit system.
Pytorch for cuda has been working successfully for some time.
Today I tried to upgrade to the latest version of Pytorch (1.13) using
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 ... | https://stackoverflow.com/questions/74552442/cannot-import-torch-error-loading-caffe2-nvrtc-dll-or-one-of-its-dependencie | pytorch, windows-10 | 1,669,234,020 |
se_63797147 | stackoverflow | MACHINE_LEARNING | torch.cuda.is_available() retuns FALSE after installing appropriate versions of CUDA and CuDNN on Ubuntu 20.04 | torch.cuda.is_available() retuns FALSE after installing appropriate versions of CUDA and CuDNN on Ubuntu 20.04
I should say installations on Z490 motherboard with Ubuntu 20.04 are quite tricky.
Above are the screenshots from nvidia --version and nvidia-smi
I was able to complete all CUDA and CuDNN installations.
I us... | https://stackoverflow.com/questions/63797147/torch-cuda-is-available-retuns-false-after-installing-appropriate-versions-of | pytorch, ubuntu-20.04 | 1,599,579,233 |
se_67322049 | stackoverflow | MACHINE_LEARNING | AttributeError: module 'torch._six' has no attribute 'PY3' | AttributeError: module 'torch._six' has no attribute 'PY3'
if torch._six.PY3:
AttributeError: module 'torch._six' has no attribute 'PY3' | https://stackoverflow.com/questions/67322049/attributeerror-module-torch-six-has-no-attribute-py3 | pytorch | 1,619,716,100 |
se_70899910 | stackoverflow | MACHINE_LEARNING | ImportError in "from torch.utils.data import utils" | ImportError in "from torch.utils.data import utils"
Following is the code used with PyTorch 1.0.1:
import torch
import torch.utils
import torch.multiprocessing as multiprocessing
from torch.utils.data import DataLoader
from torch.utils.data import SequentialSampler
from torch.utils.data import RandomSampler
... | https://stackoverflow.com/questions/70899910/importerror-in-from-torch-utils-data-import-utils | python, pytorch | 1,643,401,649 |
se_79126798 | stackoverflow | MACHINE_LEARNING | OutOfMemory while training pre-trained BERT model for token classification task | OutOfMemory while training pre-trained BERT model for token classification task
I am using pre-trained BertForTokenClassification for nested named entities recognition task. To define nested entities, I am using multi-labels method. In the output model returns 3 lists of logits, one for each level, which are eventuall... | https://stackoverflow.com/questions/79126798/outofmemory-while-training-pre-trained-bert-model-for-token-classification-task | python, pytorch, huggingface-transformers, bert-language-model, named-entity-recognition | 1,729,878,333 |
se_69254905 | stackoverflow | MACHINE_LEARNING | AttributeError: module 'torch' has no attribute 'inference_mode' | AttributeError: module 'torch' has no attribute 'inference_mode'
I am very new to pytorch, and when I try to run my CNN, I encountered the Error:
AttributeError: module 'torch' has no attribute 'inference_mode'.*
Does anyone know what is going one? It worked on Google colab but no where else. | https://stackoverflow.com/questions/69254905/attributeerror-module-torch-has-no-attribute-inference-mode | pytorch | 1,632,142,914 |
se_51730880 | stackoverflow | MACHINE_LEARNING | Where do I get a CPU-only version of PyTorch? | Where do I get a CPU-only version of PyTorch?
I'm trying to get a basic app running with Flask + PyTorch, and host it on Heroku. However, I run into the issue that the maximum slug size is 500mb on the free version, and PyTorch itself is ~500mb.
After some google searching, someone wrote about finding a cpu-only versi... | https://stackoverflow.com/questions/51730880/where-do-i-get-a-cpu-only-version-of-pytorch | heroku, pytorch | 1,533,657,059 |
se_58294355 | stackoverflow | MACHINE_LEARNING | Tensor Inverse in parallel over multiple GPUs using PyTorch | Tensor Inverse in parallel over multiple GPUs using PyTorch
I want to run over multiple GPUs in parallel torch.inverse(), and am not able to.
I saw this post Matmul on multiple GPUs , which goes over the process for matmul. It shows that if you have multiple tensors allocated to each GPU matmul will be run in parall... | https://stackoverflow.com/questions/58294355/tensor-inverse-in-parallel-over-multiple-gpus-using-pytorch | python, gpu, pytorch | 1,570,570,376 |
se_62808878 | stackoverflow | MACHINE_LEARNING | How can I install torch and torchvision with pip and python 3.8.3 on windows in an virtual environment? | How can I install torch and torchvision with pip and python 3.8.3 on windows in an virtual environment?
I created a virtual environment for my project and I'm trying to install torch via pip.
pip install torch===1.5.1 torchvision===0.6.1 -f https://download.pytorch.org/whl/torch_stable.html
This gives me the error -
... | https://stackoverflow.com/questions/62808878/how-can-i-install-torch-and-torchvision-with-pip-and-python-3-8-3-on-windows-in | python, pip, pytorch, python-3.8 | 1,594,276,649 |
se_79266767 | stackoverflow | MACHINE_LEARNING | How to handle heterogenous GNN? | How to handle heterogenous GNN?
I have created this data:
HeteroData(
user={ x=[100, 16] },
keyword={ x=[321, 16] },
tweet={ x=[1000, 16] },
(user, follow, user)={ edge_index=[2, 291] },
(user, tweetedby, tweet)={ edge_index=[2, 1000] },
(keyword, haskeyword, tweet)={ edge_index=[2, 3752] }
)
And these tw... | https://stackoverflow.com/questions/79266767/how-to-handle-heterogenous-gnn | python, pytorch, pytorch-geometric, gnn | 1,733,791,377 |
se_77266649 | stackoverflow | MACHINE_LEARNING | Can PyTorch GPU Use Shared GPU Memory (from RAM, shows in Windows Task Manage)? | Can PyTorch GPU Use Shared GPU Memory (from RAM, shows in Windows Task Manage)?
Someone says that it can use, who verified it by running chatglm6b model on Windows with 1660s (6g). He claimed that it can't run under linux but he didn't test it. I don't use PyTorch. My CUDA experience told me that Nvidia doesn't take s... | https://stackoverflow.com/questions/77266649/can-pytorch-gpu-use-shared-gpu-memory-from-ram-shows-in-windows-task-manage | windows, pytorch, gpu-shared-memory | 1,696,947,812 |
se_78141020 | stackoverflow | MACHINE_LEARNING | Make pytorch reserve certain amount of GPU memory upfront | Make pytorch reserve certain amount of GPU memory upfront
My code has two workflows that run sequentially. In the first workflow, it requires only about 8GB of GPU memory, but the second workflow takes about 22GB. Is it possible to reserve 22GB upfront (even while running the first workflow) even if it is not using al... | https://stackoverflow.com/questions/78141020/make-pytorch-reserve-certain-amount-of-gpu-memory-upfront | python, pytorch, gpu-shared-memory | 1,710,164,179 |
se_64776822 | stackoverflow | MACHINE_LEARNING | How do I list all currently available GPUs with pytorch? | How do I list all currently available GPUs with pytorch?
I know I can access the current GPU using torch.cuda.current_device(), but how can I get a list of all the currently available GPUs? | https://stackoverflow.com/questions/64776822/how-do-i-list-all-currently-available-gpus-with-pytorch | python, pytorch, gpu | 1,605,042,641 |
se_79943593 | stackoverflow | MACHINE_LEARNING | Tuning for SCAFFOLD Server + Client Learning Rates η_g and η_i? | Tuning for SCAFFOLD Server + Client Learning Rates η_g and η_i?
for my project on training a binary classifier on a residual CNN - data dimension (12, 4096), I am simulating federated training using FedAvg, FedProx and SCAFFOLD as the aggregation strategies.
The SCAFFOLD paper by Karimireddy et al.: https://arxiv.org/... | https://stackoverflow.com/questions/79943593/tuning-for-scaffold-server-client-learning-rates-%ce%b7-g-and-%ce%b7-i | deep-learning, pytorch, hyperparameters, scaffold, federated-learning | 1,779,209,820 |
se_79829472 | stackoverflow | MACHINE_LEARNING | PyTorch installed via uv project shows CPU-only version on Windows with CUDA specification in pyproject.toml | PyTorch installed via uv project shows CPU-only version on Windows with CUDA specification in pyproject.toml
I'm trying to set up a Python project using uv and pyproject.toml on Windows. I want to install the CUDA-enabled PyTorch, but after installing, when I check the version, it shows CPU-only.
Here’s my pyproject.t... | https://stackoverflow.com/questions/79829472/pytorch-installed-via-uv-project-shows-cpu-only-version-on-windows-with-cuda-spe | python, pytorch, uv | 1,764,061,285 |
se_71491932 | stackoverflow | MACHINE_LEARNING | Why I get "RuntimeError: CUDA error: the launch timed out and was terminated" when using Google Cloud compute engine | Why I get "RuntimeError: CUDA error: the launch timed out and was terminated" when using Google Cloud compute engine
I have a Google cloud compute engine with 4 Nvidia K80 GPU and Ubuntu 20.04 (python 3.8). When I try to train the yolo5 model, I get the following error:
RuntimeError: CUDA error: the launch t... | https://stackoverflow.com/questions/71491932/why-i-get-runtimeerror-cuda-error-the-launch-timed-out-and-was-terminated-wh | google-cloud-platform, pytorch, google-compute-engine, nvidia, yolo | 1,647,406,231 |
se_79941687 | stackoverflow | MACHINE_LEARNING | Improving a Convolutional Neural Network for simulating a fabric | Improving a Convolutional Neural Network for simulating a fabric
As a part of my university course I am working on a project where I am trying to simulate a fabric using machine learning to calculate the forces.
I am very new to Git and GitHub but I think you can find the entire project here (minus the datasets as the... | https://stackoverflow.com/questions/79941687/improving-a-convolutional-neural-network-for-simulating-a-fabric | python, machine-learning, pytorch, conv-neural-network, softbody | 1,778,839,520 |
se_77338800 | stackoverflow | MACHINE_LEARNING | How can I install Pytorch in VS code on Windows? | How can I install Pytorch in VS code on Windows?
(studysession) C:\Users\Steven\PyTorch>pip install torch
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch
Do I need to downgrade to Python 3.7.? | https://stackoverflow.com/questions/77338800/how-can-i-install-pytorch-in-vs-code-on-windows | visual-studio-code, pytorch | 1,697,953,470 |
se_68604159 | stackoverflow | MACHINE_LEARNING | GPU Runtime Error when memory is available | GPU Runtime Error when memory is available
I'm currently training some neural network models and I've found that for some reason the model will sometimes fail before ~200 iterations due to a runtime error, despite there being memory available. The error is:
RuntimeError: CUDA out of memory. Tried to allocate 2.00 MiB ... | https://stackoverflow.com/questions/68604159/gpu-runtime-error-when-memory-is-available | python, pytorch, gpu, ram | 1,627,750,799 |
se_79937763 | stackoverflow | MACHINE_LEARNING | Using MONAI sliding_window_inference with multi-output model, how to use predictor for only one output? | Using MONAI sliding_window_inference with multi-output model, how to use predictor for only one output?
I am using MONAI sliding_window_inference for segmentation inference, but my model returns multiple outputs instead of a single tensor.
My model forward returns something like:
return {
"latent_a": latent_a,
... | https://stackoverflow.com/questions/79937763/using-monai-sliding-window-inference-with-multi-output-model-how-to-use-predict | python, pytorch | 1,778,184,217 |
se_79908341 | stackoverflow | MACHINE_LEARNING | Converting XLSX File to a FASTA format in Python | Converting XLSX File to a FASTA format in Python
Need to extract data (Peptide_Sequence) from XLSX output file to a FASTA file. I'm using pandas. A FASTA file is a standard plain-text format in bioinformatics, used to store nucleotide or amino acid sequences.
It consists of two elements:
A header line (the identifier)... | https://stackoverflow.com/questions/79908341/converting-xlsx-file-to-a-fasta-format-in-python | python, pytorch, bioinformatics, cheminformatics | 1,773,650,193 |
se_79847465 | stackoverflow | MACHINE_LEARNING | How to get all non-registered models in MLflow? | How to get all non-registered models in MLflow?
I am using MLflow (3.7.0) with PyTorch (2.5.1 + CUDA).
How can I get model(NO REGISTERED) names from MLflow?
I have a function that saves a model whenever it improves compared to the previous epoch. I log the models like this:
mlflow.pytorch.log_model(
model_cpu,
... | https://stackoverflow.com/questions/79847465/how-to-get-all-non-registered-models-in-mlflow | python, machine-learning, pytorch, mlflow | 1,765,782,542 |
se_79790823 | stackoverflow | MACHINE_LEARNING | How to pass P_map: dict[str, torch.Tensor] to PEFT (LoRA)? | 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)┬Δ ̂ 〗〖‖𝑓_(Θ+Δ ̂𝑃) (𝑋)−𝑌‖^2+‖Δ ̂𝑃‖^2 〗. The optimization objective... | https://stackoverflow.com/questions/79790823/how-to-pass-p-map-dictstr-torch-tensor-to-peft-lora | pytorch, huggingface-transformers, huggingface, huggingface-trainer, peft | 1,760,505,942 |
se_79934444 | stackoverflow | MACHINE_LEARNING | Returning a torch::Tensor causes seg fault in Python when returning from a C++ binding with pybind11 | Returning a torch::Tensor causes seg fault in Python when returning from a C++ binding with pybind11
I have data from a device that is being captured in Python as arrays and then sent to a C++ binding to speed up some post processing that must happen to format the data properly and convert into a torch.Tensor using a ... | https://stackoverflow.com/questions/79934444/returning-a-torchtensor-causes-seg-fault-in-python-when-returning-from-a-c-b | c++, pytorch, segmentation-fault, pybind11, libtorch | 1,777,593,687 |
se_59136777 | stackoverflow | MACHINE_LEARNING | RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn | RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
When I run the program I get this error:
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
However I had set gen_y = torch.tensor(gen_y,requires_grad=True), but this has not helped, gen_y.grad_... | https://stackoverflow.com/questions/59136777/runtimeerror-element-0-of-tensors-does-not-require-grad-and-does-not-have-a-gra | pytorch, gradient, loss-function, backpropagation | 1,575,281,808 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.