fix minor issues with lm_decomposition.py pipeline#5
Open
mivanit wants to merge 2 commits intoApolloResearch:feature/unifyfrom
Open
fix minor issues with lm_decomposition.py pipeline#5mivanit wants to merge 2 commits intoApolloResearch:feature/unifyfrom
lm_decomposition.py pipeline#5mivanit wants to merge 2 commits intoApolloResearch:feature/unifyfrom
Conversation
change the pytorch dependency to be '>2.4.1'
because pytorch 2.4.1 does not have `nn.Module.set_submodule()`, running `lm_decomposition.py` gives the error:
```
File "~/apd/spd/experiments/lm/lm_decomposition.py", line 146, in main
optimize(
File "/home/miv/projects/MATS/apd/spd/run_spd.py", line 242, in optimize
layerwise_random_recon_loss = calc_layerwise_recon_loss(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/apd/spd/losses.py", line 135, in calc_layerwise_recon_loss
modified_out = model.forward_with_component(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/apd/spd/models/component_model.py", line 141, in forward_with_component
self.model.set_submodule(module_name, component)
^^^^^^^^^^^^^^^^^^^^^^^^
File "~/apd/.venv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1729, in __getattr__
raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'GPTNeoForCausalLM' object has no attribute 'set_submodule'
```
due to pytorch vuln https://nvd.nist.gov/vuln/detail/CVE-2025-32434 huggingface transformers library doesn't allow loading with weights_only=True so, we add to `lm_decomposition.py:main()` a kwarg `weights_only` passed on to `load_pretrained()`
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
>2.4.1weights_only: boolkwarg tolm_decomposition.py:main()Motivation and Context
<=2.4.1does not havenn.Module.set_submodule(), runninglm_decomposition.pygives the error:weights_only=True, adding a kwarg for this inlm_decomposition.py:main()which is passed on toload_pretrained()Does this PR introduce a breaking change?
Probably not. Most likely to cause issues is the bumping of the pytorch dep.