{
  "id": 176343,
  "title": "Load different embeddings from zip file in quora Insincere Question Classification",
  "url": "/competitions/quora-insincere-questions-classification/discussion/176343",
  "author_name": "",
  "post_date": "2020-08-21T11:22:40.180504100Z",
  "votes": 2,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hey folks, I was just trying to access Glove embedding(zipped) from this kernel, but I didn't succeed. Please help me.</p>",
  "messages": [
    {
      "id": "980162",
      "postDate": "08/21/2020 11:22:40",
      "content": "<p>Hey folks, I was just trying to access Glove embedding(zipped) from this kernel, but I didn't succeed. Please help me.</p>",
      "rawMarkdown": "Hey folks, I was just trying to access Glove embedding(zipped) from this kernel, but I didn't succeed. Please help me.",
      "votes": null
    },
    {
      "id": "980172",
      "postDate": "08/21/2020 11:27:08",
      "content": "<p>You can directly access via <br>\n<a href=\"https://www.kaggle.com/rtatman/glove-global-vectors-for-word-representation\" target=\"_blank\">https://www.kaggle.com/rtatman/glove-global-vectors-for-word-representation</a><br>\nclick on add data to your kernel.<br>\nthen add the data via above link.</p>\n<p>If you want to use your own glove vectors from local machine then add your data via add data in the kernel choose your zip file and upload and then access through kaggle input.<br>\nHope it might help you :)</p>",
      "rawMarkdown": "You can directly access via \nhttps://www.kaggle.com/rtatman/glove-global-vectors-for-word-representation\nclick on add data to your kernel.\nthen add the data via above link.\n\nIf you want to use your own glove vectors from local machine then add your data via add data in the kernel choose your zip file and upload and then access through kaggle input.\nHope it might help you :)",
      "votes": null
    },
    {
      "id": "980220",
      "postDate": "08/21/2020 12:20:18",
      "content": "<p>Thanks but I don't want to use external embedding. I tried few codes and below are the working one for <strong>Glove</strong>.</p>\n<pre><code>import io\nfrom tqdm import tqdm\nembeddings_glove={}\n\nwith zipfile.ZipFile(\"/kaggle/input/quora-insincere-questions-classification/embeddings.zip\") as zf:\n    with io.TextIOWrapper(zf.open(\"glove.840B.300d/glove.840B.300d.txt\"), encoding=\"utf-8\") as f:\n        for line in tqdm(f):\n            values=line.split(' ') # \".split(' ')\" only for glove-840b-300d; for all other files, \".split()\" works\n            word=values[0]\n            vectors=np.asarray(values[1:],'float32')\n            embeddings_glove[word]=vectors\n</code></pre>",
      "rawMarkdown": "Thanks but I don't want to use external embedding. I tried few codes and below are the working one for **Glove**.\n```\nimport io\nfrom tqdm import tqdm\nembeddings_glove={}\n\nwith zipfile.ZipFile(\"/kaggle/input/quora-insincere-questions-classification/embeddings.zip\") as zf:\n    with io.TextIOWrapper(zf.open(\"glove.840B.300d/glove.840B.300d.txt\"), encoding=\"utf-8\") as f:\n        for line in tqdm(f):\n            values=line.split(' ') # \".split(' ')\" only for glove-840b-300d; for all other files, \".split()\" works\n            word=values[0]\n            vectors=np.asarray(values[1:],'float32')\n            embeddings_glove[word]=vectors\n```",
      "votes": null
    },
    {
      "id": "1200478",
      "postDate": "02/14/2021 17:53:30",
      "content": "<p>great it worked.thanks.</p>",
      "rawMarkdown": "great it worked.thanks.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 980172,
      "author_name": "aman2000jaiswal",
      "author_url": "",
      "post_date": "08/21/2020 11:27:08",
      "content": "<p>You can directly access via <br>\n<a href=\"https://www.kaggle.com/rtatman/glove-global-vectors-for-word-representation\" target=\"_blank\">https://www.kaggle.com/rtatman/glove-global-vectors-for-word-representation</a><br>\nclick on add data to your kernel.<br>\nthen add the data via above link.</p>\n<p>If you want to use your own glove vectors from local machine then add your data via add data in the kernel choose your zip file and upload and then access through kaggle input.<br>\nHope it might help you :)</p>",
      "votes": null,
      "replies": [
        {
          "id": 980220,
          "author_name": "rohitr4307",
          "author_url": "",
          "post_date": "08/21/2020 12:20:18",
          "content": "<p>Thanks but I don't want to use external embedding. I tried few codes and below are the working one for <strong>Glove</strong>.</p>\n<pre><code>import io\nfrom tqdm import tqdm\nembeddings_glove={}\n\nwith zipfile.ZipFile(\"/kaggle/input/quora-insincere-questions-classification/embeddings.zip\") as zf:\n    with io.TextIOWrapper(zf.open(\"glove.840B.300d/glove.840B.300d.txt\"), encoding=\"utf-8\") as f:\n        for line in tqdm(f):\n            values=line.split(' ') # \".split(' ')\" only for glove-840b-300d; for all other files, \".split()\" works\n            word=values[0]\n            vectors=np.asarray(values[1:],'float32')\n            embeddings_glove[word]=vectors\n</code></pre>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1200478,
          "author_name": "rizdelhi",
          "author_url": "",
          "post_date": "02/14/2021 17:53:30",
          "content": "<p>great it worked.thanks.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "980162": "Hey folks, I was just trying to access Glove embedding(zipped) from this kernel, but I didn't succeed. Please help me.",
    "980172": "You can directly access via \nhttps://www.kaggle.com/rtatman/glove-global-vectors-for-word-representation\nclick on add data to your kernel.\nthen add the data via above link.\n\nIf you want to use your own glove vectors from local machine then add your data via add data in the kernel choose your zip file and upload and then access through kaggle input.\nHope it might help you :)",
    "980220": "Thanks but I don't want to use external embedding. I tried few codes and below are the working one for **Glove**.\n```\nimport io\nfrom tqdm import tqdm\nembeddings_glove={}\n\nwith zipfile.ZipFile(\"/kaggle/input/quora-insincere-questions-classification/embeddings.zip\") as zf:\n    with io.TextIOWrapper(zf.open(\"glove.840B.300d/glove.840B.300d.txt\"), encoding=\"utf-8\") as f:\n        for line in tqdm(f):\n            values=line.split(' ') # \".split(' ')\" only for glove-840b-300d; for all other files, \".split()\" works\n            word=values[0]\n            vectors=np.asarray(values[1:],'float32')\n            embeddings_glove[word]=vectors\n```",
    "1200478": "great it worked.thanks."
  },
  "source": "meta"
}