glmhmmt is the installable package for the Dynamax-based GLM-HMM / GLM-HMMT code.
If someone in the lab only wants to import the model class in their own code, this package is enough:
pip install "git+https://github.com/BrainCircuitsBehaviorLab/glmhmmt.git"or with uv:
uv pip install "git+https://github.com/BrainCircuitsBehaviorLab/glmhmmt.git"If they want to add it as a dependency in another uv project:
uv add "glmhmmt @ git+https://github.com/BrainCircuitsBehaviorLab/glmhmmt.git"Then in Python:
from glmhmmt import SoftmaxGLMHMMIf they want the baseline GLM fit directly in their own code, including binary lapses:
from glmhmmt import fit_glmSee examples/use_softmax_glmhmm.py for a minimal example that builds the model directly from arrays, without any task adapter.
For a baseline GLM example, see examples/glm_lapses/example.py.
The package root uses lazy imports, so importing SoftmaxGLMHMM does not require task adapters.
The CLI entrypoints under glmhmmt.cli.* are wrappers around task adapters, runtime paths, and result directories. They are useful for command-line workflows, but they are not the recommended import interface for another project.
glmhmmt now looks for config.toml by searching upward from the current working directory. That means each analysis project can keep its own config next to its notebooks and scripts.
The clean way to initialise one is:
uv run glmhmmt-init-configThat writes config.toml in the current working directory. You can also choose the destination explicitly:
uv run glmhmmt-init-config \
--path ./config.toml \
--data-dir /absolute/path/to/data \
--results-dir /absolute/path/to/resultsAt runtime, config precedence is:
configure_paths(...)GLMHMMT_CONFIG_PATH- nearest
config.tomlfound by upward search from the current working directory - repo-local
config.tomlfor editable installs - packaged defaults in
src/glmhmmt/resources/default_config.toml
The published package is tested against:
jax==0.4.35jaxlib==0.4.35tensorflow-probability==0.25.0optax==0.2.5
These pins are intentionally conservative because newer JAX / TFP combinations
have broken the tensorflow_probability.substrates.jax import path used by
dynamax and glmhmmt.model.
This package does not need task adapters when someone only wants the reusable model classes and fitting utilities.
If a user wants task-aware CLIs or notebooks, they can provide adapters in either of these ways:
- Put an
adapters/package in their own working directory, or configure[plugins].adapter_paths/GLMHMMT_TASK_PATHS. - Install a separate package that exposes entry points in the
glmhmmt.tasksgroup.
Minimal entry-point example:
[project.entry-points."glmhmmt.tasks"]
my_lab_task = "my_lab_glmhmmt.task:MyLabTaskAdapter"For lab use, the simplest setup is:
- Keep
glmhmmtin its own Git repo. - Keep task adapters in a separate companion repo.
- Install both from Git or from local editable paths during development.
That is usually better than publishing to PyPI immediately, because:
- it avoids exposing unrelated analysis code
- updates are simple
- private sharing inside the lab is easy
Publish to PyPI later only if you want a public, versioned release.
For work inside this repository:
uv sync
uv run python -c "from glmhmmt import SoftmaxGLMHMM; print(SoftmaxGLMHMM)"If you want the notebook extras too:
uv sync --extra notebooksThe project-local runtime overrides live in config.toml. Packaged defaults live in src/glmhmmt/resources/default_config.toml.