Freak
Freak is a Python package which allows interacting with the program’s state remotely. You can define the state object as a pydantic
model and use Freak to expose it over HTTP. It supports nested models, partial updates, data validation, and uses FastAPI to run the web server.
It can be useful to quickly setup control over long-running programs like bots or neural network trainings.
Here freak
is used to create a PyTorch Lightning Callback for graceful model training interruption. This is particularly useful in distributed training context.
: = False
"""
Callback which stops training when self.state.shoudl_stop is set to True.
"""
=
=
# launch the Freak server in a background thread
=
# call the Freak API to set this to True
# this triggers lightning to stop training
= True