{"id":51016609,"url":"https://github.com/flexthink/flexlog","last_synced_at":"2026-06-21T11:30:42.533Z","repository":{"id":362158669,"uuid":"1251732991","full_name":"flexthink/flexlog","owner":"flexthink","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-02T22:33:52.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-03T00:12:42.240Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flexthink.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-27T21:34:31.000Z","updated_at":"2026-06-02T22:33:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/flexthink/flexlog","commit_stats":null,"previous_names":["flexthink/flexlog"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/flexthink/flexlog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexthink%2Fflexlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexthink%2Fflexlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexthink%2Fflexlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexthink%2Fflexlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flexthink","download_url":"https://codeload.github.com/flexthink/flexlog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexthink%2Fflexlog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34608891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-21T11:30:37.264Z","updated_at":"2026-06-21T11:30:42.528Z","avatar_url":"https://github.com/flexthink.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FlexLog\n\nFlexLog adds lightweight artifact logging helpers around SpeechBrain train\nloggers.\n\nIt provides:\n\n- `FlexTrainLogger`: aggregates multiple loggers and can enable or disable\n  each output by name.\n- `FlexFileTrainLogger`: writes image, text, and audio artifacts to a local\n  progress folder.\n- `FlexWandBLogger`: logs artifacts to Weights \u0026 Biases.\n\n## Installation\n\nInstall the package in editable mode from the repository root:\n\n```bash\npip install -e .\n```\n\nFor tests:\n\n```bash\npip install -e \".[test]\"\n```\n\nIf you want to use `FlexWandBLogger`, make sure W\u0026B is available:\n\n```bash\npip install \"wandb\u003e=0.16\"\n```\n\n## Basic Usage\n\n### HyperPyYAML\n\nThe intended use is to instantiate `FlexTrainLogger` from HyperPyYAML and pass\nit into your SpeechBrain training code as the train logger.\n\n```yaml\noutput_folder: results/example\nlogging_file_enabled: True\nlogging_wandb_enabled: False\nlogging_wandb_project: my_project\nlogging_wandb_name: my_run\n\ntrain_logger: !new:flexlog.flex.FlexTrainLogger\n    outputs:\n        file: !name:flexlog.file.FlexFileTrainLogger\n            save_file: !ref \u003coutput_folder\u003e/train_log.txt\n            progress_folder: !ref \u003coutput_folder\u003e/progress\n\n        wandb: !name:flexlog.wandb.FlexWandBLogger\n            initializer: !name:wandb.init\n                project: !ref \u003clogging_wandb_project\u003e\n                name: !ref \u003clogging_wandb_name\u003e\n                dir: !ref \u003coutput_folder\u003e/wandb\n                reinit: True\n                resume: allow\n\n    enabled:\n        file: !ref \u003clogging_file_enabled\u003e\n        wandb: !ref \u003clogging_wandb_enabled\u003e\n    runtime_toggle: False\n```\n\nLoad it the same way as other SpeechBrain HyperPyYAML configuration:\n\n```python\nfrom hyperpyyaml import load_hyperpyyaml\n\nwith open(\"hparams.yaml\", encoding=\"utf-8\") as fin:\n    hparams = load_hyperpyyaml(fin)\n\ntrain_logger = hparams[\"train_logger\"]\n```\n\nThe keys under `outputs` are logger names. The `enabled` mapping controls which\noutputs receive logs, so you can keep W\u0026B configured but disabled for local\nruns. The enable flags and W\u0026B run identifiers are top-level values so\nSpeechBrain command-line overrides can change them directly.\n\n`runtime_toggle` controls when outputs are initialized:\n\n- With `runtime_toggle: False` (the default), only outputs enabled when\n  `FlexTrainLogger` is created are initialized. This is useful when an output\n  requires an external provider, installed integration, account, or\n  credentials that are not available for every run.\n- With `runtime_toggle: True`, all outputs are initialized, including disabled\n  ones. You can then change the `enabled` mapping while the program is running\n  to start or stop forwarding logs without recreating the logger.\n\nTo defer initialization in HyperPyYAML, define each output with `!name:` as\nshown above. Using `!new:` creates the output before `FlexTrainLogger` can\ncheck whether it is enabled.\n\nFor example:\n\n```bash\npython train.py hparams.yaml \\\n    --logging_wandb_enabled=True \\\n    --logging_wandb_project=my_project \\\n    --logging_wandb_name=experiment_001\n```\n\n### Aggregate Multiple Loggers\n\n```python\nfrom flexlog.flex import FlexTrainLogger\nfrom flexlog.file import FlexFileTrainLogger\n\nfile_logger = FlexFileTrainLogger(save_file=\"logs/train.log\")\n\nlogger = FlexTrainLogger(\n    outputs={\"file\": file_logger},\n    enabled={\"file\": True},\n)\n\nlogger.log_stats(\n    stats_meta={\"epoch\": 1},\n    train_stats={\"loss\": 0.42},\n    valid_stats={\"loss\": 0.51},\n)\n```\n\n`FlexTrainLogger` forwards `log_stats` to every enabled logger. Artifact\nmethods are forwarded only to enabled loggers that support the matching method:\n\n- `log_image(...)`\n- `log_text(...)`\n- `log_audio(...)`\n\nThis means a logger can support only text, only audio, or any other subset of\nartifact methods.\n\n### Enable or Disable Outputs\n\n```python\nlogger = FlexTrainLogger(\n    outputs={\n        \"file\": file_logger,\n        \"wandb\": wandb_logger,\n    },\n    enabled={\n        \"file\": True,\n        \"wandb\": False,\n    },\n)\n```\n\nDisabled outputs are skipped for both stats and artifact logging.\n\n## File Artifacts\n\n`FlexFileTrainLogger` saves artifacts under a progress folder next to the train\nlog file by default:\n\n```python\nfrom speechbrain import Stage\nimport torch\n\nfrom flexlog.file import FlexFileTrainLogger\n\nlogger = FlexFileTrainLogger(save_file=\"logs/train.log\")\n\nlogger.log_text(\n    key=\"transcript\",\n    text=\"hello world\",\n    stats_meta={\"epoch\": 3},\n    stage=Stage.VALID,\n)\n\nlogger.log_audio(\n    key=\"sample\",\n    audio=torch.zeros(16000),\n    sample_rate=16000,\n    stats_meta={\"epoch\": 3},\n    stage=Stage.VALID,\n)\n```\n\nWhen `stage` and `epoch` are provided, artifacts are saved as:\n\n```text\nlogs/progress/valid/3/transcript.txt\nlogs/progress/valid/3/sample.wav\n```\n\nIf `stage` is omitted, the epoch folder is placed directly under\n`progress/`. If `epoch` is omitted, artifacts are written directly under the\nstage folder or the progress folder.\n\n## Weights \u0026 Biases\n\n`FlexWandBLogger` extends SpeechBrain's `WandBLogger` with artifact helpers:\n\n```python\nfrom flexlog.wandb import FlexWandBLogger\n\nlogger = FlexWandBLogger(...)\n\nlogger.save_text(\"caption\", \"hello\", stats_meta={\"epoch\": 1})\nlogger.save_image(\"plot\", image_array, stats_meta={\"epoch\": 1})\nlogger.log_audio(\"sample\", audio_tensor, sample_rate=16000)\n```\n\nFor file paths and W\u0026B steps, FlexLog accepts the SpeechBrain epoch metadata\nkeys `epoch`, `Epoch`, and `Epoch loaded`.\n\n## Development\n\nRun tests with:\n\n```bash\nPYTHONPATH=src pytest tests -q\n```\n\nSome Torch/SpeechBrain environments need an explicit temporary directory:\n\n```bash\nmkdir -p .pytest-tmp\nTMPDIR=$PWD/.pytest-tmp TEMP=$PWD/.pytest-tmp TMP=$PWD/.pytest-tmp \\\nTORCHINDUCTOR_CACHE_DIR=$PWD/.pytest-tmp/torchinductor \\\nPYTHONPATH=src pytest -p no:cacheprovider tests -q\nrm -rf .pytest-tmp\n```\n\n## License\n\nFlexLog is licensed under the Apache License, Version 2.0. See\n[LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexthink%2Fflexlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflexthink%2Fflexlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexthink%2Fflexlog/lists"}