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

Model is None #23

Closed
shi27feng opened this issue Mar 5, 2021 · 2 comments
Closed

Model is None #23

shi27feng opened this issue Mar 5, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@shi27feng
Copy link
Contributor

Hi @vballoli,
It seems to have a bug in the code of AGC:

if model is not None:
    assert ignore_agc not in [None, []], "You must specify ignore_agc for AGC to ignore fc-like(or other) layers"
    names = [name for name, module in model.named_modules()]

    for module_name in ignore_agc:
        if module_name not in names:
            raise ModuleNotFoundError("Module name {} not found in the model".format(module_name))
        params = [{"params": list(module.parameters())} for name,
                          module in model.named_modules() if name not in ignore_agc]
else:
    params = [{"params": list(module.parameters())} for name,
                       module in model.named_modules()]

When model is None then the else part of the code cannot get name and module from model.named_modules().

Thanks

@vballoli
Copy link
Owner

vballoli commented Mar 9, 2021

My bad, thanks for raising this issue. I'll add a fix soon.

@vballoli vballoli self-assigned this Mar 9, 2021
@vballoli vballoli added the bug Something isn't working label Mar 9, 2021
@vballoli
Copy link
Owner

vballoli commented Mar 9, 2021

Fixed in the latest commit. Thanks for reporting!

@vballoli vballoli closed this as completed Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants