A wrapper to run and monitor absl app.
Project description
ABSL-Extra
A collection of utils I commonly use for running my experiments. It will:
- Notify on execution start, finish or failed.
- By default, Notifier will just log those out to
stdout. - I prefer receiving those in Slack, though (see example below).
- By default, Notifier will just log those out to
- Log parsed CLI flags from
absl.flags.FLAGSand config values fromconfig_file:get_config() - Inject
ml_collections.ConfigDictfromconfig_file, if kwarg provided. - Inject
pymongo.collection.Collectionifmongo_configkwarg provided. - Select registered task to run based on --task= CLI argument.
Minimal example
import os
from pymongo.collection import Collection
from ml_collections import ConfigDict
from absl import logging
import tensorflow as tf
from absl_extra import tf_utils, tasks, notifier
@tasks.register_task(
config_file="config.py",
mongo_config=dict(uri=os.environ["MONGO_URI"], db_name="my_project", collection="experiment_1"),
notifier=notifier.SlackNotifier(slack_token=os.environ["SLACK_BOT_TOKEN"], channel_id=os.environ["CHANNEL_ID"])
)
@tf_utils.requires_gpu
def main(config: ConfigDict, db: Collection) -> None:
if tf_utils.supports_mixed_precision():
tf.keras.mixed_precision.set_global_policy("mixed_float16")
with tf_utils.make_gpu_strategy().scope():
logging.info("Doing some heavy lifting...")
if __name__ == "__main__":
tasks.run()
Planned for:
- global app state for different tasks
- list of pre/post hooks
- keras callback with notifier
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
absl_extra-0.0.3.dev4.tar.gz
(13.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file absl_extra-0.0.3.dev4.tar.gz.
File metadata
- Download URL: absl_extra-0.0.3.dev4.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc8ea5b3b2ec88c45ec41c9c09ed45131acef8abfec6eb5981f7c858141980f3
|
|
| MD5 |
513d3b4ae95db0f3d819631910c8f98f
|
|
| BLAKE2b-256 |
2e5d3188c1c8b3dd499592018c1d33c144cb3e32f1178e647cb9ae92aef98535
|
File details
Details for the file absl_extra-0.0.3.dev4-py3-none-any.whl.
File metadata
- Download URL: absl_extra-0.0.3.dev4-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b8a276864bedf1a0a24b8c2b29b23e77103fe22731ef903bfb1137cedcbc214
|
|
| MD5 |
2330daa8f14aa09a4847118c25b8beb0
|
|
| BLAKE2b-256 |
87e049126e7f4616bfe81bb5c9179cb98ff261625bfa6d8c3aeaf7b0e967b45b
|