Skip to main content

Python SDK client for running remote jobs on Transformer Lab.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

transformerlab-client

Python client and callbacks for Transformer Lab.

Install

pip install transformerlab-client

Prerequisites

  • Python 3.10 or newer
  • A running instance of the Transformer Lab API server
    • By default, the client connects to http://localhost:8338
    • Make sure the Transformer Lab application is running before using this client

Usage

from transformers import TrainingArguments, Trainer
from transformerlab_client.client import TransformerLabClient
from transformerlab_client.callbacks.hf_callback import TLabProgressCallback

# Initialize client and register job
client = TransformerLabClient(server_url="<ENTER YOUR TRANSFORMER LAB API URL>")
job_id = client.start(your_config)

# Set up Hugging Face trainer with TLabProgressCallback
training_args = TrainingArguments(
    output_dir="./output",
    # other arguments...
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=train_dataset,
    # other arguments...
    callbacks=[TLabProgressCallback(client)]  # Add Transformer Lab callback
)

# Train the model
trainer.train()

# Complete the job
client.complete()

Full Training Example

See the examples directory for a complete training script that demonstrates how to use the client for a full training workflow with Hugging Face Transformers.

API Reference

TransformerLabClient

Main client for communicating with Transformer Lab.

  • start(config): Register a training job and get a job ID
  • report_progress(progress, metrics=None): Report training progress (0-100) and any metrics in json format
  • complete(message="Training completed successfully"): Mark job as complete
  • stop(message="Training stopped"): Mark job as stopped
  • save_model(saved_model_path): Save model to specified path
  • log_info(message): Log info message
  • log_error(message): Log error message
  • log_warning(message): Log warning message
  • log_debug(message): Log debug message

TLabProgressCallback

Callback for Hugging Face Transformers Trainer that reports progress to Transformer Lab.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transformerlab_client-0.1.3.tar.gz (42.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transformerlab_client-0.1.3-py3-none-any.whl (31.6 kB view details)

Uploaded Python 3

File details

Details for the file transformerlab_client-0.1.3.tar.gz.

File metadata

  • Download URL: transformerlab_client-0.1.3.tar.gz
  • Upload date:
  • Size: 42.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for transformerlab_client-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6cb4d163258a7458da1a2324b9da3448b7133c5ba01dd83f0fa6a64da8698361
MD5 23809c23c1a495a594f389f398a78b6d
BLAKE2b-256 1fa8607a23e8687a4f76e52aefa50edf3f8edcc05f18f86567252c36eebe52e4

See more details on using hashes here.

File details

Details for the file transformerlab_client-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for transformerlab_client-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6ad1c5c12b6426c772291f48103489f9ade2808cc5b135538f5e81d7ad6c8c4e
MD5 e8572d9ae2d7b233b3e94cda5838c7e5
BLAKE2b-256 b1e037ec786a315555e6c592724c3adbd556284c2eda0bfb76486c182ef728c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page