RuntimeError when running on Colab GPU

Hello,

I am trying to train a model for token classification (NER), more or less following the example on the Huggingface course on Token Classification.

When I attempt to initiate arguments, using transformers.TrainingArguments, as below:

from transformers import TrainingArguments

args = TrainingArguments(
    "bert-finetuned-ner",
    evaluation_strategy="epoch",
    save_strategy="epoch",
    learning_rate=2e-5,
    num_train_epochs=3,
    weight_decay=0.01,
    push_to_hub=True,
)

I get the error:

RuntimeError: Failed to import transformers.training_args because of the following error (look up to see its traceback):
/usr/local/lib/python3.7/dist-packages/_XLAC.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN2at13_foreach_erf_EN3c108ArrayRefINS_6TensorEEE

Why is this? Is this a bug for transformers on Colab GPUs?

1 Like

Can you provide a Colab to reproduce this error? What’s your Transformers version?

Same issue here when following the Fine-tuning a masked language model tutorial with a GPU Colab instance, which installs transformers v4.12.5 and torch v1.10. Could this be linked to the installation of pytorch from a TPU wheel https://storage.googleapis.com/tpu-pytorch/wheels/torch_xla-1.9-cp37-cp37m-linux_x86_64.whl in the first cell?

EDIT: opened an issue in the notebooks repo: `undefined symbol` error when running chapter 7 notebooks on a GPU instance · Issue #120 · huggingface/notebooks · GitHub