{
  "id": 409762,
  "title": "Lesson learned the hard way ! Always pay huge attention to versions",
  "url": "/competitions/benetech-making-graphs-accessible/discussion/409762",
  "author_name": "",
  "post_date": "2023-05-12T13:55:18.279766600Z",
  "votes": 11,
  "comment_count": 5,
  "views": 0,
  "content": "<p>Hi,<br>\nI was struggling with many problems in this competition, One that drove me crazy was the differences I see in the results between Colab and Kaggle, which turned out to be related to the Transformers version.</p>\n<p>When I first started to try with pix2struct, deplot, and matcha, I downloaded an offline version of Transformers from the source.<br>\nIt seemed a month ago it was version 4.28 and now it's version 4.30!<br>\nI was training on Colab with an up-to-date version and inference on Kaggle with 4.28, with this competition case (pix2struct active bug fixing) this means different outputs! So now I have to rerun the tests I did (which I was highly surprised by their score, hoping I see something neater!) </p>\n<p>A note to myself always pays huge attention to versions! </p>\n<p>I wanted to share this with you guys incase someone is struggling with something similar. </p>",
  "messages": [
    {
      "id": "2256453",
      "postDate": "05/12/2023 13:55:18",
      "content": "<p>Hi,<br>\nI was struggling with many problems in this competition, One that drove me crazy was the differences I see in the results between Colab and Kaggle, which turned out to be related to the Transformers version.</p>\n<p>When I first started to try with pix2struct, deplot, and matcha, I downloaded an offline version of Transformers from the source.<br>\nIt seemed a month ago it was version 4.28 and now it's version 4.30!<br>\nI was training on Colab with an up-to-date version and inference on Kaggle with 4.28, with this competition case (pix2struct active bug fixing) this means different outputs! So now I have to rerun the tests I did (which I was highly surprised by their score, hoping I see something neater!) </p>\n<p>A note to myself always pays huge attention to versions! </p>\n<p>I wanted to share this with you guys incase someone is struggling with something similar. </p>",
      "rawMarkdown": "Hi,\nI was struggling with many problems in this competition, One that drove me crazy was the differences I see in the results between Colab and Kaggle, which turned out to be related to the Transformers version.\n\nWhen I first started to try with pix2struct, deplot, and matcha, I downloaded an offline version of Transformers from the source.\nIt seemed a month ago it was version 4.28 and now it's version 4.30!\nI was training on Colab with an up-to-date version and inference on Kaggle with 4.28, with this competition case (pix2struct active bug fixing) this means different outputs! So now I have to rerun the tests I did (which I was highly surprised by their score, hoping I see something neater!) \n\nA note to myself always pays huge attention to versions! \n\nI wanted to share this with you guys incase someone is struggling with something similar.",
      "votes": null
    },
    {
      "id": "2256512",
      "postDate": "05/12/2023 14:37:22",
      "content": "<p>This is a very pertinent advice <a href=\"https://www.kaggle.com/asalhi\" target=\"_blank\">@asalhi</a>, we often tend to forget this and this could lead to huge issues and result based volatility as you experienced.<br>\nThanks for letting us  know of your experience so that we could be more careful while working on similar assignments.<br>\nThanks and regards!!</p>",
      "rawMarkdown": "This is a very pertinent advice @asalhi, we often tend to forget this and this could lead to huge issues and result based volatility as you experienced.\nThanks for letting us  know of your experience so that we could be more careful while working on similar assignments.\nThanks and regards!!",
      "votes": null
    },
    {
      "id": "2257187",
      "postDate": "05/13/2023 05:34:17",
      "content": "<p>yea i had this kind of issue, thanks for sharing with this post</p>",
      "rawMarkdown": "yea i had this kind of issue, thanks for sharing with this post",
      "votes": null
    },
    {
      "id": "2262521",
      "postDate": "05/17/2023 02:05:49",
      "content": "<p><a href=\"https://www.kaggle.com/asalhi\" target=\"_blank\">@asalhi</a> How do you train the images on colab? It's very slow to fetch images in google drive.</p>",
      "rawMarkdown": "asalhi How do you train the images on colab? It's very slow to fetch images in google drive.",
      "votes": null
    },
    {
      "id": "2272090",
      "postDate": "05/24/2023 09:41:08",
      "content": "<p>How did you train the model?<br>\nI am getting no output from the following code.</p>\n<p>filepath = 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 any<br>\n hints!</p>",
      "rawMarkdown": "How did you train the model?\nI am getting no output from the following code.\n\n\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 any\n hints!",
      "votes": null
    },
    {
      "id": "2286245",
      "postDate": "06/03/2023 10:26:40",
      "content": "<p>Solution: I download the zip to /content folder and extract the zip there. Just don't extract to mydrive since it's very slow.</p>",
      "rawMarkdown": "Solution: I download the zip to /content folder and extract the zip there. Just don't extract to mydrive since it's very slow.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2256512,
      "author_name": "ravi20076",
      "author_url": "",
      "post_date": "05/12/2023 14:37:22",
      "content": "<p>This is a very pertinent advice <a href=\"https://www.kaggle.com/asalhi\" target=\"_blank\">@asalhi</a>, we often tend to forget this and this could lead to huge issues and result based volatility as you experienced.<br>\nThanks for letting us  know of your experience so that we could be more careful while working on similar assignments.<br>\nThanks and regards!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2257187,
      "author_name": "aisuluuulankyzy",
      "author_url": "",
      "post_date": "05/13/2023 05:34:17",
      "content": "<p>yea i had this kind of issue, thanks for sharing with this post</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2262521,
      "author_name": "homoalways",
      "author_url": "",
      "post_date": "05/17/2023 02:05:49",
      "content": "<p><a href=\"https://www.kaggle.com/asalhi\" target=\"_blank\">@asalhi</a> How do you train the images on colab? It's very slow to fetch images in google drive.</p>",
      "votes": null,
      "replies": [
        {
          "id": 2286245,
          "author_name": "homoalways",
          "author_url": "",
          "post_date": "06/03/2023 10:26:40",
          "content": "<p>Solution: I download the zip to /content folder and extract the zip there. Just don't extract to mydrive since it's very slow.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2272090,
      "author_name": "pksamantaray",
      "author_url": "",
      "post_date": "05/24/2023 09:41:08",
      "content": "<p>How did you train the model?<br>\nI am getting no output from the following code.</p>\n<p>filepath = 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 any<br>\n hints!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2256453": "Hi,\nI was struggling with many problems in this competition, One that drove me crazy was the differences I see in the results between Colab and Kaggle, which turned out to be related to the Transformers version.\n\nWhen I first started to try with pix2struct, deplot, and matcha, I downloaded an offline version of Transformers from the source.\nIt seemed a month ago it was version 4.28 and now it's version 4.30!\nI was training on Colab with an up-to-date version and inference on Kaggle with 4.28, with this competition case (pix2struct active bug fixing) this means different outputs! So now I have to rerun the tests I did (which I was highly surprised by their score, hoping I see something neater!) \n\nA note to myself always pays huge attention to versions! \n\nI wanted to share this with you guys incase someone is struggling with something similar.",
    "2256512": "This is a very pertinent advice @asalhi, we often tend to forget this and this could lead to huge issues and result based volatility as you experienced.\nThanks for letting us  know of your experience so that we could be more careful while working on similar assignments.\nThanks and regards!!",
    "2257187": "yea i had this kind of issue, thanks for sharing with this post",
    "2262521": "asalhi How do you train the images on colab? It's very slow to fetch images in google drive.",
    "2272090": "How did you train the model?\nI am getting no output from the following code.\n\n\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 any\n hints!",
    "2286245": "Solution: I download the zip to /content folder and extract the zip there. Just don't extract to mydrive since it's very slow."
  },
  "source": "meta"
}