2,177
questions
0
votes
0
answers
14
views
No bias Correction for Bert
im trying to take a Kfold Test on my BertModel.
First i trained my model for reveling PII and i saved the state of it in 2 file : optimazer.pt and bert_model.pt
Here's how
def save_model(self, ...
0
votes
0
answers
19
views
What is the effect of wrapping a manual assignment of weights to a PyTorch layer with a `torch.no_grad()` context manager?
I'm trying to create a linear layer in PyTorch and then manually set the weights of the linear layer like this:
import torch
layer = torch.nn.Linear(10, 10)
layer.weight = torch.nn.Parameter(torch....
0
votes
0
answers
23
views
How can I load a gguf model and retrieve it's weights using llama_cpp python?
I'm trying to compress quantized gguf models to reduce storage space and was wondering if it is possible to retrive the weights of a model after loading it with llama_cpp.
As far as I know I'm only ...
0
votes
0
answers
10
views
Can't plot after importing torch. Causes crash in Spyder and in command line python but does not crash when plot is done before importing torch
My code crashes and burns when I try to create a plot after importing torch unless I first plot and then import torch. I'm using windows 11. More specifically:
The following code runs and plots in ...
1
vote
0
answers
28
views
Loading neural net model made with pytorch in R through the torch package
I've build a neural net (NN) in python using pytorch and I am trying to load it in R using the torch package. However, I get and error.
Here is a reproducible example. The NN is base on the example ...
1
vote
2
answers
49
views
Pytorch incorrect results with non_blocking assignment from Cuda to CPU
I'm trying to assign a tensor on CPU with values I just obtained from GPU, however getting incorrect results, both tensors should be the same obviously:
(To avoid any unnecessary chatter, I'd like to ...
0
votes
0
answers
15
views
transfomers runtimeError `No module named 'keras.__internal__`
I have these installed:
keras 3.5.0
tensorflow 2.17.0
tensorflow-intel 2.17.0
tensorflow-io-gcs-filesystem 0.31.0
torch ...
-1
votes
0
answers
13
views
Issues Running Python Script on Raspberry Pi 4B with DistilBERT and Konlpy Libraries
I'm working on a project using a Raspberry Pi 4B (4GB RAM) and facing issues when running a Python script that uses DistilBERT and Okt (from the Konlpy library). Below is a simplified version of the ...
0
votes
0
answers
11
views
RuntimeError: no support for _allgather_base in Gloo process group
I am trying to run DINOv2 on WIndows. So far, I have been able to run it on windows by using "Gloo" backend for torch.distributed and hasn't faced any issues except the error mentioned in ...
0
votes
0
answers
18
views
Torch DataLoader for a custom requirement
I have an ordered dataset(shuffle=False) that is categorised into "bins". I shall present an example on smaller scale that helps to clarify. Let's say the size of dataset is 60 with bins of ...
0
votes
0
answers
39
views
How to build an AWS Lambda of Python 3.10 with detectron2?
I'm building an AWS Lambda with Python 3.10 & detectron2 in it and it's not working at all.
# Use the Python 3.10 base image for AWS Lambda
```
FROM public.ecr.aws/lambda/python:3.10 AS build
```
...
0
votes
0
answers
24
views
AttributeError: Can't get attribute 'RivaGAN' on <module '__main__' from '/data/home/username/miniconda3/envs/video/bin/pytest'
I run the code in pytest and error at import a pt file as name "rivagan_32bit_model.pt".It's also normally running at main like
if __name__ == "__main__":
filePath = '...
0
votes
1
answer
32
views
How to access the weights of a layer in pretrained efficientnet-b3 in torch?
It's not about loading the weights of a model. I am trying to see the weights of layers in loaded efficientnet-b3 model in the torch.
os.system('pip install efficientnet_pytorch')
from ...
0
votes
0
answers
34
views
Mismatch of values after assigning values to a tensor by index
I am writing a PyTorch training code which constructs a class of algorithm. There is a step that needs to assign some values to an internal tensor. However, even if the code is only two lines, there ...
1
vote
1
answer
84
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
88
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
53
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
99
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
43
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 ...
-3
votes
0
answers
82
views
There's no module "torch" but its already in pip list
Traceback (most recent call last): File "c:\Users\cones\OneDrive\Desktop\SeeCamAI (2).py", line 2, in <module> import torch ModuleNotFoundError: No module named 'torch'
I tried to make ...
1
vote
1
answer
37
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
93
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 ...
0
votes
0
answers
47
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 ...
0
votes
0
answers
76
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
290
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.
...
0
votes
1
answer
54
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
42
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 ...
0
votes
1
answer
73
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
64
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
11
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
0
answers
44
views
No matching distribution found for torch==1.9.1
Trying to install torchmeta using google colab but it depends on torch<1.10.0 and >=1.4.0, and whenever i try to install torch 1.9.0 or any version of torch<1.10.0 and >=1.4.0, it gives ...
0
votes
1
answer
40
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
29
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
48
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
16
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
17
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
527
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
1
answer
621
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
58
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
31
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 ...
3
votes
1
answer
79
views
How to implement in pytorch - numpy's .unique WITH(!) return_index = True?
In numpy.unique there is an option return_index=True - which returns positions of unique elements (first occurrence - if several).
Unfortunately, there is no such option in torch.unique !
Question: ...
2
votes
1
answer
38
views
How to optimize Django autoreload / startup process?
I am currently working on a very large Django project that includes many files and, more importantly, a substantial set of dependencies, including packages like Torch and Transformers.
Since ...
0
votes
0
answers
78
views
Title: ImportError: DLL load failed while importing _c_internal_utils and OSError: [WinError 126] with Matplotlib and PyTorch
I'm encountering an ImportError and OSError when trying to import matplotlib, seaborn and torch in my Jupiter libraries environment. The specific error messages are:
Matplotlib and seaborn Error
Torch ...
0
votes
1
answer
34
views
When calling torchvision.transforms.Normalize and converting to PIL.Image, how are values above 1 handled?
Applying torchvision.Normalize should lead to values below 0 and above 1, and thus below 0 and 255 when switching to integer values.
However, when watching the values, this seems NOT to be the case. ...
0
votes
0
answers
20
views
Inconsistent tensor device management detected by autograd
In my code, I encountered issues with tensor device management, specifically with tensors stored in custom containers (TensorPack objects). Initially, tensors were defaulting to CPU, even when the ...
0
votes
2
answers
142
views
yolov9 with gpu on PC
Hello i have a problem or maybe more of a question. Im working on a object detection project i trained my yolov9 model and now i want to test it. But every time i test it i have low fps on my webcam. ...
-1
votes
1
answer
166
views
loading Yolov9 model trained on custom dataset: AttributeError: 'str' object has no attribute 'shape'
I have trained a yolov9 model on custom dataset for instance segmentation, now I want to get segmentation area after segmentation.
An output like the given below image but for each and every object ...
1
vote
0
answers
944
views
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.0 as it may crash, however I have NumPy 1.26.4 installed [duplicate]
I have read all of the other posts about this, but I am already using numpy 1.26.4. I have a conda venv and here is the error:
Python 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:36:39) ...
0
votes
0
answers
26
views
captum.concept.TCAV() custom classifier
I want to change the default classifier of the captum TCAV class with a custom own to do the calculation on the GPU instead and to batch it, because as it is it is slow. With the unchanged Captum ...
0
votes
1
answer
49
views
Understanding and introspecting torch.autograd.backward
In order to locate a bug, I am trying to introspect the backward calculation in PyTorch. Following the description of torch's Autograd mechanics, I added backward hooks to each parameter of my model ...