GithubHelp home page GithubHelp logo

mambalens's People

Contributors

phylliida avatar rhaps0dy avatar taufeeque9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mambalens's Issues

Error on compiling InputDependentHookPoint with fullgraph=True

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.