question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recently, ESPnet has a lot of duplicated lines in def train(args): ... of ASR, ASR-MIX, LM, MT, TTS, ST, etc. It is hard to maintain and update because lots of complicated things (custom fp, data loader, transfer learning) are copy-and-pasted in the huge GOD functions. I wanna unify those duplicated parts. How about unifying these with extensible OOP-based design?

# task-dependent part
class TaskInterface:
    @staticmethod
    def add_arguments(parser):

    def init_dataset(self, ...):

    def init_model(self, ...):

    def init_criterion(self, ...):

    def init_sampler(self, ...):


# task-independent training loop
class TaskRunner:
    def train(self, task: TaskInterface):

    def eval(self, task: TaskInterface):

    def run(self):

see also: https://github.com/pytorch/fairseq/blob/master/fairseq/tasks/fairseq_task.py

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
ShigekiKaritacommented, Sep 9, 2019

Yeah, I’m also afraid that copying fairseq is not enough for us. My goal is not just splitting task-dependent and task-independent parts because the task-dependent part still can be duplicated.

(I believe that TaskRunner is just a common part of existing Trainer and Evaluator in all the tasks)

However, this idea can make relationship between tasks explicitly (instead of randomly importing symbols). For example, ASR mix class can be derived from ASR. And ST class can be derived from ASR and MT.

2019年9月9日(月) 21:28 Tomoki Hayashi notifications@github.com:

I agree with your idea but I’m wondaring that whether we can remove duplicated lines if we use this OOP design.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/espnet/espnet/issues/1188?email_source=notifications&email_token=ABTOZ3Q4RTWHUJNDTLIECADQIY6NXA5CNFSM4IUYFX2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HMC5Q#issuecomment-529449334, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTOZ3RICTEWWGY7ZVAMOM3QIY6NXANCNFSM4IUYFX2A .

0reactions
stale[bot]commented, May 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Main principles of OOP - EPAM training center
Let's get introduced to the main principles of the object-oriented programming - one of the main programming methodologies, which is based ...
Read more >
Object Oriented Programming: A Breakdown for Beginners
Object oriented programming (or OOP) is a collection of objects (data) ... All doctors must go through the same training, then they go...
Read more >
Java Object Oriented Programming Cheat Sheet - Edureka
The course is designed to give you a head start into Java programming and train you for both core and advanced Java concepts...
Read more >
Python OOP - Object Oriented Programming for Beginners
Learn Object Oriented Programming (OOP) in Python with mini projects, hands-on practice, and carefully designed visual explanations.
Read more >
Object Oriented Programming with Python - YouTube
Object Oriented Programming is an important concept in software development. In this complete tutorial, you will learn all about OOP and how ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found