GithubHelp home page GithubHelp logo

RecursionError: maximum recursion depth exceeded while calling a Python object. When compiling a transformer model with JIT about adapters HOT 1 OPEN

Sardhendu avatar Sardhendu commented on June 7, 2024
RecursionError: maximum recursion depth exceeded while calling a Python object. When compiling a transformer model with JIT

from adapters.

Comments (1)

TimoImhof avatar TimoImhof commented on June 7, 2024

Hi @Sardhendu, thanks for opening this issue.

The adapter-transformer package is deprecated and the new and actively maintained package we provide is the adapters package (see here or #584 for more information).

However, I tried to reproduce the error with the new package and it is still possible; here is my slimmed-down version to reproduce the error with adapters:

from transformers import  CLIPModel
import torch
import torch.nn as nn
from adapters import init

testmodel = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
testmodel.eval()
# enable adapter support
init(testmodel)

shape = [1, 3, 224, 224]
_random_example = torch.rand(shape, requires_grad=False, dtype=torch.float32)
x = torch.index_select(
    _random_example,
    dim=0,
    index=torch.Tensor([0]).to(dtype=torch.int32),
)
print(x)
_inputs = {"X": x}

traced_model = torch.jit.trace(
    testmodel, 
    example_inputs=(
        _inputs["X"], 
    )
)
torch.jit.save(traced_model, "jit_model.pth")

Since this problem still exists in the new package I will have a look into this and get back to you.
If you have gained any new insights since you posted this issue, please let me know.

Cheers,
Timo

from adapters.

Related Issues (20)

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.