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
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(
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()
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.dev14.tar.gz
(13.3 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.dev14.tar.gz.
File metadata
- Download URL: absl_extra-0.0.3.dev14.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86387139dd48880ab473aec913d6c7ea0eab3e65ba5fddea8064606657e8b4cb
|
|
| MD5 |
8d3f3bbf8d7f0eb6f8a8c868c75763f5
|
|
| BLAKE2b-256 |
8664171ec8adc1958b7e38ae08afaa5ff2e8ec2765dfef2c9944c19f931554a5
|
File details
Details for the file absl_extra-0.0.3.dev14-py3-none-any.whl.
File metadata
- Download URL: absl_extra-0.0.3.dev14-py3-none-any.whl
- Upload date:
- Size: 16.2 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 |
511c9463b167607b009c3f0f9059cdf3ee64bcb4447ac2c13716fcd8e5650834
|
|
| MD5 |
eabcf86c3771424e31e125653e7a772e
|
|
| BLAKE2b-256 |
e7879e24679fc575716dc4612057380ae46a51d1ab2490e2b187e4f65627d62c
|