Machine learning library for pop projects
Project description
pop-ml is a Python library that simplifies the integration of AI-powered capabilities into any POP-based Python project.
About
pop-ml is a comprehensive Python library designed to facilitate the integration of AI- powered capabilities, such as translation, into POP-based Python projects.
pop-ml currently provides developers with an easy-to-use and seamless translation experience, allowing them to translate strings to other languages, such as english to spanish.
The library currently supports making use of Hugging Face Transformers library and can utilize pretrained tokenizers for delivering accurate and efficient translations. By leveraging state-of-the-art language models, pop-ml ensures high-quality translations while maintaining simplicity in its API.
What is POP?
This project is built with pop, a Python-based implementation of Plugin Oriented Programming (POP). POP seeks to bring together concepts and wisdom from the history of computing in new ways to solve modern computing problems.
For more information:
Getting Started
Prerequisites
Python 3.8+
git (if installing from source, or contributing to the project)
Installation
If wanting to use pop-ml, you can do so by either installing from PyPI or from source.
Install from PyPI
To install pop-ml from PyPI, simply run the following command:
pip install pop-ml
This will install the latest version of pop-ml, along with all required dependencies.
Install from source
To install pop-ml from source, first clone the repository from GitLab:
git clone https://gitlab.com/vmware/pop/pop-ml.git
Next, navigate to the cloned repository directory:
cd pop-ml
Finally, install the package using pip:
pip install .
Usage
pop-ml can be used both as a command-line tool (pop-translate) and as a Python library. Below are examples of how to use pop-ml in both ways.
CLI Examples
To use the pop-translate command-line tool, you can pass the text you want to translate as an argument, along with any additional options:
pop-translate "Hello, World!" --translate-to es
This command will translate the input text “Hello, world!” from English (en) to Spanish (es).
To see a full list of available options, run:
pop-translate --help
Python Examples
Here is an example of how to use pop-ml as a Python library:
import pop.hub
# Initialize the hub
hub = pop.hub.Hub()
# Add the "ml" dynamic namespace to the hub
hub.pop.sub.add(dyne_name="ml")
# Load config values onto hub.OPT
hub.pop.config.load(["pop_ml"], cli="pop_ml")
# Call the idempotent "init" of pop-ml's tokenizer using values from config
hub.ml.tokenizer.init(
model_name=hub.OPT.pop_ml.model_name,
dest_lang=hub.OPT.pop_ml.dest_lang,
source_lang=hub.OPT.pop_ml.source_lang,
pretrained_model=hub.OPT.pop_ml.pretrained_model_class,
pretrained_tokenizer=hub.OPT.pop_ml.pretrained_tokenizer_class,
)
# Call the function to translate the text
result = hub.ml.tokenizer.translate([text])
print(result)
In this example, we initialize the hub, load the “ml” dynamic namespace and config values onto it, initialize the tokenizer, and call the function to translate the text. The output will be the translated text.
Roadmap
Reference the open issues for a list of proposed features (and known issues).
Acknowledgements
Img Shields for making repository badges easy.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pop-ml-0.2.0.tar.gz
.
File metadata
- Download URL: pop-ml-0.2.0.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a105fdd1c22212aa707968e6796772aa3a846996ea149b79483e792d83415f32 |
|
MD5 | a31e5299cb4989af842a34ba61d98d6b |
|
BLAKE2b-256 | 7fd834181c0ea3f8ab6b6f0978f9a9e59d443555c9bd2fd5f7a847d39f271628 |
File details
Details for the file pop_ml-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: pop_ml-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a36e5e7a71d694dcb2ada1a4ecd39e7fbb03a9ab165cfd30954cdbe870dcdc1e |
|
MD5 | eb2d73f7fbc65c38c019f1ea72793d04 |
|
BLAKE2b-256 | e2bf69ef83e37750dd2fdc01bdecd45d1daac5aff7b6a5053ac30a6c04f14fb2 |