logfire-callback

A callback for logging training events from Hugging Face's Transformers to Logfire 🤗

https://github.com/louisbrulenaudet/logfire-callback

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • ✓
    CITATION.cff file
    Found CITATION.cff file
  • ✓
    codemeta.json file
    Found codemeta.json file
  • ✓
    .zenodo.json file
    Found .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • â—‹
    Committers with academic emails
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (16.0%) to scientific vocabulary

Keywords

callback huggingface huggingface-transformers logfire logfire-callback logging pydantic trainer training transformers
Last synced: 6 months ago · JSON representation ·

Repository

A callback for logging training events from Hugging Face's Transformers to Logfire 🤗

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
callback huggingface huggingface-transformers logfire logfire-callback logging pydantic trainer training transformers
Created 11 months ago · Last pushed 11 months ago
Metadata Files
Readme Funding License Code of conduct Citation Security

README.md

Plot

Logfire-callback, observability for Hugging Face's Transformers training loop 🤗

License Maintainer Python Version Code Style Package Manager

A callback for logging training events from Hugging Face's Transformers to Logfire 🤗

Overview

The logfire-callback package provides a seamless integration between Hugging Face's Transformers library and Logfire logging service. It allows you to track and monitor your model training progress, metrics, and events in real-time through Logfire's platform.

Installation

Install the package using pip:

bash pip install logfire-callback

Usage

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

bash export LOGFIRE_TOKEN=your_logfire_token

Then use the callback in your training code:

```python from transformers import Trainer, TrainingArguments from logfire_callback import LogfireCallback

Initialize your model, dataset, etc.

trainingargs = TrainingArguments( outputdir="./results", numtrainepochs=3, # ... other training arguments )

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

trainer.train() ```

The callback will automatically log: - Training start with configuration parameters - Periodic training metrics (loss, learning rate, etc.) - Evaluation metrics during validation - Training completion

Development

Prerequisites

  • Python 3.11 or higher
  • uv for package management

Setting up the development environment

  1. Clone the repository: bash git clone https://github.com/louisbrulenaudet/logfire-callback cd logfire-callback

  2. Initialize the development environment: bash make init

Available Make Commands

  • make test - Execute test suite
  • make init - Initialize development environment
  • make install-dev - Install development dependencies
  • make run - Run the application
  • make check - Run code quality checks
  • make format - Format source code
  • make upgrade - Update project dependencies
  • make pre-commit - Run pre-commit checks
  • make build - Build the project
  • make publish - Publish the project
  • make coverage - Run tests with coverage

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Links

Requirements

  • Python >= 3.11
  • transformers >= 4.49.0
  • logfire >= 3.9.0

Citing this project

If you use this code in your research, please use the following BibTeX entry.

```BibTeX @misc{louisbrulenaudet2025, author = {Louis Brulé Naudet}, title = {Logfire callback, observability for Hugging Face's transformers training loop}, howpublished = {\url{https://huggingface.co/spaces/louisbrulenaudet/logfire-callback}}, year = {2025} }

```

Feedback

If you have any feedback, please reach out at louisbrulenaudet@icloud.com.

Owner

  • Name: Louis Brulé Naudet
  • Login: louisbrulenaudet
  • Kind: user
  • Location: Paris
  • Company: Université Paris-Dauphine (Paris Sciences et Lettres - PSL)

Research in business taxation and development (NLP, LLM, Computer vision...), University Dauphine-PSL 📖 | Backed by the Microsoft for Startups Hub program

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Brulé Naudet"
  given-names: "Louis"
  orcid: "https://orcid.org/0000-0001-9111-4879"
title: "Logfire callback, observability for Hugging Face's transformers training loop"
version: 1.0.0
date-released: 2025-03-23

GitHub Events

Total
  • Release event: 1
  • Push event: 20
  • Create event: 4
