pytorch / pytorch/ignite

It would be better to make process_function as argument of run instead of the constructor

Open
#388 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-discussion
Dominant language
Python
Stars
4.8k
Forks
726
Avg merge
5d 21h
Merged PRs (30d)
5

Description

In some situation, we'd like to train model in multiple phase with different process function! Current interface design we have to create different trainer, and install the handlers at each trainer. I suggest to make the process_function as an argument of run instead of the constructor, that we can train as below:

trainer = Engine()
# adding checkpoint handlers, logging handlers

# the process function in different training phase
def proc1(engine, batch):
    pass

def proc2(engine, batch):
   pass

# training with different process function sequentially and sharing the engine

trainer.run(proc1, data1, max_epochs=10)
trainer.run(proc2, data2, max_epochs=10) # and we can also use different data

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Engine class and its current constructor and run interfaces, then trace how process_function and handlers are stored across runs. The change is done when sequential runs can use different process functions and datasets while sharing one Engine and its handlers, with tests covering that workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
api, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.