Questions tagged [pytorch-ignite]
9 questions
4
votes
1 answer
Optuna Pytorch: returned value from the objective function cannot be cast to float
def autotune(trial):
cfg= { 'device' : "cuda" if torch.cuda.is_available() else "cpu",
# 'train_batch_size' : 64,
# 'test_batch_size' : 1000,
# 'n_epochs' : 1,
# 'seed' : 0,
# …

Tonz
- 177
- 1
- 2
- 11
2
votes
2 answers
How can I use the LBFGS optimizer with pytorch ignite?
I started using Ignite recently and i found it very interesting.
I would like to train a model using as an optimizer the LBFGS algorithm from the torch.optim module.
This is my code:
from ignite.engine import Events, Engine,…

Random Cotija
- 613
- 1
- 10
- 26
1
vote
2 answers
using f1 score sklearn in pytorch ignite custom metric
I would like to use the f1_score of sklearn in a custom metric of PyTorch-ignite.
I couldn't find a good solution. although on the official website of PyTorch-ignite, there is a solution of
precision = Precision(average=False)
recall =…

Omid Erfanmanesh
- 547
- 1
- 7
- 29
1
vote
0 answers
ValueError: y and y_pred must have same shape of (batch_size, num_categories, ...) and num_categories > 1
This is my code and I use pytorch-ignite. The shape of sample's labels are (batch_size,) and the outputs of my netwroy as y_pred is (batch_size,10) and 10 is the number of my class. I use criterion = F.cross_entropy as a loss function. after an…

Omid Erfanmanesh
- 547
- 1
- 7
- 29
1
vote
1 answer
Transformers summarization with Python Pytorch - how to get longer output?
I use Ai-powered summarization from https://github.com/huggingface/transformers/tree/master/examples/summarization - state of the art results.
Should i train it myself to get summary output longer than used in original huggingface github training…

Vic Nicethemer
- 1,081
- 3
- 16
- 38
1
vote
1 answer
DiagonalBiLSTM RuntimeError: bool value of Tensor with more than one value is ambiguous
I am trying to implement Diagonal BiLSTM using a torch. I have CBAM model prepared, also spatial gate as mentioned in this article. My code for defining conv2d layer is as follows.
def Conv2D(name, input_dim, output_dim, filter_size, inputs,…

Jayant Chauhan
- 173
- 1
- 12
0
votes
1 answer
PyTorch RuntimeError: Expected target size [8, 1182], got [8, 256]
I have a PyTorch model composed of a Distilbert and a BiLSTM with the following structure. Its purpose involves performing token classification over a vast amount of categories (num_labels=1182) by attaching the output of the transformer to the…

clanofsol
- 93
- 1
- 2
- 13
0
votes
1 answer
Pytorch ignite create_supervised_evaluator not returning the Custom Metrics
I am trying to use create_supervised_evaluator from ignite.engine with my custom Metrics
evaluator = create_supervised_evaluator(model, metrics={'perform': Perform()}, device=device)
But evaluator.state.metrics.keys() is returning empty state…

Prayalankar Ashutosh
- 181
- 7
0
votes
1 answer
Write validation metrics on pytorch-ignite ProgressBar on same line
Is there a way to write validation metrics at the end of the progress bar using pytorch-ignite like in keras?
Right now, I'm using ProgressBar.log_message (example below) to print the relevant metrics, but doing so prints on a new line at the end of…

name.disp
- 252
- 1
- 7