2,169 questions
0
votes
0
answers
51
views
TypeError: empty() received an invalid combination of arguments
I want to do object detection using cascade r-cnn and swin transformer. Here is my code and the libraries I installed.
mmcv 2.1.0
mmdet 3.3.0 ...
-4
votes
0
answers
22
views
LLM: How to test a code that is actually runs on GPU and its performance [closed]
I am new in GenAI, and recently I tested some open source libraries for model-serving like vllm and infinity.
How can I test that the code runs efficiently on GPU? meaning: how can I check that ...
0
votes
1
answer
33
views
Any Difference between `torch.distributions.normal.Normal` v.s. `torch.distributions.Normal`
I only see torch.distributions.normal.Normal in the official documents but never see torch.distributions.Normal. However, I sometimes see people use torch.distributions.Normal in their codes in Github....
0
votes
0
answers
16
views
PackagesNotFound error even when verified packages as installed
I am trying to follow this tutorial for BERT topic modeling:
https://jpcompartir.github.io/BertopicR/
library(reticulate)
reticulate::install_miniconda()
library(BertopicR)
BertopicR::...
0
votes
1
answer
58
views
How to use torch.unique to filter duplicate values, calculate an expensive function, map it back, and then calculate the gradient?
I'm trying to optimize a computation in PyTorch by first identifying the unique elements of a tensor, applying an expensive function (e.g., torch.exp) to these unique elements only, and then mapping ...
9
votes
4
answers
234
views
Find maximum length of consecutive zeros in each row
My goal is to find the maximum length of consecutive zeros in each row. So for instance, if I have a tensor like
input = torch.tensor([[0, 1, 0, 0, 0, 1],[0, 0, 1, 0, 1, 0],[1, 0, 0, 0, 0, 0]])
I ...
0
votes
0
answers
35
views
CUDA out of memory while using Llama3.1-8B for inference
I have written a simple Python script that uses the HuggingFace transformers library along with torch to run Llama3.1-8B-instruct purely for inference, after feeding in some long-ish bits of text (...
0
votes
2
answers
25
views
Gather different pixels per image of an image stack with torch
I have a batch of images and a batch of indices (x, y) for each image. The indices are different for each image, so I cant use simple indexing. What is the best or fastest way to get another batch ...
0
votes
0
answers
17
views
Fix ERROR:root:An error occurred: MPS does not support cumsum op with int64 input
I am working on a project trying to summarize a bunch of movie reviews using an LLM. I get that error because I'm using a mac chip m3. I don't want to use CPU because I get like 700 clusters, I want ...
0
votes
1
answer
38
views
Scaled_dot_product_attention higher head num cost much more memory
I found Scaled_dot_product_attention cost much more memory when head number is large(>=16). This is my code to reproduce the issue.
import torch
length = 10000
dim = 64
head_num1 = 8
head_num2 = ...
1
vote
1
answer
57
views
+50
Huge memory consumption with SD3.5-medium
I have a g4dn.xlarge AWS GPU instance, it has 16GB memory + 48GB swap, and a Tesla T4 GPU Instance with 16GB vRAM.
According to the stability blog, it should be sufficient to run SD3.5 Medium model.
...
0
votes
0
answers
24
views
torch.multiprocessing.spawn hanging after completion
My issue is similar to the one described [here][1]. However, the solution mentioned by the OP in the comment didn't work for me. I have some code where I need to spawn new process groups several times ...
0
votes
1
answer
70
views
Pytorch in Azure Synapse causing problems
I have a notebook in Azure Synapse that is using these libraries
import pandas as pd
import numpy as np
from sqlalchemy import create_engine, text
import sqlalchemy as sa
from azure.core.credentials ...
1
vote
1
answer
44
views
Torch randn vector differs
I am trying to generate a torch vector with a specific length.
I want the vector to have the same beginning elements when increasing its length using the same seed.
This works when the vector's length ...
0
votes
0
answers
23
views
Colab stuck in an infinite loop while installing PyTorch-related packages
I'm trying to install several PyTorch-related packages in Colab, but the installation process gets stuck in an infinite loop and doesn't complete, even though it doesn't give any error messages. I'm ...
0
votes
1
answer
32
views
'Seqential object has no attribute weight' error when building CNN model
from google.colab import drive
drive.mount('/gdrive', force_remount=True)
import os
import numpy as np
import torch
import torch.nn as nn
from sklearn.metrics import accuracy_score
from torch.utils....
0
votes
1
answer
42
views
Deep RL problem: Loss decreases but agent doesn't learn
I hope somebody can help me. I'm implementing a basic Vanilla Policy Gradient algorithm for the CartPole-v1 gymnasium environment, and I don't know what I'm doing wrong.
No matter what I try, during ...
1
vote
0
answers
8
views
Asynchronous parallel data loading with torch in R
I want train cnns on a big dataset via transfer learning using torch in R. Since my dataset is to big to be loaded all at once, I have to load each sample from the SSD in the dataloader. But loading ...
0
votes
0
answers
58
views
Huggingface transformers eval dataset size and GPU out of memory
I have a trained BertForSequenceClassification model from huggingface transformers library, and I need to run a lot of forward passes on different data using it. I am trying to optimize batch size, ...
0
votes
0
answers
35
views
Trying to run chatdb / natural-sql-7b, not getting any response
I am trying to build one text-to-sql with huggingface chatdb/natural-sql-7b model, it seems it is getting stuck every time and not generating any result. here is my code. Another problem is its ...
0
votes
0
answers
8
views
How to host pytorch on heroku or aws without exceedig size limit
I have a django app that utilizes RoBERTa (pytorch for sentiment analysis on tweets). I can't figure out any solution for hosting the app anywhere. All of the apps have a 500mb slug max limit and ...
0
votes
0
answers
17
views
How to convert aten.upsample_nearest2d.vec to stablehlo?
I'm trying to using torchscript.jit.trace to compile stable-diffusion-v1.4 and convert it into stablehlo.
But the conversion failed because of Upsample op in stable-diffusion.
%9885 = stablehlo.add %...
0
votes
0
answers
27
views
Ran a Run Environment cell and got this error?
I'm working with Deep Exemplar-based Video colorisation demo on Colab. Worked for two years till sunday. I've copied the opening code after it ran successfully vs the opening error flag after i tried ...
0
votes
1
answer
46
views
How to implement .pth model on real-time?
I had trained the model from (here) and now, i want to implement it on real-time on my laptop. I tried several ways to load the model, but to no avail.
The code:
import cv2
import torch
import ...
1
vote
1
answer
24
views
Combining Multi project in visual studio
i have a Torch Project in my visual studio i want to create GUI for that project i need to use QT now the project by default is settled up for Libtorch now i want to compile the QT as well in the same ...
0
votes
0
answers
35
views
Is in TorchSharp implementation of TorchText completed? If not, what are alternatives?
For TorchSharp text classification example there is TorchText used to load data set.
I am not sure what I am doing wrong, but I can not find any usings to import this library.
For TorchSharp MNIST ...
3
votes
1
answer
767
views
How to install torch without nvidia?
While trying to reduce the size of a Docker image, I noticed pip install torch adds a few GB. A big chunk of this comes from [...]/site-packages/nvidia. Since I'm not using a GPU, I'd like to not ...
0
votes
1
answer
162
views
No module named 'torch.utils'
Friends, I am programming on the Phytec board. I am trying to run the program code using Ultralytics. I install the libraries locally, that is, in the root of the system. It cannot load the libraries.
...
0
votes
0
answers
135
views
AttributeError: module 'torch' has no attribute 'version' when use optim
I use this code to define optimizer but I receive the error.
ctc_loss = CTCLoss(blank=0, zero_infinity=True)
optimizer = optim.Adam(model.parameters(), lr=0.001)
My full code about is:
# Chuẩn bị ...
0
votes
3
answers
127
views
Using einsum for transpose times matrix times transpose: x@A^T@A@x^T@x@A@A^T@x^T
So I have m number of different vectors (say x), each one is (1,n), stacked horizontally, totally in a (m,n) matrix we call it B, and a matrix (A) with dimension (n,n).
I want to compute x@A^T@A@x^T@x@...
1
vote
1
answer
178
views
SentenceTransformerTrainingArguments torch and accelerate version issue
I am using below script to train a custom embedding model. The data uses a description and corresponding search query so that a custom embedding model can be trained using them both. I have been using ...
1
vote
1
answer
55
views
How to Process Data on GPU Instead of RAM for This Python Code?
I'm currently using the following code to process audio data, but it runs on the RAM. I want to offload the processing to the GPU to improve performance.
my code :
def prepare_dataset(batch):
...
3
votes
3
answers
110
views
Using einsum for transpose times matrix times transpose: x@A@x^T
So I have m number of different vectors (say x), each one is (1,n), stacked horizontally, totally in a (m,n) matrix we call it B, and a matrix (A) with dimension (n,n).
I want to compute xAx^T for all ...
1
vote
0
answers
146
views
Install torch/tensorflow/transformers with poetry
I've spent hours reading topics/issues on github about how to install those 3 packages with poetry and everytime the module install but when I run my notebook, I get this:
[WinError 126] Specified ...
1
vote
0
answers
110
views
What are the fastest ways to check interesection between two pytorch vectors?
Question: Consider two pytorch vectors v1,v2 - what are the fastest ways to deterimine do they have any common element ? Suggestions/ideas/experience welcome !
Setup: data types: torch.int64, ...
8
votes
2
answers
304
views
Is it possible to run autograd backward one node at a time?
Let say I have a complex model with many many layers.
When I obtain the output of the model I calculate the loss.
Now when I run loss.backward() it would calculate gradients for all layers at once.
...
-1
votes
1
answer
103
views
Cannot import torch
I install torch using conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia and when i try to import it i see error:
Traceback (most recent call last):
File "<...
1
vote
1
answer
47
views
Why will my python file run via a terminal command but not when I run the same command inside of a function in my Flutter macos app?
I want to execute python code in my Flutter macos app to run a YOLO object detection model.
I am using the https://pub.dev/packages?q=process_run package to execute shell commands.
The package works ...
-1
votes
1
answer
159
views
How to install PyTorch and run .pt file in Raspberry Pi 4 B?
So i am trying to implement my yolov5 object detection model "best.pt" which i trained in custom roboflow collab notebook file which i have already downloaded in my desktop since it is where ...
0
votes
0
answers
119
views
Unable to train with 4 GPUs using Torch: torch.distributed.elastic.multiprocessing.api
My training command: torchrun --standalone --nnodes=1 --nproc_per_node=4 Open-Sora/scripts/train.py Open-Sora/configs/opensora-v1-2/train/stage1.py --data-path test123.csv
Here is my config file:
#...
0
votes
0
answers
31
views
Pykeen testing/validation loss
I am unable to find out how to compute the test/validation loss, so that I could make a graph depicting the evolution of training and test/validation loss over epochs.
I have tried the pipeline ...
0
votes
1
answer
48
views
Standardization of a 1d vector in torch
I am working with torch dataset of 1d signals, and would like to standardize the vectors to mean 0, std 1 before further processing the data. If I would have dealt with an image, I could use ...
0
votes
0
answers
43
views
Torchvision, detection inference on very large images
I trained a Mask R-CNN model from TorchVision to detect/segment a class of object. I trained the model on 512x512 patches/crops, but now I need to apply it on VERY big images (50Kx50K).
Is there a ...
0
votes
0
answers
52
views
In PyTorch, when the nn.linear operation(fp32) only increases the shape size, the result that certain parts are not the same. (SNR is not infinity)
test = nn.Linear(1440, 1440, bias=False)
hidden1 = torch.randn(400, 1440, dtype=torch.float32)
hidden2 = hidden1[:100, :]
output1 = test(hidden1)
output2 = test(hidden2)
If I test it as above,
...
0
votes
0
answers
33
views
Ray + lightning prepare_data_loader MisconfigurationException
I am trying to start a training session with Ray on GPU but experiencing errors while on CPU everything works smoothly. The issues are raising from the data modules:
I have the following class which ...
0
votes
0
answers
25
views
torch in Rstudio crashes on mac
I am just reading:
Deep Learning and Scientific Computing with R torch:
https://skeydan.github.io/Deep-Learning-and-Scientific-Computing-with-R-torch/
and tried to build the example 14.2.3 with the ...
0
votes
2
answers
566
views
OSError: [WinError 126] The specified module could not be found when importing torch in YOLO script
I am trying to run a YOLO inference script using the ultralytics package in a Python virtual environment on my Windows 10 x64 system. However, I am encountering the following error when trying to ...
0
votes
2
answers
1k
views
The python module sentence-transformers is not found, even though the package is installed
For my python script (as seen below), I use the package sentence-transformer, which contains SBERT models. Even though this package is clearly listed as installed when executing "pip list" ...
0
votes
0
answers
71
views
converting std::vector of gpumats to torch::Tensor
i have a vector of gpumats and i want to stack them and convert them to torch::Tensor. I used Yolo8 segmentation exported as torchscript for my model.
here is my code:
torch::Tensor TorchSegmentation::...
0
votes
1
answer
48
views
how to save epoches every 20 times and load model again?
i want to train this model on colab and it has 1000 epoches ..but its takes too long.
this is my code with python:
its training a model for 1000 epoches ,
and i want to save epoches every 20 times(for ...