Fix remote execution for encoder models - #700
Open
elliottower wants to merge 2 commits into
Open
Conversation
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.
Hi all, greatly appreciate all the hard work that goes into NDIF. I am working on a mechinterp project on RNA and DNA foundation models and was looking into whether it was possible to run them here, and it looks like with these two bug fixes it will be. It should also help anyone else who wants to run encoder models in the future. Thanks.
1. Envoy classes for modules that define
.outputcan't be pickled_handle_overloaded_mountbuilds a class per Envoy instance named<cls>.Preserved. The dot makes the name unresolvable and the class is never bound in a module, so pickle can't serialize it:Remotely this shows up as
RemoteException: name 'hooked_output' is not defined. It hits any model with aninputoroutputsubmodule, so all of BERT and ESM (BertLayer.outputis aBertOutput). Decoder-only models never take this path, which is why they work today and encoders don't.(base class, mount point)and bound into the module that defines the base__dict__2.
automodelisn't sent to the serverLanguageModel._remoteable_model_keyserializes onlyrepo_idandrevision, so the server rebuilds every model asAutoModelForCausalLM:automodelis now in the key_remoteable_from_model_keyalready merges the key JSON into constructor kwargs, andTransformersMixinresolves a string automodel, so no server change is neededTests
tests/test_envoy_overloaded_mount.py, tiny models, no cluster needed. 3 fail on main, all pass here. The two remote tests skip withoutNDIF_KEY.Reproduced and fixed on two independent stacks:
Same failure and same fix on both, spanning transformers 4.x and 5.x and torch either side of the
>=2.4.0floor. On Linux I ran this branch against main in the same container:tests/test_tiny.pypasses on both