Camemberta-base not working anymore (in the google colab env at least)

#1
by jvelcin - opened

Hi there,

It seems Camemberta-base is not longer working in the google colab environment. Here is the error I get just by copy-paste the demo code given by the authors. If I add the option "from_tf=True", I get another error seemingly related to keras (see below).

First error:

OSError Traceback (most recent call last)
in <cell line: 6>()
4 tokenizer = AutoTokenizer.from_pretrained("almanach/camemberta-base")
5
----> 6 CamemBERTa_gen = AutoModelForMaskedLM.from_pretrained("almanach/camemberta-base-generator")
7 tokenizer_gen = AutoTokenizer.from_pretrained("almanach/camemberta-base-generator")

1 frames
/usr/local/lib/python3.10/dist-packages/transformers/modeling_utils.py in from_pretrained(cls, pretrained_model_name_or_path, config, cache_dir, ignore_mismatched_sizes, force_download, local_files_only, token, revision, use_safetensors, *model_args, **kwargs)
3632 }
3633 if has_file(pretrained_model_name_or_path, TF2_WEIGHTS_NAME, **has_file_kwargs):
-> 3634 raise EnvironmentError(
3635 f"{pretrained_model_name_or_path} does not appear to have a file named"
3636 f" {_add_variant(WEIGHTS_NAME, variant)} but there is a file for TensorFlow weights."

OSError: almanach/camemberta-base-generator does not appear to have a file named pytorch_model.bin but there is a file for TensorFlow weights. Use from_tf=True to load this model from those weights.

Second error when adding the option from_tf=True :

Loading a TensorFlow model in PyTorch, requires both PyTorch and TensorFlow to be installed. Please see https://pytorch.org/ and https://www.tensorflow.org/install/ for installation instructions.

ModuleNotFoundError Traceback (most recent call last)
in <cell line: 6>()
4 tokenizer = AutoTokenizer.from_pretrained("almanach/camemberta-base")
5
----> 6 CamemBERTa_gen = AutoModelForMaskedLM.from_pretrained("almanach/camemberta-base-generator", from_tf=True)
7 tokenizer_gen = AutoTokenizer.from_pretrained("almanach/camemberta-base-generator", from_tf=True)

3 frames
/usr/local/lib/python3.10/dist-packages/transformers/modeling_tf_utils.py in
74 if parse(tf.version).minor >= 13:
75 from keras import backend as K
---> 76 from keras.internal import KerasTensor
77 from keras.src.engine.base_layer_utils import call_context
78 elif parse(tf.version).minor >= 11:

ModuleNotFoundError: No module named 'keras.internal'


NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.

ALMAnaCH (Inria) org

Hey, i just tried loading the generator from tf and it worked

https://colab.research.google.com/drive/1HDQhWoWXFJBN8fcJLR6RB3IHxVK3lFaH?usp=sharing

Also you are posting this issue of the discriminator model, which is the actual useful model

You're right. It seems I used an obsolete version of transformer lib. I retry and now it works. Thank you,
Julien

wissamantoun changed discussion status to closed

Sign up or log in to comment