PhDSelfHelp / mlmono

Mono repo for all machine learning work.
3 stars 3 forks source link

A clean import method for top level CLI #27

Open jdaaph opened 5 years ago

jdaaph commented 5 years ago

As of now we need to import the class definition manually in cli so that all class definition is called before cli logic is run, how do we do this automatically

FXuZ commented 5 years ago

In addition to that, I find that it is not easy for us to import the computation graph in our current scheme unless either

  1. import everything with the base class, or
  2. we decide a convention on where the graphs should be located

Take the squeeseseg module that you have implemented as an example The example config file goes

graph:
    graph_name: SqueezeSegNet

    ang_filter_coef: 0.02
    ang_theta_a: [.9, .9, .6, .6]

    bi_filter_coef: 0.1
    bilateral_theta_a: [.9, .9, .6, .6]
    bilateral_theta_r: [.015, .015, .01, .01]
    ...

And the definition of the referenced SqueezeSegNet is in the graph.py file within the module, making it hard for the outer layer to manage -- config.yml is read by the top-level module and there is no way for it to know where to find SqueezeSegNet unless it imports everything. Technically, config.yml can be anywhere.

I think it will be better if we make a shared folder that contains only the general computation graphs, or we can specify the top-level module name and make it a convention to put the computation graph in the graph.py file under it.