Skip to content

Intercept Flair logging messages, parse them, and log to MLFlow

License

Notifications You must be signed in to change notification settings

snosrap/flairflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flairflow

Intercept Flair logging messages, parse them, and log to MLflow

Background

Flair is an amazing NLP library. MLflow is an incredibly useful tool to keep track of machine learning parameters, metrics, and artifacts. However, Flair doesn't currently support MLflow, nor does it support a callback mechanism to get updates about training metrics.

The flairflow library is an attempt to work around these limitations and enable MLflow logging in Flair.

It accomplishes this by adding a log handler to the logger used by Flair, intercepting and parsing these log messages, and forwarding them to MLflow. It's by no means elegant, but it works.

Example Usage

import flair, mlflow
from flairflow import FlairLogMLFLow

# set up Flair's trainer object...

# flairflow will log to mlflow for all flair messages
# in the context of this `with` statement
with mlflow.start_run(), FlairLogMLFLow():
    result = trainer.train(base_path=path,
                           learning_rate=0.1,
                           mini_batch_size=32,
                           max_epochs=150)

About

Intercept Flair logging messages, parse them, and log to MLFlow

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages