{
  "id": 412618,
  "title": "convert_pix2struct_checkpoint_to_pytorch.py",
  "url": "/competitions/benetech-making-graphs-accessible/discussion/412618",
  "author_name": "pksamantaray",
  "post_date": "2023-05-24T13:02:10.897000",
  "votes": 0,
  "comment_count": 0,
  "views": 0,
  "content": "<p>Hi<br>\nAnybody used following command?<br>\npython convert_pix2struct_checkpoint_to_pytorch.py --t5x_checkpoint_path PATH_TO_T5X_CHECKPOINTS --pytorch_dump_path PATH_TO_SAVE --use-large --is_vqa<br>\nI could not give the correct path in the above command.</p>\n<p>Also I did not get any output from MatchA model.<br>\nfilepath = f'/kaggle/input/benetech-making-graphs-accessible/train/images/{id_}.jpg'   <br>\nimage = cv2.imread(filepath)<br>\nmodel = Pix2StructForConditionalGeneration.from_pretrained(\"google/matcha-plotqa-v2\").to(0)<br>\nprocessor = AutoProcessor.from_pretrained(\"google/matcha-plotqa-v2\", is_vqa=False)<br>\ninputs = processor(images=image, text=\"Generate underlying data table of the figure below:\", return_tensors=\"pt\").to(0)<br>\npredictions = model.generate(**inputs, max_new_tokens=512)<br>\nprocessor.decode(predictions[0], skip_special_tokens=True)</p>\n<p>Please advice.<br>\nI am not expert in using transformer. Any hint will be useful.</p>",
  "messages": [
    {
      "id": 2272400,
      "postDate": "2023-05-24T13:02:10.897Z",
      "content": "<p>Hi<br>\nAnybody used following command?<br>\npython convert_pix2struct_checkpoint_to_pytorch.py --t5x_checkpoint_path PATH_TO_T5X_CHECKPOINTS --pytorch_dump_path PATH_TO_SAVE --use-large --is_vqa<br>\nI could not give the correct path in the above command.</p>\n<p>Also I did not get any output from MatchA model.<br>\nfilepath = f'/kaggle/input/benetech-making-graphs-accessible/train/images/{id_}.jpg'   <br>\nimage = cv2.imread(filepath)<br>\nmodel = Pix2StructForConditionalGeneration.from_pretrained(\"google/matcha-plotqa-v2\").to(0)<br>\nprocessor = AutoProcessor.from_pretrained(\"google/matcha-plotqa-v2\", is_vqa=False)<br>\ninputs = processor(images=image, text=\"Generate underlying data table of the figure below:\", return_tensors=\"pt\").to(0)<br>\npredictions = model.generate(**inputs, max_new_tokens=512)<br>\nprocessor.decode(predictions[0], skip_special_tokens=True)</p>\n<p>Please advice.<br>\nI am not expert in using transformer. Any hint will be useful.</p>",
      "rawMarkdown": "Hi\nAnybody used following command?\npython convert_pix2struct_checkpoint_to_pytorch.py --t5x_checkpoint_path PATH_TO_T5X_CHECKPOINTS --pytorch_dump_path PATH_TO_SAVE --use-large --is_vqa\nI could not give the correct path in the above command.\n\nAlso I did not get any output from MatchA model.\nfilepath = f'/kaggle/input/benetech-making-graphs-accessible/train/images/{id_}.jpg'   \nimage = cv2.imread(filepath)\nmodel = Pix2StructForConditionalGeneration.from_pretrained(\"google/matcha-plotqa-v2\").to(0)\nprocessor = AutoProcessor.from_pretrained(\"google/matcha-plotqa-v2\", is_vqa=False)\ninputs = processor(images=image, text=\"Generate underlying data table of the figure below:\", return_tensors=\"pt\").to(0)\npredictions = model.generate(**inputs, max_new_tokens=512)\nprocessor.decode(predictions[0], skip_special_tokens=True)\n\nPlease advice.\nI am not expert in using transformer. Any hint will be useful."
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2272400": "Hi\nAnybody used following command?\npython convert_pix2struct_checkpoint_to_pytorch.py --t5x_checkpoint_path PATH_TO_T5X_CHECKPOINTS --pytorch_dump_path PATH_TO_SAVE --use-large --is_vqa\nI could not give the correct path in the above command.\n\nAlso I did not get any output from MatchA model.\nfilepath = f'/kaggle/input/benetech-making-graphs-accessible/train/images/{id_}.jpg'   \nimage = cv2.imread(filepath)\nmodel = Pix2StructForConditionalGeneration.from_pretrained(\"google/matcha-plotqa-v2\").to(0)\nprocessor = AutoProcessor.from_pretrained(\"google/matcha-plotqa-v2\", is_vqa=False)\ninputs = processor(images=image, text=\"Generate underlying data table of the figure below:\", return_tensors=\"pt\").to(0)\npredictions = model.generate(**inputs, max_new_tokens=512)\nprocessor.decode(predictions[0], skip_special_tokens=True)\n\nPlease advice.\nI am not expert in using transformer. Any hint will be useful."
  }
}