Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Support non-instance value: class and post-hook #18

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

Asthestarsfalll
Copy link
Owner

@Asthestarsfalll Asthestarsfalll commented Jan 4, 2024

This PR enhance the config rule, introduce the following features:

  1. Use $ prefix to mark the input is class itself instead of its instance.
    [Model.ResNet]
    $backbone = "BasicBlock"
    So the ResNet will get the <class BasicBlock> instead of instance of BasicBlock
  2. Allow calling functions after an instance building, using rule:
    [Optimizer.SGD]
    @parameters = "FCN.parameters"
    So the SGD will get the outpout of method parameters() of FCN , exempting to define confighook.
  3. Above features can be combined. for example, you want to pass output of a static method, you can define cinfig:
    [A.B]
    $arg = "C.method"
    So the @ in the above optimizer example is necessary.
  4. Support chained invocation like FCN.net.block.parameters

Some defects:

  1. Not sure whether the @ and .method is cooperating well, more situation should be tested
  2. If we want to build a module from a static method and pass its parameters to optimizer meanwhile. We cannot define config like this: $@parameters = "Model.build.parameters". So the only way to solve this situation is to use config hook or define a function witch return the output of Model.build in such a case.

@Asthestarsfalll Asthestarsfalll merged commit 9d6a177 into main Jan 4, 2024
1 check passed
@Asthestarsfalll Asthestarsfalll deleted the enchance_config branch January 6, 2024 10:24
@Asthestarsfalll Asthestarsfalll added this to the Infrastructure milestone Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant