{"id":32519650,"url":"https://github.com/rystrauss/bax","last_synced_at":"2025-10-28T04:38:51.111Z","repository":{"id":57414180,"uuid":"423634383","full_name":"rystrauss/bax","owner":"rystrauss","description":"A flexible trainer interface for Jax and Haiku.","archived":false,"fork":false,"pushed_at":"2022-05-30T16:39:36.000Z","size":96,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-25T13:52:16.536Z","etag":null,"topics":["boilerplate","dm-haiku","jax","trainer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rystrauss.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}},"created_at":"2021-11-01T22:27:45.000Z","updated_at":"2025-03-10T22:24:56.000Z","dependencies_parsed_at":"2022-08-26T20:32:04.930Z","dependency_job_id":null,"html_url":"https://github.com/rystrauss/bax","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/rystrauss/bax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rystrauss%2Fbax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rystrauss%2Fbax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rystrauss%2Fbax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rystrauss%2Fbax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rystrauss","download_url":"https://codeload.github.com/rystrauss/bax/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rystrauss%2Fbax/sbom","scorecard":{"id":793160,"data":{"date":"2025-08-11","repo":{"name":"github.com/rystrauss/bax","commit":"9d035dc9711f8df4629b7b9fb25d0951275891bc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/rystrauss/bax/python-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/rystrauss/bax/python-publish.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:29","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T08:09:09.831Z","repository_id":57414180,"created_at":"2025-08-23T08:09:09.831Z","updated_at":"2025-08-23T08:09:09.831Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281386563,"owners_count":26492014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"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":["boilerplate","dm-haiku","jax","trainer"],"created_at":"2025-10-28T04:38:45.425Z","updated_at":"2025-10-28T04:38:50.618Z","avatar_url":"https://github.com/rystrauss.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bax\n\nBax, short for \"boilerplate jax\", is a small library that provides a flexible trainer\ninterface for Jax.\n\nBax is rather strongly opinionated in a few ways. First, it is designed for use with the\n[Haiku](https://github.com/deepmind/dm-haiku) neural network library and is not\ncompatible with e.g. [Flax](https://github.com/google/flax). Second, Bax assumes that\ndata will be provided as a `tf.data.Dataset`. The goal of this library is not to be\nwidely compatible and high-level (like [Elegy](https://github.com/poets-ai/elegy)).\n\nIf you are okay with making the above assumptions, then Bax will hopefully make your\nlife much easier by implementing the boilerplate code involved in neural network\ntraining loops.\n\nPlease note that this library has not yet been extensively tested.\n\n## Installation\n\nYou can install Bax via pip:\n\n```\npip install bax\n```\n\n## Usage\n\nBelow are some simple examples that illustrate how to use Bax.\n\n### MNIST Classification\n\n```python\nimport optax\nimport tensorflow_datasets as tfds\nimport haiku as hk\nimport jax.numpy as jnp\nimport jax\n\nfrom bax.trainer import Trainer\n\n\n# Use TensorFlow Datasets to get our MNIST data.\ntrain_ds = tfds.load(\"mnist\", split=\"train\").batch(32, drop_remainder=True)\ntest_ds = tfds.load(\"mnist\", split=\"test\").batch(32, drop_remainder=True)\n\n# The loss function that we want to minimize.\ndef loss_fn(step, is_training, batch):\n    model = hk.Sequential([hk.Flatten(), hk.nets.MLP([128, 128, 10])])\n\n    preds = model(batch[\"image\"] / 255.0)\n    labels = jax.nn.one_hot(batch[\"label\"], 10)\n\n    loss = jnp.mean(optax.softmax_cross_entropy(preds, labels))\n    accuracy = jnp.mean(jnp.argmax(preds, axis=-1) == batch[\"label\"])\n\n    # The first returned value is the loss, which is what will be minimized by the\n    # trainer. The second value is a dictionary that can contain other metrics you\n    # might be interested in (or, it can just be empty).\n    return loss, {\"accuracy\": accuracy}\n\ntrainer = Trainer(loss=loss_fn, optimizer=optax.adam(0.001))\n\n# Run the training loop. Metrics will be printed out each time the validation\n# dataset is evaluated (in this case, every 1000 steps).\ntrainer.fit(train_ds, steps=10000, val_dataset=test_ds, validation_freq=1000)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frystrauss%2Fbax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frystrauss%2Fbax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frystrauss%2Fbax/lists"}