Installation¶
Requirements¶
- Python 3.12 or newer.
- PyTorch, Transformers and Sentence-Transformers. They are installed as dependencies. TopicJev is tested with Python 3.12, torch 2.14, transformers 5.18 and sentence-transformers 6.1.
- Optional: an NVIDIA GPU (CUDA) or an Apple Silicon Mac (MPS). Everything also runs on the CPU, only slower.
Create a virtual environment¶
Use a fresh virtual environment, so TopicJev's pinned dependencies do not clash with other projects:
Install from source¶
The core install contains every backend except LLMLingua-2. Optional extras add more:
| Extra | Adds | Needed for |
|---|---|---|
lingua |
llmlingua |
LinguaCompressor |
examples |
bertopic, pandas, scikit-learn, datasets |
The examples |
all |
All of the above | Everything |
GPU support¶
TopicJev uses whatever device the installed PyTorch build can reach: CUDA first, then Apple
Silicon (MPS), then the CPU. See Hardware and Memory for details and for the
TOPICJEV_DEVICE override.
NVIDIA GPU (Windows, Linux)¶
On Windows, a plain pip install gets a CPU-only build of PyTorch from PyPI, so an NVIDIA GPU sits
idle. Install the CUDA build instead, from the repository root:
This installs torch==2.14.1+cu126 from the PyTorch package index (on Windows x64 and
Linux x86_64), then TopicJev itself with all extras.
Check your CUDA driver first
Run nvidia-smi: the CUDA Version in its header must be 12.6 or higher, because
requirements-cuda.txt installs PyTorch built for CUDA 12.6. With an older driver, PyTorch
installs but cannot use the GPU, and everything silently runs on the CPU. Update the driver,
or pick a matching build with the PyTorch selector.
Verify that PyTorch sees the GPU:
Apple Silicon (macOS)¶
Nothing extra is needed: the PyPI build of PyTorch supports Apple Silicon GPUs (MPS), and TopicJev uses them automatically.
Verify the installation¶
python -c "import topicjev; print(topicjev.__version__)"
python -c "from topicjev.backend import detect_device; print(detect_device())"
The second command prints the device and precision TopicJev will use, for example
(device(type='mps'), torch.float32) on an Apple Silicon Mac.
Models and credentials¶
TopicJev does not ship model weights. Every backend takes a
Hugging Face Hub model name (or a local path) and downloads the
weights on first use into the Hugging Face cache (~/.cache/huggingface/hub by default; set
HF_HOME to move it). Later runs reuse the cache.
- Gated models such as
meta-llama/*need an accepted license on the Hub and a login:hf auth login. - Offline runs: once the models are cached, set
HF_HUB_OFFLINE=1to skip all network calls. -
TypeSafe API:
JevEntailreads its key from theTYPESAFE_API_KEYenvironment variable, or from a.envfile in the working directory, e.g. at the repository root:
Development tools¶
Development tools are declared as dependency groups, which need pip 25.1 or newer: