https://github.com/nanxstats/tinytopics
GPU-accelerated topic modeling via sum-to-one constrained neural Poisson NMF with PyTorch
https://github.com/nanxstats/tinytopics
nonnegative-matrix-factorization pytorch topic-modeling
Last synced: about 1 month ago
JSON representation
GPU-accelerated topic modeling via sum-to-one constrained neural Poisson NMF with PyTorch
- Host: GitHub
- URL: https://github.com/nanxstats/tinytopics
- Owner: nanxstats
- License: mit
- Created: 2024-10-17T03:55:31.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-04-10T07:27:47.000Z (about 1 month ago)
- Last Synced: 2025-04-18T20:31:55.653Z (about 1 month ago)
- Topics: nonnegative-matrix-factorization, pytorch, topic-modeling
- Language: Python
- Homepage: https://nanx.me/tinytopics/
- Size: 6.1 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# tinytopics
[](https://pypi.org/project/tinytopics/)

[](https://github.com/nanxstats/tinytopics/actions/workflows/ci-tests.yml)
[](https://nanx.me/tinytopics/)
[](https://pypistats.org/packages/tinytopics)
Topic modeling via sum-to-one constrained neural Poisson NMF.
Built with PyTorch, runs on both CPUs and GPUs.## Installation
### Using pip
You can install tinytopics from PyPI:
```bash
pip install tinytopics
```Or install the development version from GitHub:
```bash
git clone https://github.com/nanxstats/tinytopics.git
cd tinytopics
python3 -m pip install -e .
```### Install PyTorch with GPU support
The above will likely install the CPU version of PyTorch by default.
To install PyTorch with GPU support, follow the
[official guide](https://pytorch.org/get-started/locally/).For example, install PyTorch for Windows with CUDA 12.6:
```bash
pip uninstall torch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
```### Install alternative PyTorch versions
For users stuck with older PyTorch or NumPy versions, for instance, in HPC
cluster settings, a workaround is to skip installing the dependencies with
`--no-deps` and install specific versions of all dependencies manually:```bash
pip install tinytopics --no-deps
pip install torch==2.2.0
```### Use tinytopics in a project
To have a more hassle-free package management experience, it is recommended
to use tinytopics as a dependency under a project context using
virtual environments.You should probably set up a manual source/index for PyTorch.
As examples, check out the official guidelines when
[using Rye](https://rye.astral.sh/guide/faq/#how-do-i-install-pytorch) or
[using uv](https://docs.astral.sh/uv/guides/integration/pytorch/).## Examples
After tinytopics is installed, try examples from:
- [Getting started guide with simulated count data](https://nanx.me/tinytopics/articles/get-started/)
- [CPU vs. GPU speed benchmark](https://nanx.me/tinytopics/articles/benchmark/)
- [Text data topic modeling example](https://nanx.me/tinytopics/articles/text/)
- [Memory-efficient training](https://nanx.me/tinytopics/articles/memory/)
- [Distributed training](https://nanx.me/tinytopics/articles/distributed/)