Catalog PyPI
PACKAGE EXPLORERView in registry

abtranslate

PyPI

A translator wrapper for open-source translation models with batch optimization. Currently supports ArgosTranslate models and is designed for scalable deployment.

Versions collected1
Direct dependencies7From release 0.2.0
Last observed20 Oct, 17:45 UTC

README

Version 0.2.0 documentation

ABTranslate

A translator wrapper for open-source translation models with batch optimization. Currently supports ArgosTranslate models and is designed for scalable deployment.

Features

  • ✅ Optimized translation for list or pandas.Series of text
  • 🛡️ Supports masking of specific patterns to exclude them from translation
  • ⚙️ Thread-tuned for multi-threaded deployment with ctranslate2
  • 📦 Compatible with ArgosTranslate model packages

Installation

pip install abtranslate

Usage

from abtranslate import load_argostranslate_model

# Load model from local path
model_package = load_argostranslate_model(model_path, package_dir=package_extraction_dir)

# Load translator with optional optimizations
translator = model_package.load_translator(optimized_config=True, lazy_load=False)

# Define translation quality settings (based on CTranslate2)
QUALITY_CONFIG = {
    "beam_size": 4,
    "num_hypotheses": 1,
    "replace_unknowns": True,
}

# Translate a batch of texts (e.g. pandas Series or list)
translated_texts = translator.translate_batch(df["input_text"], translation_config=QUALITY_CONFIG)

🔗 Refer to CTranslate2 Translate Batch Parameters for more configuration options.

Main Functions

  • load_argostranslate_model(model_path: str, package_dir: str) -> ModelPackage: Loads and prepares an ArgosTranslate model for usage.

  • ModelPackage.load_translator(translator_config: dict, optimized_config: bool, lazy_load: bool) -> Translator: Returns a translator instance with optional optimizations.

  • Translator.translate_batch(text_list: List[str] | pd.Series, translation_config: dict, return_type: any) -> List[str]: Performs high-performance batch translation with support for multi-threading and tuning.

License

MIT

Author

Ichsan Takwa GitHub

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.2.07 Oct 20257

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
ichsan-t45/abtranslate

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:45 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:6cbb36befb7ea019c9245e6f8d5487aec2ffc2cb693aa1df1ec92919f916f244