phylliida / mambalens Goto Github PK
View Code? Open in Web Editor NEWMamba support for transformer lens
License: MIT License
Mamba support for transformer lens
License: MIT License
Compiling a network consisting of InputDependentHookPoint
with fullgraph=True
results in the following error:
File "/opt/conda/lib/python3.10/site-packages/torch/_dynamo/symbolic_convert.py", line 2312, in inline_call_
raise ArgsMismatchError( # noqa: TRY200
torch._dynamo.exc.ArgsMismatchError: got an unexpected keyword argument 'postfix'.
func = 'forward' /opt/venv/lib/python3.10/site-packages/transformer_lens/hook_points.py:127, args = [<class 'mamba_lens.input_dependent_hooks.InputDependentHookPoint'>, <class 'torch.Tensor'>], kwargs = {'postfix': ConstantVariable(str)}
from user code:
File "/opt/venv/lib/python3.10/site-packages/mamba_lens/HookedMamba.py", line 901, in forward
h = self.hook_h(h, postfix=postfix) # [B,E,N]
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
return forward_call(*args, **kwargs)
The below minimal code can be used to reproduce the error
import os
import torch
from mamba_lens import HookedMamba
os.environ["TOKENIZERS_PARALLELISM"] = "false"
model = HookedMamba.from_pretrained("state-spaces/mamba-370m", device='cuda')
input_tensor = model.tokenizer("Hello World", return_tensors="pt").to("cuda")
embs = model.embedding(input_tensor["input_ids"])
compiled_first_block = torch.compile(model.blocks[0], fullgraph=True)
block_output = compiled_first_block(embs)
print(block_output.shape)
I've only compiled the first block because the model as a whole can't be compiled with fullgraph=True
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.