TFTrainerArguments: ImportError: Method `device` requires PyTorch.
from transformers import TFTrainer, TFTrainingArguments
training_args = TFTrainingArguments(output_dir='models',   
                                    num_train_epochs=1,             
                                    per_device_train_batch_size=32, 
                                    per_device_eval_batch_size=32,  
                                    warmup_steps=500,               
                                    weight_decay=0.05,              
                                    logging_dir='logs'
                                   )

Above code produces the following error:

ImportError                               Traceback (most recent call last)
<ipython-input-3-017a860e7c76> in <module>
      5                                     warmup_steps=500,
      6                                     weight_decay=0.05,
----> 7                                     logging_dir='logs'
      8                                    )

<string> in __init__(self, output_dir, overwrite_output_dir, do_train, do_eval, do_predict, evaluate_during_training, evaluation_strategy, prediction_loss_only, per_device_train_batch_size, per_device_eval_batch_size, per_gpu_train_batch_size, per_gpu_eval_batch_size, gradient_accumulation_steps, eval_accumulation_steps, learning_rate, weight_decay, adam_beta1, adam_beta2, adam_epsilon, max_grad_norm, num_train_epochs, max_steps, warmup_steps, logging_dir, logging_first_step, logging_steps, save_steps, save_total_limit, no_cuda, seed, fp16, fp16_opt_level, local_rank, tpu_num_cores, tpu_metrics_debug, debug, dataloader_drop_last, eval_steps, dataloader_num_workers, past_index, run_name, disable_tqdm, remove_unused_columns, label_names, load_best_model_at_end, metric_for_best_model, greater_is_better, tpu_name, poly_power, xla)

/usr/local/lib/python3.6/dist-packages/transformers/training_args.py in __post_init__(self)
    352             self.run_name = self.output_dir
    353 
--> 354         if self.device.type != "cuda" and self.fp16:
    355             raise ValueError("AMP (`--fp16`) can only be used on CUDA devices.")
    356 

/usr/local/lib/python3.6/dist-packages/transformers/file_utils.py in wrapper(*args, **kwargs)
   1171             return func(*args, **kwargs)
   1172         else:
-> 1173             raise ImportError(f"Method `{func.__name__}` requires PyTorch.")
   1174 
   1175     return wrapper

ImportError: Method `device` requires PyTorch.

Seems like a bug?
Indeed. It has been fixed on master and will be in the next release (early next week). In the meantime you can install from source to have the fix.<|||||>Ah ok, thanks for the quick response 👍 