on-internet
← Community

Accessing a model's individual layer

Stack Overflow ·

I want to access one of a LLM's individual layers and get output from it (like how nn.Linear() works). I tried using model.layer[0](tokenizer.encode("hi")) but that wouldn't work. If someone can give me the proper way to do this, it would be appreciated. I'm using Python for this with the transformers and Pytorch libraries.

Comments

Sign in or sign up to comment and upvote.

No comments yet.