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

'freeze_modules_based_on_opts()' is freezing module parameters twice #11

Closed
hub-bla opened this issue Apr 26, 2024 · 4 comments
Closed
Assignees

Comments

@hub-bla
Copy link

hub-bla commented Apr 26, 2024

Example

opts = argparse.Namespace(**{"model.freeze_modules": "conv1"})


model = nn.Sequential(
     OrderedDict([
          ('conv1', nn.Conv2d(20,64,5)),
          ('conv2', nn.Conv2d(20,64,5))
        ])
)


print(freeze_modules_based_on_opts(opts, model))

example_result

@KRITSABIG
Copy link

Example

opts = argparse.Namespace(**{"model.freeze_modules": "conv1"})


model = nn.Sequential(
     OrderedDict([
          ('conv1', nn.Conv2d(20,64,5)),
          ('conv2', nn.Conv2d(20,64,5))
        ])
)


print(freeze_modules_based_on_opts(opts, model))

example_result

@mustafahadbe
Copy link

Example

opts = argparse.Namespace(**{"model.freeze_modules": "conv1"})


model = nn.Sequential(
     OrderedDict([
          ('conv1', nn.Conv2d(20,64,5)),
          ('conv2', nn.Conv2d(20,64,5))
        ])
)


print(freeze_modules_based_on_opts(opts, model))

example_result

``mu

@Mandeep0001
Copy link

GOT IT

@mohammad7t
Copy link
Collaborator

Freezing modules (i.e. disabling .train()) is different with freezing parameters (i.e. setting requires_grad=False). As this issue is closely related to #10 , I'm closing this one.

@mohammad7t mohammad7t closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 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

No branches or pull requests

5 participants