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.

Refactor away `composer.core`

See original GitHub issue

Refactoring away composer.core will help organize the imports (and thus API reference). For example, the logging base class is in composer.core, but the logger hparams base and logger implementations are in composer.loggers. This complicates the imports, leads to circular dependencies, and reduces the docs readability (since now one must look in two different places for the docs).

Instead, would it be possible to refactor away composer.core? I am thinking of a refactor like the following:

  • composer.core.algorithm -> composer.algorithms.base
  • composer.core.callback -> composer.callbacks.base
  • composer.core.data_spec -> composer.datasets.data_spec
  • composer.core.engine -> composer.engine.engine (new module for composer.engine)
  • composer.core.evaluator -> composer.trainer.evaluator (depends on #329)
  • composer.core.event -> composer.engine.event (new module for composer.engine)
  • composer.core.precision -> composer.types.precision (new module for composer.types)
  • composer.core.profiler -> composer.profiler.profiler (addressed in #422)
  • composer.core.serializable -> composer.types.serializable (new module for composer.types)
  • composer.core.state -> composer.engine.state (new module for composer.engine)
  • composer.core.surgery -> composer.utils.surgery
  • composer.core.time -> composer.time
  • composer.core.types -> composer.types.types (new module for composer.types)
  • composer.core.logging -> composer.logging

Because of integrated core is into the best of the codebase, it would probably be best to move one file per PR.

CC @jbloxham @anisehsani @bandish-shah @ajaysaini725

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ravi-mosaicmlcommented, Feb 8, 2022

The big flag I see here is the interaction between algorithms/callbacks and engine. The algorithm API depends on engine.State, but algorithms themselves are also in the state. Could we just remove algorithms and callbacks from the state?

Yes! See https://github.com/mosaicml/composer/issues/155

0reactions
mvpatel2000commented, Oct 26, 2022

Closing – moved to JIRA and some of this we won’t do

Read more comments on GitHub >

github_iconTop Results From Across the Web

CCS/CODECOMPOSER: How can I find the "refactor ... - TI E2E
To disable simple mode go to the View menu and select Getting Started. Then select no to using Simple Mode. Hi John,
Read more >
Complete Guide to Refactoring Old Code (Part 2): Migrated An ...
This article will outline a practical approach to refactoring legacy code in discrete pieces, each of which may be released and tested ...
Read more >
How To Do Large Scale Refactoring - InfoQ
Refactoring by definition means changing the internal structure of a program without modifying its external functional behavior.
Read more >
[core] Refactor templating management by jimschubert · Pull ...
This refactors template management to get logic out of DefaultGenerator and to provide a cleaner API to template search and read/compile.
Read more >
Refactor bootstrap to better utilize the kernel - Drupal
Make the kernel bootstrap Drupal and itself by adding a static kernel factory method to Drupal\Core\DrupalKernel thus DrupalKernel:: ...
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