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

[New Config] Follow-up & Known issues #1229

Open
HAOCHENYE opened this issue Jul 3, 2023 · 1 comment
Open

[New Config] Follow-up & Known issues #1229

HAOCHENYE opened this issue Jul 3, 2023 · 1 comment

Comments

@HAOCHENYE
Copy link
Collaborator

HAOCHENYE commented Jul 3, 2023

Limitations

The unsupported syntax for New Config, and these syntaxes will not be supported in the future version

  1. The configuration file name must comply with the naming convention of Python modules, which can only contain letters, numbers, and underscores, and cannot start with a number.
  2. When importing variables from the base configuration file, such as from ._base_.alpha import beta, the alpha here must be the module (module) name, i.e., a Python file, rather than the package (package) name containing __init__.py.

Developing

Sytaxes are not supported now but could be supported in the future.

  1. Functions and classes cannot be defined in the configuration file.

  2. Importing multiple variables simultaneously in an absolute import statement, such as import torch, numpy, os, is not supported. Multiple import statements need to be used instead, such as import torch; import numpy; import os.

  3. Cannot put imported module in a list directly like this

    from torch.nn import Linear, Conv2d
    a = dict(args=[Linear, Conv2d])
  4. Dump the class object of Pure Python style config to pure text style, and recover the string back to the class object.
    Pure python style config

    from torch.nn import LInear
    model = dict(type=Linear)

    Dumped cfg

    model = dict(type='torch.nn.Linear')

    Load the dumped cfg

    print(Conig.fromfile(dumped_cfg).model)   # is a string, not nn.Linear
@HAOCHENYE HAOCHENYE pinned this issue Jul 6, 2023
@wangg12
Copy link
Contributor

wangg12 commented Sep 28, 2023

Currently, (recursively) instantiating/building a class or a function without registries is not supported.

It could be supported though, as the document claimed and similar instantiation has been supported in d2's config.

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

No branches or pull requests

2 participants