開始使用免費開始

載入並檢視預先訓練的模型

你正在打造一個能以擬人方式對話、涵蓋多種主題的對話式 AI 助理,並運用已在大量文字語料上預先訓練的強大 BERT 模型。

你將列印模型設定,確認你載入的是對話式 AI 模型,且具有特定參數,例如 model_type: bertnum_attention_heads: 12,以及 num_hidden_layers: 12。

本練習屬於課程

使用 PyTorch 高效訓練 AI 模型

檢視課程

練習說明

  • 使用合適的 AutoModel 類別初始化模型參數,載入 bert-base-uncased 模型。
  • 列印模型的設定。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

from transformers import AutoModelForSequenceClassification

# Load a pre-trained bert-base-uncased model
model = ____.____("bert-base-uncased")

# Print the model's configuration
print(model.____)
編輯並執行程式碼