Open Butanium opened 1 month ago
@JadenFiotto-Kaufman I can try to add tests if needed but I wanted to first check if you were ok with adding this feature to the nnsight core.
@JadenFiotto-Kaufman I can try to add tests if needed but I wanted to first check if you were ok with adding this feature to the nnsight core.
Hey this is an awesome idea and something I've wanted to add to nnsight. Essentially we want aliasing right?
I think it should be a dictionary where the keys are valid regex strings that map to an alias. This dictionary would live at Envoy._aliases and would be checked on the Envoy.getattr method. If a key matches the reverse mapping, it returns the real underlying envoy for that alias.
Does that sound like a good solution?
Hmm, would you still pass the alias dict through the NNSight class init?
I guess one advantage of renaming over aliasing is that when you print the model, you actually see modules' new names.
What advantage do you see of using aliasing instead of renaming?
@JadenFiotto-Kaufman bump
After discussing with @cadentj some alternatives to transformer_lens (which sometimes has a significant implementation gap with HuggingFace), he suggested adding a renaming feature to nnsight itself, as it might be useful not only for transformers.
The basic usage would be to convert module names from, e.g., GPT-2 to the standard LLaMA / Gemma format using:
The basic usage would be to convert module names from e.g. gpt2 to the standard llama / gemma format using