1 comment

[ 2.2 ms ] story [ 10.7 ms ] thread
I’ve just released logfire-callback on PyPI, designed to facilitate monitoring of Hugging Face Transformer training loops using Pydantic Logfire

The callback will automatically log training start with configuration parameters, periodic metrics and training completion

Install the package using pip:

pip install logfire-callback

First, ensure you have a Logfire API token and set it as an environment variable:

export LOGFIRE_TOKEN=your_logfire_token

Then use the callback in your training code:

from transformers import Trainer, TrainingArguments from logfire_callback import LogfireCallback

# Initialize your model, dataset, etc.

training_args = TrainingArguments( output_dir="./results", num_train_epochs=3, # ... other training arguments )

trainer = Trainer( model=model, args=training_args, train_dataset=train_dataset, callbacks=[LogfireCallback()] # Add the Logfire callback here )

trainer.train()