Skip to content

BertViz: “from bertviz.transformers_neuron_view import BertModel” has a RuntimeError #154

@Jerome-ovo

Description

@Jerome-ovo

Information

The problem arises in chapter:

  • Transformer Anatomy

Describe the bug

This happened in Chapter 3.2.1
BertModel imported from "bertviz.transformers_neuron_view" runs incorrectly, while Bertmodel imported from "transformers" does not. When using "from bertviz.transformers_neuron_view import BertModel", my jupyter notebook tells me:

"RuntimeError: unexpected EOF, expected 2255273 more bytes. The file might be corrupted."

I don't follow the recommended version exactly, so it's probably my fault. But I wanted to see if everyone had the same problem, and whether there is a conflict after several updates in BertViz.

To Reproduce

Steps to reproduce the behavior:

1.just run the code in hub

Expected behavior

Since I couldn't install the BertViz in the right way it works, I choose the BertModel from "transformers"(from transformers import BertModel). The code works properly but without that "visaulzation" in this step. However, when using "head_view(attention, tokens, sentence_b_start, heads=[8])"(from bertviz import head_view) for checking the relationship between tokens, it works perfectly.

I hope you will take some time to look at this library. I'm a green-hand in this field, so correct me if I'm wrong.
I'm using:
pytorch 1.13.1+cu116
bertviz 1.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions