faster-translate


Namefaster-translate JSON
Version 0.1.10 PyPI version JSON
download
home_pageNone
SummaryA simple translation utility using Hugging Face models.
upload_time2024-04-16 22:07:17
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License Copyright (c) 2024 Sawradip Saha Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords translation huggingface nlp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Faster Translate

Faster Translate is a high-performance translation library built on top of ctranslate2 and designed for fast and efficient translation. It provides an easy-to-use interface for translating text in various languages with support for pre-trained models from Hugging Face's model hub.

## Features

- High-speed translation leveraging ctranslate2
- Support for loading models directly from Hugging Face's model hub

## Installation

To install Faster Translate, you can use pip:

```
pip install faster-translate
```

## Usage:

Initialize with supported model name:

```
from faster_translate import TranslateModel

model = TranslateModel.from_pretrained("banglanmt_bn2en")
```

Or, `ct2` converted models, local or from huggingfcae hub:

```
from faster_translate import TranslateModel

model = TranslateModel.from_pretrained(
    "sawradip/faster-translate-banglanmt-bn2en-t5",
    normalizer_func = "buetnlpnormalizer"
                                       )

```

You can translate a single sentence:

```
model.translate_single("দেশে বিদেশি ঋণ নিয়ে এখন বেশ আলোচনা হচ্ছে। এই ঋণ পরিশোধের চাপ ধীরে ধীরে বাড়ছে। গত ২০২২-২৩ অর্থবছরে মোট ২৬৭ কোটি ডলারের ঋণ পরিশোধ করতে হয়েছে। আগামী সাত বছরে ঋণ পরিশোধের পরিমাণ বেড়ে দ্বিগুণ হবে বলে মনে করছে অর্থনৈতিক সম্পর্ক বিভাগ (ইআরডি)।")
```

Or a batch:

```
model.translate_batch([
    "দেশে বিদেশি ঋণ নিয়ে এখন বেশ আলোচনা হচ্ছে। এই ঋণ পরিশোধের চাপ ধীরে ধীরে বাড়ছে। গত ২০২২-২৩ অর্থবছরে মোট ২৬৭ কোটি ডলারের ঋণ পরিশোধ করতে হয়েছে। আগামী সাত বছরে ঋণ পরিশোধের পরিমাণ বেড়ে দ্বিগুণ হবে বলে মনে করছে অর্থনৈতিক সম্পর্ক বিভাগ (ইআরডি)।",
    "রাত তিনটার দিকে কাঁচামাল নিয়ে গুলিস্তান থেকে পুরান ঢাকার শ্যামবাজারের আড়তে যাচ্ছিলেন লিটন ব্যাপারী। "
    ])
```

### Currently Supported Models

- [BanglaNMT(BUET)](https://github.com/csebuetnlp/banglanmt) -> (Bangla -> English) - `banglanmt_bn2en`
- [BanglaNMT(BUET)](https://github.com/csebuetnlp/banglanmt) -> (English -> Bangla) - `banglanmt_en2bn`
- `bangla_mbartv1_en2bn`

### Features to be supported:

- Model comversion Scripts
- Direct HF dataset translation

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "faster-translate",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "translation, huggingface, nlp",
    "author": null,
    "author_email": "Sawradip Saha <sawradip0@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/50/1b/30671ff75684fc559ce858717eeef017b4d3309204a5300b465a69081d57/faster_translate-0.1.10.tar.gz",
    "platform": null,
    "description": "# Faster Translate\n\nFaster Translate is a high-performance translation library built on top of ctranslate2 and designed for fast and efficient translation. It provides an easy-to-use interface for translating text in various languages with support for pre-trained models from Hugging Face's model hub.\n\n## Features\n\n- High-speed translation leveraging ctranslate2\n- Support for loading models directly from Hugging Face's model hub\n\n## Installation\n\nTo install Faster Translate, you can use pip:\n\n```\npip install faster-translate\n```\n\n## Usage:\n\nInitialize with supported model name:\n\n```\nfrom faster_translate import TranslateModel\n\nmodel = TranslateModel.from_pretrained(\"banglanmt_bn2en\")\n```\n\nOr, `ct2` converted models, local or from huggingfcae hub:\n\n```\nfrom faster_translate import TranslateModel\n\nmodel = TranslateModel.from_pretrained(\n    \"sawradip/faster-translate-banglanmt-bn2en-t5\",\n    normalizer_func = \"buetnlpnormalizer\"\n                                       )\n\n```\n\nYou can translate a single sentence:\n\n```\nmodel.translate_single(\"\u09a6\u09c7\u09b6\u09c7 \u09ac\u09bf\u09a6\u09c7\u09b6\u09bf \u098b\u09a3 \u09a8\u09bf\u09df\u09c7 \u098f\u0996\u09a8 \u09ac\u09c7\u09b6 \u0986\u09b2\u09cb\u099a\u09a8\u09be \u09b9\u099a\u09cd\u099b\u09c7\u0964 \u098f\u0987 \u098b\u09a3 \u09aa\u09b0\u09bf\u09b6\u09cb\u09a7\u09c7\u09b0 \u099a\u09be\u09aa \u09a7\u09c0\u09b0\u09c7 \u09a7\u09c0\u09b0\u09c7 \u09ac\u09be\u09dc\u099b\u09c7\u0964 \u0997\u09a4 \u09e8\u09e6\u09e8\u09e8-\u09e8\u09e9 \u0985\u09b0\u09cd\u09a5\u09ac\u099b\u09b0\u09c7 \u09ae\u09cb\u099f \u09e8\u09ec\u09ed \u0995\u09cb\u099f\u09bf \u09a1\u09b2\u09be\u09b0\u09c7\u09b0 \u098b\u09a3 \u09aa\u09b0\u09bf\u09b6\u09cb\u09a7 \u0995\u09b0\u09a4\u09c7 \u09b9\u09df\u09c7\u099b\u09c7\u0964 \u0986\u0997\u09be\u09ae\u09c0 \u09b8\u09be\u09a4 \u09ac\u099b\u09b0\u09c7 \u098b\u09a3 \u09aa\u09b0\u09bf\u09b6\u09cb\u09a7\u09c7\u09b0 \u09aa\u09b0\u09bf\u09ae\u09be\u09a3 \u09ac\u09c7\u09dc\u09c7 \u09a6\u09cd\u09ac\u09bf\u0997\u09c1\u09a3 \u09b9\u09ac\u09c7 \u09ac\u09b2\u09c7 \u09ae\u09a8\u09c7 \u0995\u09b0\u099b\u09c7 \u0985\u09b0\u09cd\u09a5\u09a8\u09c8\u09a4\u09bf\u0995 \u09b8\u09ae\u09cd\u09aa\u09b0\u09cd\u0995 \u09ac\u09bf\u09ad\u09be\u0997 (\u0987\u0986\u09b0\u09a1\u09bf)\u0964\")\n```\n\nOr a batch:\n\n```\nmodel.translate_batch([\n    \"\u09a6\u09c7\u09b6\u09c7 \u09ac\u09bf\u09a6\u09c7\u09b6\u09bf \u098b\u09a3 \u09a8\u09bf\u09df\u09c7 \u098f\u0996\u09a8 \u09ac\u09c7\u09b6 \u0986\u09b2\u09cb\u099a\u09a8\u09be \u09b9\u099a\u09cd\u099b\u09c7\u0964 \u098f\u0987 \u098b\u09a3 \u09aa\u09b0\u09bf\u09b6\u09cb\u09a7\u09c7\u09b0 \u099a\u09be\u09aa \u09a7\u09c0\u09b0\u09c7 \u09a7\u09c0\u09b0\u09c7 \u09ac\u09be\u09dc\u099b\u09c7\u0964 \u0997\u09a4 \u09e8\u09e6\u09e8\u09e8-\u09e8\u09e9 \u0985\u09b0\u09cd\u09a5\u09ac\u099b\u09b0\u09c7 \u09ae\u09cb\u099f \u09e8\u09ec\u09ed \u0995\u09cb\u099f\u09bf \u09a1\u09b2\u09be\u09b0\u09c7\u09b0 \u098b\u09a3 \u09aa\u09b0\u09bf\u09b6\u09cb\u09a7 \u0995\u09b0\u09a4\u09c7 \u09b9\u09df\u09c7\u099b\u09c7\u0964 \u0986\u0997\u09be\u09ae\u09c0 \u09b8\u09be\u09a4 \u09ac\u099b\u09b0\u09c7 \u098b\u09a3 \u09aa\u09b0\u09bf\u09b6\u09cb\u09a7\u09c7\u09b0 \u09aa\u09b0\u09bf\u09ae\u09be\u09a3 \u09ac\u09c7\u09dc\u09c7 \u09a6\u09cd\u09ac\u09bf\u0997\u09c1\u09a3 \u09b9\u09ac\u09c7 \u09ac\u09b2\u09c7 \u09ae\u09a8\u09c7 \u0995\u09b0\u099b\u09c7 \u0985\u09b0\u09cd\u09a5\u09a8\u09c8\u09a4\u09bf\u0995 \u09b8\u09ae\u09cd\u09aa\u09b0\u09cd\u0995 \u09ac\u09bf\u09ad\u09be\u0997 (\u0987\u0986\u09b0\u09a1\u09bf)\u0964\",\n    \"\u09b0\u09be\u09a4 \u09a4\u09bf\u09a8\u099f\u09be\u09b0 \u09a6\u09bf\u0995\u09c7 \u0995\u09be\u0981\u099a\u09be\u09ae\u09be\u09b2 \u09a8\u09bf\u09df\u09c7 \u0997\u09c1\u09b2\u09bf\u09b8\u09cd\u09a4\u09be\u09a8 \u09a5\u09c7\u0995\u09c7 \u09aa\u09c1\u09b0\u09be\u09a8 \u09a2\u09be\u0995\u09be\u09b0 \u09b6\u09cd\u09af\u09be\u09ae\u09ac\u09be\u099c\u09be\u09b0\u09c7\u09b0 \u0986\u09dc\u09a4\u09c7 \u09af\u09be\u099a\u09cd\u099b\u09bf\u09b2\u09c7\u09a8 \u09b2\u09bf\u099f\u09a8 \u09ac\u09cd\u09af\u09be\u09aa\u09be\u09b0\u09c0\u0964 \"\n    ])\n```\n\n### Currently Supported Models\n\n- [BanglaNMT(BUET)](https://github.com/csebuetnlp/banglanmt) -> (Bangla -> English) - `banglanmt_bn2en`\n- [BanglaNMT(BUET)](https://github.com/csebuetnlp/banglanmt) -> (English -> Bangla) - `banglanmt_en2bn`\n- `bangla_mbartv1_en2bn`\n\n### Features to be supported:\n\n- Model comversion Scripts\n- Direct HF dataset translation\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Sawradip Saha  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A simple translation utility using Hugging Face models.",
    "version": "0.1.10",
    "project_urls": null,
    "split_keywords": [
        "translation",
        " huggingface",
        " nlp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "789bda273eee88f0be48780a82614ae29f13f547d8579189bd7c5cbe671f154b",
                "md5": "15a0b146d1d7b5b37e1356c6f00d51b2",
                "sha256": "bbd7a80bb7db9dbbd23c7c043e5b3ca1f36c6b10399f36830c9ff6dac0c27c3c"
            },
            "downloads": -1,
            "filename": "faster_translate-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "15a0b146d1d7b5b37e1356c6f00d51b2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8334,
            "upload_time": "2024-04-16T22:07:15",
            "upload_time_iso_8601": "2024-04-16T22:07:15.513491Z",
            "url": "https://files.pythonhosted.org/packages/78/9b/da273eee88f0be48780a82614ae29f13f547d8579189bd7c5cbe671f154b/faster_translate-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "501b30671ff75684fc559ce858717eeef017b4d3309204a5300b465a69081d57",
                "md5": "6e009a31e8cca5d4d9af368d15a75cf2",
                "sha256": "4b5fe9ab8342f1c43d82b443113bad50736728831c701604ad308b52a6a221f1"
            },
            "downloads": -1,
            "filename": "faster_translate-0.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "6e009a31e8cca5d4d9af368d15a75cf2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7855,
            "upload_time": "2024-04-16T22:07:17",
            "upload_time_iso_8601": "2024-04-16T22:07:17.446667Z",
            "url": "https://files.pythonhosted.org/packages/50/1b/30671ff75684fc559ce858717eeef017b4d3309204a5300b465a69081d57/faster_translate-0.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-16 22:07:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "faster-translate"
}
        
Elapsed time: 0.34634s