Git Product home page Git Product logo

Comments (2)

aRI0U avatar aRI0U commented on September 27, 2024 1

Indeed your solution works.

I initially tried something similar but since I put register_new_resolver() inside my if __name__ == '__main__': block it wasn't executed, which made me (wrongly) think that when using the dora command, only the piece of code inside hydra_main was executed.

Maybe mentioning this point in the README could be helpful, insisting on the fact that the register_new_resolver should be outside of the if __name__ == '__main__', which is a bit unusual.

Thanks a lot!

from dora.

adefossez avatar adefossez commented on September 27, 2024

I'm wondering why not do it outside of my_hydra_main ? it doesn't seem like you are using any of the Hydra API to register new resolver, so you could have something like

def register_my_resolver():
    for name, resolver in extra_resolvers.items():
        OmegaConf.register_new_resolver(name, resolver)

@hydra_main(...)
def main(cfg):
    ...

register_my_resolver()

Note that the position of the call to register_my_resolver() doesn't actually matter, and could be before main(). I would tend to favor this option as this makes it clear from the code, that the registration of the resolvers will leak to any other call to OmegaConf, and I would tend to think a PR is not needed for that use case. Potentially an update to the README to show this pattern.

Regarding question 1., get_xp() needs to resolve the config because this is how the signature is actually derived. It will resolve the full config, compare it with the base config and build a delta. The hash of the delta is then the signature.

from dora.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.