Topic modeling via sum-to-one constrained neural Poisson NMF. Built with PyTorch, runs on both CPUs and GPUs.
You can install tinytopics from PyPI:
pip install tinytopicsOr install the development version from GitHub:
git clone https://github.com/nanxstats/tinytopics.git
cd tinytopics
python3 -m pip install -e .For a more robust package management experience, use uv to manage tinytopics as a project dependency.
Add tinytopics and PyTorch to your project:
uv add tinytopics torch torchvisionTo install PyTorch with GPU support (for example, Windows with CUDA 13.0),
configure pyproject.toml:
[tool.uv.sources]
torch = [{ index = "pytorch-cu130", marker = "sys_platform == 'win32'" }]
torchvision = [{ index = "pytorch-cu130", marker = "sys_platform == 'win32'" }]
[[tool.uv.index]]
name = "pytorch-cu130"
url = "https://download.pytorch.org/whl/cu130"
explicit = trueThen sync your environment:
uv syncFor other platforms and accelerators (CPU-only, ROCm, Intel GPUs), see Using uv with PyTorch.
After tinytopics is installed, try examples from:
