Created
September 24, 2023 06:17
-
-
Save OhadRubin/4bd4dedbab23d79c84b4b76d257929c7 to your computer and use it in GitHub Desktop.
A simple example of using gin with absl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fire | |
import gin | |
from absl import flags | |
from absl import app | |
flags.DEFINE_multi_string( | |
'gin_file', None, 'List of paths to the config files.') | |
flags.DEFINE_multi_string( | |
'gin_param', None, 'Newline separated list of Gin parameter bindings.') | |
FLAGS = flags.FLAGS | |
@gin.configurable | |
def double(number, const=2): | |
return const * number | |
def main(argv) -> None: | |
gin.parse_config_files_and_bindings(FLAGS.gin_file, FLAGS.gin_param) | |
print(double(2)) | |
if __name__ == "__main__": | |
app.run(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment