pytorch

Pytorch, INPUT (normal tensor) and WEIGHT (cuda tensor) mismatch

孤街浪徒 提交于 2021-01-29 05:26:23
问题 DISCLAIMER I know, this question has already asked multiple times, but i tried their solutions, none of them worked for me, so after all those effort, i can't find anything else and eventually i have to ask again. I'm doing image classification with cnns (PYTORCH), i wan't to train it on GPU (nvidia gpu, compatible with cuda/cuda installed), i successfully managed to put net on it, but the problem is with data. if torch.cuda.is_available(): device = torch.device("cuda:0") print("Running on

Pytorch gpu usage is low

微笑、不失礼 提交于 2021-01-29 05:06:16
问题 I am trying the example of pytorch from https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html. When i run this example, the GPU usage is ~1% and finish time is 130s While for CPU case, the CPU usage get ~90% and finish time is 79s My CPU is Intel(R) Core(TM) i7-8700 and my GPU is NVIDIA GeForce RTX 2070. I want to ask if it is normal that CPU is running faster than GPU ? Because the GPU usage is so small (compare with what i see from another website) Here is the code i run

Which parameters of Mask-RCNN control mask recall?

£可爱£侵袭症+ 提交于 2021-01-29 05:02:25
问题 I'm interested in fine-tuning a Mask-RCNN model that I'm using for instance segmentation. Currently I have trained the model for 6 epochs and the various Mask-RCNN losses are as follows: The reason I'm stopping is that the COCO evaluation metrics seem to have dipped in the last epoch: I know this is a far reaching question, but I'm looking to gain some intuition of how to understand which parameters are going to be the most impactful in improving the evaluation metrics. I understand there are

How to implement a gaussian renderer with mean and variance values as input in any deep modeling framework (needs to be back-propagable)

有些话、适合烂在心里 提交于 2021-01-29 04:32:54
问题 Imagine a typical auto-encoder-decoder model. However, instead of a general decoder where deconvoutions together with upscaling are used to create/synthesize a tensor similar to the model's input, I need to implement a structured/custom decoder. Here, I need the decoder to take its input, e.g. a 10x2 tensor where each row represents x,y positions or coordinates, and render a fixed predefined size image where there are 10 gaussian distributions generated at the location specified by the input.

CNN pytorch : How are parameters selected and flow between layers

寵の児 提交于 2021-01-29 04:23:49
问题 I'm pretty new to CNN and have been following the below code. I'm not able to understand how and why have we selected the each argument of Conv2d() and nn.Linear () as they are i.e. the output, filter, channels, weights,padding and stride. I do understand the meaning of each though. Can someone very succinctly explain the flow for each layer? (Input Image Size is 32*32*3) import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__(

CNN pytorch : How are parameters selected and flow between layers

↘锁芯ラ 提交于 2021-01-29 04:23:28
问题 I'm pretty new to CNN and have been following the below code. I'm not able to understand how and why have we selected the each argument of Conv2d() and nn.Linear () as they are i.e. the output, filter, channels, weights,padding and stride. I do understand the meaning of each though. Can someone very succinctly explain the flow for each layer? (Input Image Size is 32*32*3) import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__(

Determine whether a model is pytorch model or a tensorflow model or scikit model

▼魔方 西西 提交于 2021-01-29 00:39:41
问题 If I want to determine the type of model i.e. from which framework was it made programmatically, is there a way to do that? I have a model in some serialized manner(Eg. a pickle file). For simplicity purposes, assume that my model can be either tensorflow's, pytorch's or scikit learn's. How can I determine programmatically which one of these 3 is the one? 回答1: AFAIK, I have never heard of Tensorflow/Keras and Pytorch models to be saved with pickle or joblib - these frameworks provide their

Determine whether a model is pytorch model or a tensorflow model or scikit model

二次信任 提交于 2021-01-29 00:36:15
问题 If I want to determine the type of model i.e. from which framework was it made programmatically, is there a way to do that? I have a model in some serialized manner(Eg. a pickle file). For simplicity purposes, assume that my model can be either tensorflow's, pytorch's or scikit learn's. How can I determine programmatically which one of these 3 is the one? 回答1: AFAIK, I have never heard of Tensorflow/Keras and Pytorch models to be saved with pickle or joblib - these frameworks provide their

How can I express this custom loss function in tensorflow?

放肆的年华 提交于 2021-01-28 22:03:12
问题 I've got a loss function that fulfills my needs, but is only in PyTorch. I need to implement it into my TensorFlow code, but while most of it can trivially be "translated" I am stuck with a particular line: y_hat[:, torch.arange(N), torch.arange(N)] = torch.finfo(y_hat.dtype).max # to be "1" after sigmoid You can see the whole code in following and it is indeed pretty straight forward except for that line: def get_loss(y_hat, y): # No loss on diagonal B, N, _ = y_hat.shape y_hat[:, torch

Confusion in understanding the output of BERTforTokenClassification class from Transformers library

旧巷老猫 提交于 2021-01-28 19:04:01
问题 It is the example given in the documentation of transformers pytorch library from transformers import BertTokenizer, BertForTokenClassification import torch tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') model = BertForTokenClassification.from_pretrained('bert-base-uncased', output_hidden_states=True, output_attentions=True) input_ids = torch.tensor(tokenizer.encode("Hello, my dog is cute", add_special_tokens=True)).unsqueeze(0) # Batch size 1 labels = torch.tensor([1] * input