{ "info": { "author": "Hunt Zhan", "author_email": "huntzhan.dev@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "=================\npytorch-fast-elmo\n=================\n\n\n.. image:: https://img.shields.io/pypi/v/pytorch_fast_elmo.svg\n :target: https://pypi.python.org/pypi/pytorch_fast_elmo\n\n.. image:: https://img.shields.io/travis/cnt-dev/pytorch-fast-elmo.svg\n :target: https://travis-ci.org/cnt-dev/pytorch-fast-elmo\n\n.. image:: https://img.shields.io/badge/License-MIT-yellow.svg\n :target: https://travis-ci.org/cnt-dev/pytorch-fast-elmo\n\n\nIntroduction\n------------\n\nA fast ELMo implementation with features:\n\n- **Lower execution overhead.** The core components are reimplemented in Libtorch in order to reduce the Python execution overhead (**45%** speedup).\n- **A more flexible design.** By redesigning the workflow, the user could extend or change the ELMo behavior easily.\n\nBenchmark\n---------\n\nHardware:\n\n- CPU: i7-7800X\n- GPU: 1080Ti\n\nOptions:\n\n- Batch size: 32\n- Warm up iterations: 20\n- Test iterations: 1000\n- Word length: [1, 20]\n- Sentence length: [1, 30]\n- Random seed: 10000\n\n+--------------------------------------+------------------------+------------------------+\n| Item | Mean Of Durations (ms) | cumtime(synchronize)% |\n+======================================+========================+========================+\n| Fast ELMo (CUDA, no synchronize) | **31** | N/A |\n+--------------------------------------+------------------------+------------------------+\n| AllenNLP ELMo (CUDA, no synchronize) | 56 | N/A |\n+--------------------------------------+------------------------+------------------------+\n| Fast ELMo (CUDA, synchronize) | 47 | **26.13%** |\n+--------------------------------------+------------------------+------------------------+\n| AllenNLP ELMo (CUDA, synchronize) | 57 | 0.02% |\n+--------------------------------------+------------------------+------------------------+\n| Fast ELMo (CPU) | 1277 | N/A |\n+--------------------------------------+------------------------+------------------------+\n| AllenNLP ELMo (CPU) | 1453 | N/A |\n+--------------------------------------+------------------------+------------------------+\n\nUsage\n-----\n\nPlease install **torch==1.0.0** first. Then, simply run this command to install.\n\n.. code-block:: bash\n\n pip install pytorch-fast-elmo\n\n\n``FastElmo`` should have the same behavior as AllenNLP's ``ELMo``.\n\n.. code-block:: python\n\n from pytorch_fast_elmo import FastElmo, batch_to_char_ids\n\n options_file = '/path/to/elmo_2x4096_512_2048cnn_2xhighway_options.json'\n weight_file = '/path/to/elmo_2x4096_512_2048cnn_2xhighway_weights.hdf5'\n\n elmo = FastElmo(options_file, weight_file)\n\n sentences = [['First', 'sentence', '.'], ['Another', '.']]\n character_ids = batch_to_ids(sentences)\n\n embeddings = elmo(character_ids)\n\n\nUse ``FastElmoWordEmbedding`` if you have disabled ``char_cnn`` in ``bilm-tf``, or have exported the Char CNN representation to a weight file.\n\n.. code-block:: python\n\n from pytorch_fast_elmo import FastElmoWordEmbedding, load_and_build_vocab2id, batch_to_word_ids\n\n options_file = '/path/to/elmo_2x4096_512_2048cnn_2xhighway_options.json'\n weight_file = '/path/to/elmo_2x4096_512_2048cnn_2xhighway_weights.hdf5'\n\n vocab_file = '/path/to/vocab.txt'\n embedding_file = '/path/to/cached_elmo_embedding.hdf5'\n\n elmo = FastElmoWordEmbedding(\n options_file,\n weight_file,\n # Could be omitted if the embedding weight is in `weight_file`.\n word_embedding_weight_file=embedding_file,\n )\n vocab2id = load_and_build_vocab2id(vocab_file)\n\n sentences = [['First', 'sentence', '.'], ['Another', '.']]\n word_ids = batch_to_word_ids(sentences, vocab2id)\n\n embeddings = elmo(word_ids)\n\n\nCLI commands:\n\n.. code-block:: bash\n\n # Cache the Char CNN representation.\n fast-elmo cache-char-cnn ./vocab.txt ./options.json ./lm_weights.hdf5 ./lm_embd.hdf5\n\n # Export word embedding.\n fast-elmo export-word-embd ./vocab.txt ./no-char-cnn.hdf5 ./embd.txt\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\n0.1.0 (2019-01-02)\n------------------\n\n* First release on PyPI.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cnt-dev/pytorch-fast-elmo", "keywords": "pytorch_fast_elmo", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "pytorch-fast-elmo", "package_url": "https://pypi.org/project/pytorch-fast-elmo/", "platform": "", "project_url": "https://pypi.org/project/pytorch-fast-elmo/", "project_urls": { "Homepage": "https://github.com/cnt-dev/pytorch-fast-elmo" }, "release_url": "https://pypi.org/project/pytorch-fast-elmo/0.6.12/", "requires_dist": null, "requires_python": "", "summary": "None", "version": "0.6.12" }, "last_serial": 4933456, "releases": { "0.3.2": [ { "comment_text": "", "digests": { "md5": "99bd79b89c17b9aa7e541258f2ed816f", "sha256": "0d715fb9917865be9f4f05a8075c0f49e26a02eaa39240a22dda7d4459cba8d7" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.3.2.tar.gz", "has_sig": false, "md5_digest": "99bd79b89c17b9aa7e541258f2ed816f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 424125, "upload_time": "2019-02-04T10:10:15", "url": "https://files.pythonhosted.org/packages/64/76/8ee4e7e1748baf26139f0f4831122b71328a55b31584084380a1cfcc8e05/pytorch_fast_elmo-0.3.2.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "86d2df8426c2fa93a5e73f875d566e13", "sha256": "1a3237291da88369686d4d9f085f7bc09580c82c8a4a0f7c69c950534de94bca" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.4.0.tar.gz", "has_sig": false, "md5_digest": "86d2df8426c2fa93a5e73f875d566e13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 424127, "upload_time": "2019-02-09T12:14:32", "url": "https://files.pythonhosted.org/packages/32/71/7ac3aadb0ebe5a1d3510691f24585990b899473ec48cb3f1b55fbce486be/pytorch_fast_elmo-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "64420754e3cb4b78f40007f36a02e030", "sha256": "a137f755589444b45f06fd67770b5287e68b8016d469f3d7a67f4263cf81deca" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.5.0.tar.gz", "has_sig": false, "md5_digest": "64420754e3cb4b78f40007f36a02e030", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 425833, "upload_time": "2019-02-13T09:11:03", "url": "https://files.pythonhosted.org/packages/45/8a/59433592df793e0bf2b72735991e0a8dd1292efffd9131eb768458d7d2f6/pytorch_fast_elmo-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "40fd0cb1718e45e95d7d2f4ce4ab0351", "sha256": "31b5788e28a77e407a16c1dddfa21be180a11fea7b931ccca94b7d2c6dcf7867" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.0.tar.gz", "has_sig": false, "md5_digest": "40fd0cb1718e45e95d7d2f4ce4ab0351", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 425848, "upload_time": "2019-02-21T05:40:55", "url": "https://files.pythonhosted.org/packages/6a/81/6a2567c9770d361064668f18eaa8cb8061a537fb8bb2e0d2e250399112da/pytorch_fast_elmo-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "a07cd37157f2df87f309b7990b3eb637", "sha256": "191939ce1fac7b69bc34963a9fd2982a44adfdcdfd08c6580c4ad988f3936b84" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.1.tar.gz", "has_sig": false, "md5_digest": "a07cd37157f2df87f309b7990b3eb637", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 425856, "upload_time": "2019-02-22T14:27:00", "url": "https://files.pythonhosted.org/packages/e1/db/7a51384a6a23ce78a2a8dca7eb4ea3c0b9425e5570858336ed4cfd85a284/pytorch_fast_elmo-0.6.1.tar.gz" } ], "0.6.10": [ { "comment_text": "", "digests": { "md5": "6db012ea2aaf2fca362081c9e8b4aed3", "sha256": "981b51dcfacad4a0356c11f65b5b7a4c89269793957b0e88d2876e1cf4bce4ea" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.10.tar.gz", "has_sig": false, "md5_digest": "6db012ea2aaf2fca362081c9e8b4aed3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 429741, "upload_time": "2019-03-12T07:01:57", "url": "https://files.pythonhosted.org/packages/d6/6f/a871b9aa472086c07f8e24de267a471637c3f132477673433af79ee1fce6/pytorch_fast_elmo-0.6.10.tar.gz" } ], "0.6.12": [ { "comment_text": "", "digests": { "md5": "cc14addcce5821374528e775e9121d69", "sha256": "3dbefb968aad3ee367c579620cef361ae401d83a629959e414083d6c9a1abd19" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.12.tar.gz", "has_sig": false, "md5_digest": "cc14addcce5821374528e775e9121d69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 429788, "upload_time": "2019-03-13T07:53:22", "url": "https://files.pythonhosted.org/packages/f3/98/eca038eb2efd2f15eb3ca7eceb4208d3561ae76d4044816c8d20caa4aada/pytorch_fast_elmo-0.6.12.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "65ef0872da44a2ab32384078b7275853", "sha256": "a039e5e6694279f3521c88eec748c5623058e2d7f88d2a225e7852e836b89830" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.3.tar.gz", "has_sig": false, "md5_digest": "65ef0872da44a2ab32384078b7275853", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 426684, "upload_time": "2019-02-24T18:41:40", "url": "https://files.pythonhosted.org/packages/3d/72/d0100ddfdb86fdc82a0a6634a181e34a0411f6c37d39c2b488b97fae7c05/pytorch_fast_elmo-0.6.3.tar.gz" } ], "0.6.4": [ { "comment_text": "", "digests": { "md5": "4a576d61c9ae97eb360da9181aa8c140", "sha256": "185b52a19265348d68c9fe4ddd02b9e0597d5a900d15ee039653bc3a847ee708" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.4.tar.gz", "has_sig": false, "md5_digest": "4a576d61c9ae97eb360da9181aa8c140", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 429396, "upload_time": "2019-02-25T09:42:45", "url": "https://files.pythonhosted.org/packages/c6/0f/b61877f73cdb3cd2d4134fc82b666e004187fde68a6136cffb8bacb38de7/pytorch_fast_elmo-0.6.4.tar.gz" } ], "0.6.6": [ { "comment_text": "", "digests": { "md5": "9587de62daf4075c3ca7ea698a36bfee", "sha256": "3fcf50b475c6be6ffbeb5451ea169f2385ec5d69f76267fc9f20f4a6802ed87f" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.6.tar.gz", "has_sig": false, "md5_digest": "9587de62daf4075c3ca7ea698a36bfee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 430135, "upload_time": "2019-03-01T10:38:32", "url": "https://files.pythonhosted.org/packages/8f/e9/e9c7587b822ad629e8e61fa5207d3bc78e0702cd9051c5570d8c4955e06b/pytorch_fast_elmo-0.6.6.tar.gz" } ], "0.6.7": [ { "comment_text": "", "digests": { "md5": "2c1e9d98ebab8524219b83d7849de791", "sha256": "76665f0eb85b525d9675969bb7908e2456d1ae6f4ab797b03d53cbc373fb0a34" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.7.tar.gz", "has_sig": false, "md5_digest": "2c1e9d98ebab8524219b83d7849de791", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 430137, "upload_time": "2019-03-01T12:47:02", "url": "https://files.pythonhosted.org/packages/00/10/74297b4c28a4870d0240ac28203f3724871b25f628028fbf011916741d10/pytorch_fast_elmo-0.6.7.tar.gz" } ], "0.6.8": [ { "comment_text": "", "digests": { "md5": "00d270df0fe0c9523c3b86f06a2dc989", "sha256": "8df3a01ed25cee08a57f7f1cd436d46cec63da6cd3a81060c61452603fdfa289" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.8.tar.gz", "has_sig": false, "md5_digest": "00d270df0fe0c9523c3b86f06a2dc989", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 429717, "upload_time": "2019-03-04T04:38:04", "url": "https://files.pythonhosted.org/packages/b9/58/d7d34332a8d4c0c2b4c926af05293fe0afa472c1be03ff2d1551ae53af5a/pytorch_fast_elmo-0.6.8.tar.gz" } ], "0.6.9": [ { "comment_text": "", "digests": { "md5": "edc80c1c67e39d360f6393b58b117994", "sha256": "981b0533d3f5ea9e863d59bcdf82fc9592b5f5c48cf7fcf61a7df32bc0367841" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.9.tar.gz", "has_sig": false, "md5_digest": "edc80c1c67e39d360f6393b58b117994", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 429750, "upload_time": "2019-03-05T07:58:33", "url": "https://files.pythonhosted.org/packages/34/fa/85ed4e9b5bce082267d95620a48966cb08ed1bbc40a8c4d12fb266788e48/pytorch_fast_elmo-0.6.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cc14addcce5821374528e775e9121d69", "sha256": "3dbefb968aad3ee367c579620cef361ae401d83a629959e414083d6c9a1abd19" }, "downloads": -1, "filename": "pytorch_fast_elmo-0.6.12.tar.gz", "has_sig": false, "md5_digest": "cc14addcce5821374528e775e9121d69", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 429788, "upload_time": "2019-03-13T07:53:22", "url": "https://files.pythonhosted.org/packages/f3/98/eca038eb2efd2f15eb3ca7eceb4208d3561ae76d4044816c8d20caa4aada/pytorch_fast_elmo-0.6.12.tar.gz" } ] }