Skip to content

cannot import name 'is_torch_xla_available' from 'transformers' #29749

Description

@YooSungHyun

System Info

transformers==4.38.2
torch==2.2.1

rtx 3090 * 4 and cuda 12.1

Who can help?

@muellerz @pacman100 @stevhliu

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

  1. run https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling 's run_clm.py
  2. use this script
python run_clm.py \
    --model_name_or_path openai-community/gpt2 \
    --dataset_name wikitext \
    --dataset_config_name wikitext-2-raw-v1 \
    --per_device_train_batch_size 8 \
    --per_device_eval_batch_size 8 \
    --do_train \
    --do_eval \
    --output_dir /tmp/test-clm
  1. raised error like cannot import name 'is_torch_xla_available' from 'transformers' at 49 line

Expected behavior

import is success

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