nemo_curator.stages.text.experimental.translation.backends.google
nemo_curator.stages.text.experimental.translation.backends.google
Google Cloud Translation API backend for NeMo Curator.
Supports both Google Cloud Translation API v2 (Basic) and v3 (Advanced).
Module Contents
Classes
API
Bases: ExecutorTranslationBackend
Google Cloud Translation backend (v2 and v3 APIs).
Parameters:
project_id
Google Cloud project ID. Required for v3. Falls back
to the GOOGLE_CLOUD_PROJECT environment variable.
location
Google Cloud location for v3 (default "global").
api_version
"v2" (default) or "v3".
max_concurrent_requests
Semaphore size for async concurrency.
_api_version
_parent
_project_id
backend_name
Return 400-class Google API errors that should not be retried.
Synchronous single-text translation (called via executor).
Release client resources.
Initialize the Google Cloud Translation client.
Raises:
ImportError: Ifgoogle-cloud-translateis not installed.ValueError: If v3 is selected but no project_id is available.