Skip to main content
Made with pop, a Python implementation of Plugin Oriented Programming Documentation is published with Sphinx on GitLab Pages Made with Python

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

Release files for pop-ml 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pop-ml 0.2.0
File Size Uploaded
pop-ml-0.2.0.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pop-ml 0.2.0
File Interpreter ABI Platform
pop_ml-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / pop-ml-0.2.0.tar.gz

Download URL pop-ml-0.2.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a105fdd1c22212aa707968e6796772aa3a846996ea149b79483e792d83415f32
BLAKE2b-256 checksum
How to use checksums
7fd834181c0ea3f8ab6b6f0978f9a9e59d443555c9bd2fd5f7a847d39f271628
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pop_ml-0.2.0-py3-none-any.whl

Download URL pop_ml-0.2.0-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a36e5e7a71d694dcb2ada1a4ecd39e7fbb03a9ab165cfd30954cdbe870dcdc1e
BLAKE2b-256 checksum
How to use checksums
e2bf69ef83e37750dd2fdc01bdecd45d1daac5aff7b6a5053ac30a6c04f14fb2
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page