Git Product home page Git Product logo

Comments (5)

JohnGiorgi avatar JohnGiorgi commented on July 23, 2024

Hi, could you provide more detail? Could you share the stacktrace of the error for example?

from declutr.

ZahraGhasemi-AI avatar ZahraGhasemi-AI commented on July 23, 2024

I got this error at first:
...
File "/media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_utils.py", line 625, in from_pretrained
pretrained_model_name_or_path,
OSError: Error no file named ['pytorch_model.bin', 'tf_model.h5', 'model.ckpt.index'] found in directory electra-small or from_tf set to False

then I set from_tf to True and I got another error:
...
File "/media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_electra.py", line 100, in load_tf_weights_in_electra
assert pointer.shape == array.shape, original_name
AssertionError: ('electra/encoder/layer_0/attention/self/key/bias', torch.Size([252]), (256,))

and when I used bert-base-multilingual-cased(tf version) as a transformer, I got this:
...
model = load_tf2_checkpoint_in_pytorch_model(model, resolved_archive_file, allow_missing_keys=True)
File "/media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_tf_pytorch_utils.py", line 252, in load_tf2_checkpoint_in_pytorch_model
tf_model_class = getattr(transformers, tf_model_class_name)
AttributeError: module 'transformers' has no attribute 'TFBertForMaskedLM'

but when I used bert-base-multilingual-cased(pytorch version), it run correctly, so the problem is about load tf1...

from declutr.

JohnGiorgi avatar JohnGiorgi commented on July 23, 2024

Hmm, these errors are coming from the transformers package, not declutr. The stack trace shows the following files:

  • /media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_utils.py
  • /media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_electra.py
  • /media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_tf_pytorch_utils.py

What is the value of pretrained_model_name_or_path? Can you try loading it outside of declutr, e.g.

from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained(pretrained_model_name_or_path)
tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path)

from declutr.

ZahraGhasemi-AI avatar ZahraGhasemi-AI commented on July 23, 2024

I tried it and got same error:
Traceback (most recent call last):
File..............., line 3, in
model = AutoModel.from_pretrained('/media/2TB_2/ZGH/DontDelet/MyDeCLUTR/DeCLUTR/bert-base-multilingual-cased')
File "/media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_auto.py", line 502, in from_pretrained
return model_class.from_pretrained(pretrained_model_name_or_path, *model_args, config=config, **kwargs)
File "/media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_utils.py", line 696, in from_pretrained
model = load_tf2_checkpoint_in_pytorch_model(model, resolved_archive_file, allow_missing_keys=True)
File "/media/2TB_2/ZGH/DontDelet/venv3.6.9/lib/python3.6/site-packages/transformers/modeling_tf_pytorch_utils.py", line 252, in load_tf2_checkpoint_in_pytorch_model
tf_model_class = getattr(transformers, tf_model_class_name)
AttributeError: module 'transformers' has no attribute 'TFBertModel'

from declutr.

JohnGiorgi avatar JohnGiorgi commented on July 23, 2024

Right, so this suggests the problem is with transformers, not declutr. You may have to ask for help on the transformers repo!

from declutr.

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.