Python bindings that make GGML models feel like Hugging Face natives
It exists so you can run fast, quantized GGML transformers from Python without abandoning the Hugging Face ecosystem.

What it does
CTransformers is essentially a Python wrapper around transformer models implemented in C/C++ via the GGML library. It exposes a unified AutoModelForCausalLM interface so you can load local GGML binaries or pull .bin/.gguf files directly from the Hugging Face Hub, generate text, stream tokens, and offload layers to GPU. It covers a wide zoo of architectures—LLaMA, Falcon, MPT, StarCoder, GPT-J, and others—without forcing you to touch the C layer.
The interesting bit
Rather than stopping at raw bindings, it apes the Hugging Face transformers API closely enough to slot into LangChain or even drive a pipeline() via an experimental hf=True mode. The result is that Python code can point at a quantized GGML model and mostly pretend it is a standard PyTorch citizen.
Key highlights
- Supports nine model families (LLaMA, Falcon, MPT, StarCoder, GPT variants, etc.) with CUDA acceleration for most and Metal for LLaMA.
- Loads
.binor.gguffiles directly from Hugging Face Hub without manual downloads. - GPU offloading via
gpu_layerslets you split work between CPU and GPU. - Exposes low-level internals—logits, embeddings, token IDs—for models that support them.
- Experimental GPTQ support (LLaMA only via ExLlama) and experimental 🤗 Transformers compatibility.
Caveats
- Several features are model-specific:
context_lengthtuning only works for LLaMA, MPT, and Falcon; embeddings are limited to LLaMA and Falcon. - GPTQ support is experimental and restricted to LLaMA models, with low-level APIs not fully supported.
- The 🤗 Transformers integration is explicitly flagged as experimental and subject to change.
Verdict
Worth a look if you want to run quantized GGML models from Python without rewriting your inference scripts. Skip it if you need guaranteed API stability or deep customization of every model architecture.
Frequently asked
- What is marella/ctransformers?
- It exists so you can run fast, quantized GGML transformers from Python without abandoning the Hugging Face ecosystem.
- Is ctransformers open source?
- Yes — marella/ctransformers is open source, released under the MIT license.
- What language is ctransformers written in?
- marella/ctransformers is primarily written in C.
- How popular is ctransformers?
- marella/ctransformers has 1.9k stars on GitHub.
- Where can I find ctransformers?
- marella/ctransformers is on GitHub at https://github.com/marella/ctransformers.