# ignite

**URL:** https://discuss.pytorch.org/c/ignite/15.md

[Latest](https://discuss.pytorch.org/latest.md) · [Categories](https://discuss.pytorch.org/categories.md)

---

## [About the ignite category](https://discuss.pytorch.org/t/about-the-ignite-category/45318)

<div class="topic-metadata">

**Author:** [@smth](https://discuss.pytorch.org/u/smth)\
**Replies:** 0

</div>

---

## [Average time per epoch calculation on pytorch ignite](https://discuss.pytorch.org/t/average-time-per-epoch-calculation-on-pytorch-ignite/82506)

<div class="topic-metadata">

**Author:** [@Tanya\_Boone](https://discuss.pytorch.org/u/Tanya_Boone)\
**Replies:** 11\
**Last updated:** [December 2, 2024, 1:34pm UTC](https://discuss.pytorch.org/t/average-time-per-epoch-calculation-on-pytorch-ignite/82506 "2024-12-02T13:34:45Z")

</div>

Hello, I need to save a file with the average elapsed time per epoch and I found this function on the documentation: https://pytorch.org/ignite/\_modules/ignite/handlers/timing.html t = Timer(average=True) for \_ in ra…

---

## [Issue with evaluators on binary dataset at higher epoch iterations](https://discuss.pytorch.org/t/issue-with-evaluators-on-binary-dataset-at-higher-epoch-iterations/201825)

<div class="topic-metadata">

**Author:** [@katyapanf](https://discuss.pytorch.org/u/katyapanf)\
**Replies:** 2\
**Last updated:** [April 29, 2024, 8:07pm UTC](https://discuss.pytorch.org/t/issue-with-evaluators-on-binary-dataset-at-higher-epoch-iterations/201825 "2024-04-29T20:07:33Z")

</div>

Hi. I am new to PyTorch (am learning it in Google Colab) and am having an issue I can’t resolve. I am working with the BreastMNIST data set and am processing it as binary data. All worked fine until I reworked it to us…

---

## [Change ProgressBar into simpler output for ascii file](https://discuss.pytorch.org/t/change-progressbar-into-simpler-output-for-ascii-file/201358)

<div class="topic-metadata">

**Author:** [@Jean-Eric\_Campagne](https://discuss.pytorch.org/u/Jean-Eric_Campagne)\
**Replies:** 8\
**Last updated:** [April 22, 2024, 12:33pm UTC](https://discuss.pytorch.org/t/change-progressbar-into-simpler-output-for-ascii-file/201358 "2024-04-22T12:33:45Z")

</div>

Hello, I’ve got a code that uses Ignit although I have never used it before (I have just practiced plain PyTorch). The code is using pbar = ProgressBar(ascii=True) pbar.attach(trainer, metric\_names=monitoring\_metrics…

---

## [Engine run with multi inputs](https://discuss.pytorch.org/t/engine-run-with-multi-inputs/179053)

<div class="topic-metadata">

**Author:** [@Artur\_Punch](https://discuss.pytorch.org/u/Artur_Punch)\
**Replies:** 1\
**Last updated:** [May 3, 2023, 3:03pm UTC](https://discuss.pytorch.org/t/engine-run-with-multi-inputs/179053 "2023-05-03T15:03:45Z")

</div>

I am solving multilabel segmentation task. I want to train model with images and tabular data. So i have custom model class with multi inputs class ContextNet(Module): def \_\_init\_\_(self, classes=10, features=10, dropo…

---

## [Report only Rouge-2-F](https://discuss.pytorch.org/t/report-only-rouge-2-f/165389)

<div class="topic-metadata">

**Author:** [@AfonsoSalgadoSousa](https://discuss.pytorch.org/u/AfonsoSalgadoSousa)\
**Replies:** 1\
**Last updated:** [November 7, 2022, 9:01pm UTC](https://discuss.pytorch.org/t/report-only-rouge-2-f/165389 "2022-11-07T21:01:14Z")

</div>

Hi. I wanted to report just Rouge-2-F, but I cannot find a way to do so. When I attach the RougeN metric, it is a single instance of ignite.metrics.Metric, but when printing it carries Rouge-2-P, Rouge-2-R, Rouge-2-F and…

---

## [Running everything on CPU](https://discuss.pytorch.org/t/running-everything-on-cpu/163485)

<div class="topic-metadata">

**Author:** [@AfonsoSalgadoSousa](https://discuss.pytorch.org/u/AfonsoSalgadoSousa)\
**Replies:** 1\
**Last updated:** [October 13, 2022, 3:40pm UTC](https://discuss.pytorch.org/t/running-everything-on-cpu/163485 "2022-10-13T15:40:36Z")

</div>

Hi. How do I explicit setup Ignite’s configuration to run everything on CPU (like auto\_model and auto\_dataloader to CPU as well)?

---

## [Get current epoch inside process function of evaluator](https://discuss.pytorch.org/t/get-current-epoch-inside-process-function-of-evaluator/162926)

<div class="topic-metadata">

**Author:** [@AfonsoSalgadoSousa](https://discuss.pytorch.org/u/AfonsoSalgadoSousa)\
**Replies:** 1\
**Last updated:** [October 6, 2022, 11:54am UTC](https://discuss.pytorch.org/t/get-current-epoch-inside-process-function-of-evaluator/162926 "2022-10-06T11:54:12Z")

</div>

Hi. I have an evaluation decorated function like: @trainer.on(Events.EPOCH\_COMPLETED(every=cfg.train.validation\_interval)) def run\_validation(): epoch = trainer.state.epoch state = evaluator.run(val\_data…

---

## [Titanic - Neural Network - Two hidden layers – 5 units ReLU and 3 units tanh](https://discuss.pytorch.org/t/titanic-neural-network-two-hidden-layers-5-units-relu-and-3-units-tanh/148761)

<div class="topic-metadata">

**Author:** [@dipakpatadia](https://discuss.pytorch.org/u/dipakpatadia)\
**Replies:** 3\
**Last updated:** [April 13, 2022, 7:48am UTC](https://discuss.pytorch.org/t/titanic-neural-network-two-hidden-layers-5-units-relu-and-3-units-tanh/148761 "2022-04-13T07:48:45Z")

</div>

Want to build a model neural network model using PyTorch library. The model should use two hidden layers: the first hidden layer must contain 5 units using the ReLU activation function; the second layer must contain 3 u…

---

## [Model not saving](https://discuss.pytorch.org/t/model-not-saving/145007)

<div class="topic-metadata">

**Author:** [@AfonsoSalgadoSousa](https://discuss.pytorch.org/u/AfonsoSalgadoSousa)\
**Replies:** 6\
**Last updated:** [February 28, 2022, 12:07pm UTC](https://discuss.pytorch.org/t/model-not-saving/145007 "2022-02-28T12:07:09Z")

</div>

Hi. In a standard train script, I have the following partial function: best\_model\_handler = partial(Checkpoint, {"model": model}, DiskSaver(dirname=cfg.work\_dir.as\_posix(), require\_empty=False), filena…

---

## [Implementation of the multiclass case for precision metric](https://discuss.pytorch.org/t/implementation-of-the-multiclass-case-for-precision-metric/139655)

<div class="topic-metadata">

**Author:** [@jamba\_juice](https://discuss.pytorch.org/u/jamba_juice)\
**Replies:** 4\
**Last updated:** [January 10, 2022, 7:08am UTC](https://discuss.pytorch.org/t/implementation-of-the-multiclass-case-for-precision-metric/139655 "2022-01-10T07:08:05Z")

</div>

Hi, I wanted to try the example of the multiclass case for precision metric from the ignite library with Average=True. I used the exact same values and code but still got an error. I was interested to test out different …

---

## [Building standalone evaluation script](https://discuss.pytorch.org/t/building-standalone-evaluation-script/140969)

<div class="topic-metadata">

**Author:** [@AfonsoSalgadoSousa](https://discuss.pytorch.org/u/AfonsoSalgadoSousa)\
**Replies:** 4\
**Last updated:** [January 7, 2022, 3:48pm UTC](https://discuss.pytorch.org/t/building-standalone-evaluation-script/140969 "2022-01-07T15:48:31Z")

</div>

Hi. I am trying to build a standalone evaluation script using Pytorch Ignite. Yet, I am having trouble getting the desired output. From the following code: evaluator = create\_evaluator(cfg, model, tokenizer, selected\_m…

---

## [Simple ANN model not training](https://discuss.pytorch.org/t/simple-ann-model-not-training/136434)

<div class="topic-metadata">

**Author:** [@paragG](https://discuss.pytorch.org/u/paragG)\
**Replies:** 5\
**Last updated:** [November 17, 2021, 7:27pm UTC](https://discuss.pytorch.org/t/simple-ann-model-not-training/136434 "2021-11-17T19:27:18Z")

</div>

Hi, I am new to PyTorch. I am trying to train a simple ANN model for regression. The issue is my loss doesn’t seem to be changing much over ~10 epochs. The exact same model/loss/optimizer, on the same data shows very dif…

---

## [Distributed training with CPU's](https://discuss.pytorch.org/t/distributed-training-with-cpus/128983)

<div class="topic-metadata">

**Author:** [@lesscomfortable](https://discuss.pytorch.org/u/lesscomfortable)\
**Replies:** 17\
**Last updated:** [August 13, 2021, 7:03pm UTC](https://discuss.pytorch.org/t/distributed-training-with-cpus/128983 "2021-08-13T19:03:49Z")

</div>

Hi! I am interested in possibly using Ignite to enable distributed training in CPU’s (since I am training a shallow network and have no GPU"s available). I tried using ignite.distributed with the gloo backend, but when …

---

## [Issues with Ignite Training Loop but fine with plain Pytorch](https://discuss.pytorch.org/t/issues-with-ignite-training-loop-but-fine-with-plain-pytorch/112725)

<div class="topic-metadata">

**Author:** [@cmdkev](https://discuss.pytorch.org/u/cmdkev)\
**Replies:** 2\
**Last updated:** [February 25, 2021, 2:32pm UTC](https://discuss.pytorch.org/t/issues-with-ignite-training-loop-but-fine-with-plain-pytorch/112725 "2021-02-25T14:32:32Z")

</div>

Hello, I have tabular data and am passing it to a bi-directional LSTM network defined as such: class BiLSTM(nn.Module): def \_\_init\_\_(self, hidden\_size=48, num\_layers=2, inp\_size=5, dropout=0.2): super(BiLSTM…

---

## [Evaluator returns NaN?](https://discuss.pytorch.org/t/evaluator-returns-nan/107972)

<div class="topic-metadata">

**Author:** [@FruitVinegar](https://discuss.pytorch.org/u/FruitVinegar)\
**Replies:** 7\
**Last updated:** [January 18, 2021, 11:51am UTC](https://discuss.pytorch.org/t/evaluator-returns-nan/107972 "2021-01-18T11:51:21Z")

</div>

Hello. I found some weird situation on ignite’s evaluator. I have a pytorch dataloader and well-trained model. when I try to extract output from model manually like below, it works well… logfile = open('logs/manual.lo…

---

## [Multi class classification with ignite](https://discuss.pytorch.org/t/multi-class-classification-with-ignite/108141)

<div class="topic-metadata">

**Author:** [@Tanya\_Boone](https://discuss.pytorch.org/u/Tanya_Boone)\
**Replies:** 6\
**Last updated:** [January 7, 2021, 12:20pm UTC](https://discuss.pytorch.org/t/multi-class-classification-with-ignite/108141 "2021-01-07T12:20:11Z")

</div>

Hello, I am trying to train a custom database that I created and my labels are in the following format: 10988, 10995,10995, etc. So, I’m getting the next error Engine run is terminating due to exception: y\_pred contai…

---

## [Error message Ignite Engine Thread Pickle](https://discuss.pytorch.org/t/error-message-ignite-engine-thread-pickle/104216)

<div class="topic-metadata">

**Author:** [@quornmd](https://discuss.pytorch.org/u/quornmd)\
**Replies:** 4\
**Last updated:** [December 4, 2020, 12:58pm UTC](https://discuss.pytorch.org/t/error-message-ignite-engine-thread-pickle/104216 "2020-12-04T12:58:46Z")

</div>

Hi I am using pytorch ignite wrapped in the MONAI package. My code worked until 3h ago when suddenly I started receiving this code. I reverted all my changes back and the error still persists. Does anyone know more? ERR…

---

## [Pytorch-ignite Training not happening on training set](https://discuss.pytorch.org/t/pytorch-ignite-training-not-happening-on-training-set/103456)

<div class="topic-metadata">

**Author:** [@VikasRajashekar](https://discuss.pytorch.org/u/VikasRajashekar)\
**Replies:** 7\
**Last updated:** [November 20, 2020, 3:29pm UTC](https://discuss.pytorch.org/t/pytorch-ignite-training-not-happening-on-training-set/103456 "2020-11-20T15:29:42Z")

</div>

I suspect there is an issue and the training is somehow picking up my validation set. Here is my sample code. I have modified the code from here: https://github.com/HLTCHKUST/Xpersona/blob/master/multilingual/train\_deco…

---

## [Ignite ConfusionMatrix Metric Error](https://discuss.pytorch.org/t/ignite-confusionmatrix-metric-error/99079)

<div class="topic-metadata">

**Author:** [@Nareg](https://discuss.pytorch.org/u/Nareg)\
**Replies:** 4\
**Last updated:** [October 12, 2020, 2:50pm UTC](https://discuss.pytorch.org/t/ignite-confusionmatrix-metric-error/99079 "2020-10-12T14:50:35Z")

</div>

I have a working ignite setup - precision, recall accuracy all work. However, I am getting a bizarre error when I try to add in ConfusionMatrix(num\_classes=1). Note the batch size is 5, and this pertains to a binary cla…

---

## [FastaiLRFinder does not allow running more than 1 epoch](https://discuss.pytorch.org/t/fastailrfinder-does-not-allow-running-more-than-1-epoch/98274)

<div class="topic-metadata">

**Author:** [@rafaelpadilla](https://discuss.pytorch.org/u/rafaelpadilla)\
**Replies:** 1\
**Last updated:** [October 5, 2020, 9:52am UTC](https://discuss.pytorch.org/t/fastailrfinder-does-not-allow-running-more-than-1-epoch/98274 "2020-10-05T09:52:37Z")

</div>

I have been trying to use the FastaiLRFinder to find the best learning rate for my module. If we create the trainer with the function create\_supervised\_trainer as below: trainer = create\_supervised\_trainer( model, …

---

## [Evaluate multiple models with one evaluator results weird metrics](https://discuss.pytorch.org/t/evaluate-multiple-models-with-one-evaluator-results-weird-metrics/96695)

<div class="topic-metadata">

**Author:** [@FruitVinegar](https://discuss.pytorch.org/u/FruitVinegar)\
**Replies:** 2\
**Last updated:** [September 18, 2020, 7:29am UTC](https://discuss.pytorch.org/t/evaluate-multiple-models-with-one-evaluator-results-weird-metrics/96695 "2020-09-18T07:29:42Z")

</div>

Hello. I have several similar models.(with little variation of some hyperparameters) I am trying to evaluate these models for same dataset with one evaluator, to reduce eval time. So I made custom evaluator like below…

---

## [How access inputs in custom Ignite Metric?](https://discuss.pytorch.org/t/how-access-inputs-in-custom-ignite-metric/91221)

<div class="topic-metadata">

**Author:** [@odats](https://discuss.pytorch.org/u/odats)\
**Replies:** 6\
**Last updated:** [September 16, 2020, 2:05pm UTC](https://discuss.pytorch.org/t/how-access-inputs-in-custom-ignite-metric/91221 "2020-09-16T14:05:43Z")

</div>

I have implemented a custom Ignite Metric based on this tutorial. def update(self, output): y\_pred, y = output How to access inputs (x values) in the update function?

---

## [Problems with Dice Loss in Pytorch Ignite](https://discuss.pytorch.org/t/problems-with-dice-loss-in-pytorch-ignite/94541)

<div class="topic-metadata">

**Author:** [@notacode](https://discuss.pytorch.org/u/notacode)\
**Replies:** 2\
**Last updated:** [August 30, 2020, 10:32am UTC](https://discuss.pytorch.org/t/problems-with-dice-loss-in-pytorch-ignite/94541 "2020-08-30T10:32:54Z")

</div>

Hi, I am having issues with Dice Loss and Pytorch Ignite. I am trying to reproduce the result of Ternausnet using dice loss but my gradients keep being zero and loss just does not improve or shows very strange results (n…

---

## [How to pass additional parameters to forward function during training and validation?](https://discuss.pytorch.org/t/how-to-pass-additional-parameters-to-forward-function-during-training-and-validation/93090)

<div class="topic-metadata">

**Author:** [@odats](https://discuss.pytorch.org/u/odats)\
**Replies:** 1\
**Last updated:** [August 17, 2020, 2:59pm UTC](https://discuss.pytorch.org/t/how-to-pass-additional-parameters-to-forward-function-during-training-and-validation/93090 "2020-08-17T14:59:58Z")

</div>

I use Ignite to train LSTM model based on this tutorial. def forward(self, source, target, teacher\_force\_ratio=0.5): How to pass target and teacher\_force\_ratio during training (teacher\_force\_ratio=0.5) and validation p…

---

## [How to set the same random seed for all workers?](https://discuss.pytorch.org/t/how-to-set-the-same-random-seed-for-all-workers/92253)

<div class="topic-metadata">

**Author:** [@odats](https://discuss.pytorch.org/u/odats)\
**Replies:** 13\
**Last updated:** [August 10, 2020, 4:56pm UTC](https://discuss.pytorch.org/t/how-to-set-the-same-random-seed-for-all-workers/92253 "2020-08-10T16:56:16Z")

</div>

Without setting a random seed the data loader returns the same random data for each epoch: epoch 1: worker1-\>\[2\], worker2-\>\[2\], epoch 2: worker1-\>\[2\], worker2-\>\[2\],... When I set a random seed in worker\_init\_fn functi…

---

## [Distributed error this morning](https://discuss.pytorch.org/t/distributed-error-this-morning/90919)

<div class="topic-metadata">

**Author:** [@pytorchnewbie](https://discuss.pytorch.org/u/pytorchnewbie)\
**Replies:** 1\
**Last updated:** [July 29, 2020, 7:15am UTC](https://discuss.pytorch.org/t/distributed-error-this-morning/90919 "2020-07-29T07:15:31Z")

</div>

Hi, I’m not sure why but today when I run the same code that I ran last night I get this error: from ignite.utils import setup\_logger File "/home/mia/anaconda3/envs/idk/lib/python3.7/site-packages/ignite/\_\_init\_\_.p…

---

## [Computing every iteration, every 20 epochs](https://discuss.pytorch.org/t/computing-every-iteration-every-20-epochs/90810)

<div class="topic-metadata">

**Author:** [@pytorchnewbie](https://discuss.pytorch.org/u/pytorchnewbie)\
**Replies:** 5\
**Last updated:** [July 28, 2020, 3:51pm UTC](https://discuss.pytorch.org/t/computing-every-iteration-every-20-epochs/90810 "2020-07-28T15:51:30Z")

</div>

Hi! What if I wanted to compute something on every batch output (so every iteration), but I only wanted to do this every 20 epochs? How could I do this? Is there a sort of “detach\_event\_handler” as a counterpart to atta…

---

## [Toutorial for ignite](https://discuss.pytorch.org/t/toutorial-for-ignite/90306)

<div class="topic-metadata">

**Author:** [@Aman\_Gupta](https://discuss.pytorch.org/u/Aman_Gupta)\
**Replies:** 2\
**Last updated:** [July 23, 2020, 11:30pm UTC](https://discuss.pytorch.org/t/toutorial-for-ignite/90306 "2020-07-23T23:30:14Z")

</div>

Can anyone suggest me good toutorial for Pytorch ignite. I searched but can’t find anything.

---

## [Add\_event\_handler arguments not passing correctly?](https://discuss.pytorch.org/t/add-event-handler-arguments-not-passing-correctly/90002)

<div class="topic-metadata">

**Author:** [@pytorchnewbie](https://discuss.pytorch.org/u/pytorchnewbie)\
**Replies:** 10\
**Last updated:** [July 21, 2020, 9:44am UTC](https://discuss.pytorch.org/t/add-event-handler-arguments-not-passing-correctly/90002 "2020-07-21T09:44:52Z")

</div>

Hi! So when I do: def log\_engine\_output( engine: Engine, fields: Dict\[LOG\_OP, Union\[List\[str\], List\[VisPlot\], List\[VisImg\]\]\], epoch\_num=None, ) -\> None: """Log numerical fields in the engine output dict…

[Next page](https://discuss.pytorch.org/c/ignite/15.md?page=1)
