การเทรน AI Model อย่างมีประสิทธิภาพด้วย PyTorch
Dennis Lee
Data Engineer, Amazon
$$


$$


$$


$$


$$
$$
$$





$$

$$

$$

$$






AutoModelForSequenceClassificationfrom transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained(model_name)print(model.config)
DistilBertConfig {
"architectures": ["DistilBertForMaskedLM"],
"dim": 768,
"dropout": 0.1,
"hidden_dim": 3072,
...
Accelerator ตรวจสอบอุปกรณ์ที่ใช้งานได้บนคอมพิวเตอร์accelerator.prepare()torch.nn.Module) บน GPU ตัวแรกที่พร้อมใช้งานfrom accelerate import Accelerator accelerator = Accelerator() model = accelerator.prepare(model)print(accelerator.device)
cpu
การเทรน AI Model อย่างมีประสิทธิภาพด้วย PyTorch