[英]Test Intel Extension for Pytorch(IPEX) in multiple-choice from huggingface / transformers
我正在嘗試使用 SWAG 數據集https://github.com/huggingface/transformers/tree/master/examples/pytorch/multiple-choice 的一個擁抱臉樣本
我想在我的代碼中使用 Intel Extension for Pytorch 來提高性能。
在這里,我使用的是未經培訓的 (run_swag_no_trainer)
在 run_swag_no_trainer.py 中,我進行了一些更改以使用 ipex 。 #更改前的代碼如下:
device = accelerator.device
model.to(device)
#添加ipex后:
import intel_pytorch_extension as ipex
device = ipex.DEVICE
model.to(device)
在運行以下命令時,它花費了太多時間。
export DATASET_NAME=swag
accelerate launch run_swag_no_trainer.py \
--model_name_or_path bert-base-cased \
--dataset_name $DATASET_NAME \
--max_seq_length 128 \
--per_device_train_batch_size 32 \
--learning_rate 2e-5 \
--num_train_epochs 3 \
--output_dir /tmp/$DATASET_NAME/
有沒有其他方法可以在 intel ipex 上測試相同的內容?
首先,您必須了解哪些因素實際上會增加運行時間。 以下是這些因素:
為了快速運行,請確保處理上述因素,例如:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.