Last Year
  • Release event: 1
  • Push event: 20
  • Create event: 4

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 21
  • Total Committers: 1
  • Avg Commits per committer: 21.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 21
  • Committers: 1
  • Avg Commits per committer: 21.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Louis Brulé Naudet l****t@i****m 21

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 13 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
pypi.org: logfire-callback

A callback for logging training events from Hugging Face's Transformers to Logfire 🤗

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 13 Last month
Rankings
Dependent packages count: 9.4%
Forks count: 31.6%
Average: 33.9%
Stargazers count: 41.6%
Dependent repos count: 53.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/python-publish.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
pyproject.toml pypi
uv.lock pypi
  • certifi 2025.1.31
  • cfgv 3.4.0
  • charset-normalizer 3.4.1
  • colorama 0.4.6
  • deprecated 1.2.18
  • distlib 0.3.9
  • executing 2.2.0
  • filelock 3.18.0
  • fsspec 2025.3.0
  • googleapis-common-protos 1.69.2
  • huggingface-hub 0.29.3
  • identify 2.6.9
  • idna 3.10
  • importlib-metadata 8.6.1
  • iniconfig 2.1.0
  • logfire 3.9.0
  • logfire-callback 0.1.0
  • markdown-it-py 3.0.0
  • mdurl 0.1.2
  • nodeenv 1.9.1
  • numpy 2.2.4
  • opentelemetry-api 1.31.1
  • opentelemetry-exporter-otlp-proto-common 1.31.1
  • opentelemetry-exporter-otlp-proto-http 1.31.1
  • opentelemetry-instrumentation 0.52b1
  • opentelemetry-proto 1.31.1
  • opentelemetry-sdk 1.31.1
  • opentelemetry-semantic-conventions 0.52b1
  • packaging 24.2
  • platformdirs 4.3.7
  • pluggy 1.5.0
  • pre-commit 4.2.0
  • pre-commit-uv 4.1.4
  • protobuf 5.29.4
  • pygments 2.19.1
  • pyright 1.1.397
  • pytest 8.3.5
  • pyyaml 6.0.2
  • regex 2024.11.6
  • requests 2.32.3
  • rich 13.9.4
  • ruff 0.11.2
  • safetensors 0.5.3
  • tokenizers 0.21.1
  • tqdm 4.67.1
  • transformers 4.50.0
  • typing-extensions 4.12.2
  • urllib3 2.3.0
  • uv 0.6.9
  • virtualenv 20.29.3
  • wrapt 1.17.2
  • zipp 3.21.0
.github/workflows/ruff.yml actions
  • actions/checkout v4 composite
  • astral-sh/ruff-action v3 composite
.github/workflows/test.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
requirements.txt pypi
  • certifi ==2025.1.31
  • charset-normalizer ==3.4.1
  • deprecated ==1.2.18
  • executing ==2.2.0
  • filelock ==3.18.0
  • fsspec ==2025.3.0
  • googleapis-common-protos ==1.69.2
  • huggingface-hub ==0.29.3
  • idna ==3.10
  • importlib-metadata ==8.6.1
  • logfire ==3.9.0
  • markdown-it-py ==3.0.0
  • mdurl ==0.1.2
  • numpy ==2.2.4
  • opentelemetry-api ==1.31.1
  • opentelemetry-exporter-otlp-proto-common ==1.31.1
  • opentelemetry-exporter-otlp-proto-http ==1.31.1
  • opentelemetry-instrumentation ==0.52b1
  • opentelemetry-proto ==1.31.1
  • opentelemetry-sdk ==1.31.1
  • opentelemetry-semantic-conventions ==0.52b1
  • packaging ==24.2
  • protobuf ==5.29.4
  • pygments ==2.19.1
  • pyyaml ==6.0.2
  • regex ==2024.11.6
  • requests ==2.32.3
  • rich ==13.9.4
  • safetensors ==0.5.3
  • tokenizers ==0.21.1
  • tqdm ==4.67.1
  • transformers ==4.50.0
  • typing-extensions ==4.12.2
  • urllib3 ==2.3.0
  • wrapt ==1.17.2
  • zipp ==3.21.0