開始使用免費開始

使用 LayoutLM 進行文件 VQA

從影像 VQA 走向文件 VQA!在這個練習中,你會使用 layoutlm-document-qa 模型,從下列文件影像中判定 2012-2013 年提供給員工的訓練時數總計:

Newsletter from an ICT company

資料集(dataset)已載入,且已匯入 pipeline 模組(pipeline)。

本練習屬於課程

使用 Hugging Face 的多模態模型

檢視課程

練習說明

  • 使用 'document-question-answering' 任務與 'impira/layoutlm-document-qa' checkpoint 載入 pipeline。
  • 以合適的提示,處理 datasettest 集的第 61 筆文件,找出在 2012-2013 年為員工提供了多少天的正式訓練。

動手互動練習

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

# Load the document-question-answering pipeline with the pretrained model
pipe = ____

# Process datapoint 61 to find the amount of training days
result = ____(dataset["____"][61]["____"], "____")

print(result)
編輯並執行程式碼