{
  "id": 409680,
  "title": "How to use DePlot without Internet",
  "url": "/competitions/benetech-making-graphs-accessible/discussion/409680",
  "author_name": "",
  "post_date": "2023-05-12T05:12:35.855953400Z",
  "votes": null,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Hi guys, recently I found that in order to submit my code, I need to disable the internet. But I found that the hugging face deplot model I used need to connect to the Internet to download something when I tried to run the following code:</p>\n<p>deplot_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")<br>\ndeplot_model = Pix2StructForConditionalGeneration.from_pretrained('google/deplot').to(device)<br>\ndeplot_processor = Pix2StructProcessor.from_pretrained('google/deplot')</p>\n<p>Is there any way to bypass this? Thanks a lot for helping with this! </p>",
  "messages": [
    {
      "id": "2255910",
      "postDate": "05/12/2023 05:12:35",
      "content": "<p>Hi guys, recently I found that in order to submit my code, I need to disable the internet. But I found that the hugging face deplot model I used need to connect to the Internet to download something when I tried to run the following code:</p>\n<p>deplot_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")<br>\ndeplot_model = Pix2StructForConditionalGeneration.from_pretrained('google/deplot').to(device)<br>\ndeplot_processor = Pix2StructProcessor.from_pretrained('google/deplot')</p>\n<p>Is there any way to bypass this? Thanks a lot for helping with this! </p>",
      "rawMarkdown": "Hi guys, recently I found that in order to submit my code, I need to disable the internet. But I found that the hugging face deplot model I used need to connect to the Internet to download something when I tried to run the following code:\n\ndeplot_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\ndeplot_model = Pix2StructForConditionalGeneration.from_pretrained('google/deplot').to(device)\ndeplot_processor = Pix2StructProcessor.from_pretrained('google/deplot')\n\nIs there any way to bypass this? Thanks a lot for helping with this!",
      "votes": null
    },
    {
      "id": "2256144",
      "postDate": "05/12/2023 09:30:19",
      "content": "<p>Unfortunately, it is not possible to use the Hugging Face DePlot model without an internet connection as the model needs to be downloaded from the Hugging Face model hub. However, there are a few workarounds you could try:</p>\n<p>Download the DePlot model and its associated files beforehand, while you still have internet connectivity, and then use them offline. You can download the model and files using the transformers-cli command line interface provided by Hugging Face. </p>\n<p>transformers-cli download google/deplot</p>\n<p>This will download the DePlot model and its associated files to your local machine.<br>\nOnce you have downloaded the model and files, you can use them offline by changing the path to the local directory where you downloaded them. For example:</p>\n<p>deplot_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")<br>\ndeplot_model = Pix2StructForConditionalGeneration.from_pretrained('/path/to/local/deplot').to(device)<br>\ndeplot_processor = Pix2StructProcessor.from_pretrained('/path/to/local/deplot')</p>\n<p>Use a different pre-trained model that does not require an internet connection. There are several pre-trained models available in the Hugging Face model hub that you can download and use offline. You can browse the available models on the Hugging Face website and download the ones you need using the transformers-cli command line interface. Once downloaded, you can use them in your code by changing the model name to the local directory where you downloaded the model files.</p>",
      "rawMarkdown": "Unfortunately, it is not possible to use the Hugging Face DePlot model without an internet connection as the model needs to be downloaded from the Hugging Face model hub. However, there are a few workarounds you could try:\n\nDownload the DePlot model and its associated files beforehand, while you still have internet connectivity, and then use them offline. You can download the model and files using the transformers-cli command line interface provided by Hugging Face. \n\ntransformers-cli download google/deplot\n\nThis will download the DePlot model and its associated files to your local machine.\nOnce you have downloaded the model and files, you can use them offline by changing the path to the local directory where you downloaded them. For example:\n\ndeplot_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\ndeplot_model = Pix2StructForConditionalGeneration.from_pretrained('/path/to/local/deplot').to(device)\ndeplot_processor = Pix2StructProcessor.from_pretrained('/path/to/local/deplot')\n\nUse a different pre-trained model that does not require an internet connection. There are several pre-trained models available in the Hugging Face model hub that you can download and use offline. You can browse the available models on the Hugging Face website and download the ones you need using the transformers-cli command line interface. Once downloaded, you can use them in your code by changing the model name to the local directory where you downloaded the model files.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2256144,
      "author_name": "ericka42",
      "author_url": "",
      "post_date": "05/12/2023 09:30:19",
      "content": "<p>Unfortunately, it is not possible to use the Hugging Face DePlot model without an internet connection as the model needs to be downloaded from the Hugging Face model hub. However, there are a few workarounds you could try:</p>\n<p>Download the DePlot model and its associated files beforehand, while you still have internet connectivity, and then use them offline. You can download the model and files using the transformers-cli command line interface provided by Hugging Face. </p>\n<p>transformers-cli download google/deplot</p>\n<p>This will download the DePlot model and its associated files to your local machine.<br>\nOnce you have downloaded the model and files, you can use them offline by changing the path to the local directory where you downloaded them. For example:</p>\n<p>deplot_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")<br>\ndeplot_model = Pix2StructForConditionalGeneration.from_pretrained('/path/to/local/deplot').to(device)<br>\ndeplot_processor = Pix2StructProcessor.from_pretrained('/path/to/local/deplot')</p>\n<p>Use a different pre-trained model that does not require an internet connection. There are several pre-trained models available in the Hugging Face model hub that you can download and use offline. You can browse the available models on the Hugging Face website and download the ones you need using the transformers-cli command line interface. Once downloaded, you can use them in your code by changing the model name to the local directory where you downloaded the model files.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2255910": "Hi guys, recently I found that in order to submit my code, I need to disable the internet. But I found that the hugging face deplot model I used need to connect to the Internet to download something when I tried to run the following code:\n\ndeplot_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\ndeplot_model = Pix2StructForConditionalGeneration.from_pretrained('google/deplot').to(device)\ndeplot_processor = Pix2StructProcessor.from_pretrained('google/deplot')\n\nIs there any way to bypass this? Thanks a lot for helping with this!",
    "2256144": "Unfortunately, it is not possible to use the Hugging Face DePlot model without an internet connection as the model needs to be downloaded from the Hugging Face model hub. However, there are a few workarounds you could try:\n\nDownload the DePlot model and its associated files beforehand, while you still have internet connectivity, and then use them offline. You can download the model and files using the transformers-cli command line interface provided by Hugging Face. \n\ntransformers-cli download google/deplot\n\nThis will download the DePlot model and its associated files to your local machine.\nOnce you have downloaded the model and files, you can use them offline by changing the path to the local directory where you downloaded them. For example:\n\ndeplot_device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\ndeplot_model = Pix2StructForConditionalGeneration.from_pretrained('/path/to/local/deplot').to(device)\ndeplot_processor = Pix2StructProcessor.from_pretrained('/path/to/local/deplot')\n\nUse a different pre-trained model that does not require an internet connection. There are several pre-trained models available in the Hugging Face model hub that you can download and use offline. You can browse the available models on the Hugging Face website and download the ones you need using the transformers-cli command line interface. Once downloaded, you can use them in your code by changing the model name to the local directory where you downloaded the model files."
  },
  "source": "meta"
}