{"id":23473,"library":"ctransformers","title":"ctransformers","description":"Python bindings for Transformer models implemented in C/C++ using the GGML library. Provides a high-level API for inference with popular models (LLaMA, Falcon, GPT-J, StarCoder, etc.) in GGML/GGUF format, with optional GPU acceleration (CUDA, Metal, ROCm). Latest version 0.2.27, active development.","status":"active","version":"0.2.27","language":"python","source_language":"en","source_url":"https://github.com/marella/ctransformers","tags":["llm","inference","ggml","gguf","transformer","cuda","metal","rocm"],"install":[{"cmd":"pip install ctransformers","lang":"bash","label":"Default CPU install"},{"cmd":"pip install ctransformers[cuda]","lang":"bash","label":"With CUDA support"},{"cmd":"pip install ctransformers[metal]","lang":"bash","label":"With Metal support (macOS)"},{"cmd":"pip install ctransformers[rocm]","lang":"bash","label":"With ROCm support"}],"dependencies":[],"imports":[{"note":"ctransformers provides its own AutoModelForCausalLM class, not from Hugging Face transformers.","wrong":"from transformers import AutoModelForCausalLM","symbol":"AutoModelForCausalLM","correct":"from ctransformers import AutoModelForCausalLM"}],"quickstart":{"code":"from ctransformers import AutoModelForCausalLM\n\nllm = AutoModelForCausalLM.from_pretrained('marella/gpt-2-ggml')\nprint(llm('AI is going to', max_new_tokens=50))","lang":"python","description":"Load a GGML model from Hugging Face Hub and generate text. Replace model ID with a valid GGML/GGUF model."},"warnings":[{"fix":"Remove calls to LLM.reset() and use high-level API (AutoModelForCausalLM).","message":"LLM.reset() method is deprecated since v0.2.27. Use high-level API instead (e.g., create a new instance or reuse with generation parameters).","severity":"deprecated","affected_versions":">=0.2.27"},{"fix":"Use GGUF v2 models or convert your model to GGUF format using llama.cpp convert scripts.","message":"Older GGML models (v1) may not work with newer versions of ctransformers. GGUF v2 support is added in v0.2.25, but GGML v1 support may be removed gradually.","severity":"breaking","affected_versions":">=0.2.25"},{"fix":"Install with the correct extra, e.g., pip install ctransformers[cuda]. Note: CUDA support is experimental for some model types.","message":"CUDA, Metal, and ROCm support are optional extras; install with appropriate extras like [cuda], [metal], or [rocm] to enable GPU acceleration.","severity":"gotcha","affected_versions":"all"},{"fix":"Pass model_type parameter, e.g., AutoModelForCausalLM.from_pretrained('./model.gguf', model_type='llama').","message":"Model types (model_type) must be explicitly specified if the model file name does not follow standard naming conventions. Otherwise loading may fail.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with: pip install ctransformers. If you need GPU, use pip install ctransformers[cuda] (or [metal]/[rocm]).","cause":"ctransformers is not installed or not installed with the correct extra for your platform.","error":"ModuleNotFoundError: No module named 'ctransformers'"},{"fix":"Use: from ctransformers import AutoModelForCausalLM. Ensure you have ctransformers >=0.2.0.","cause":"Import path is wrong; you are using an older version (<0.2.0) or importing incorrectly.","error":"AttributeError: module 'ctransformers' has no attribute 'AutoModelForCausalLM'"},{"fix":"Specify model_type explicitly, e.g., AutoModelForCausalLM.from_pretrained('path/to/model', model_type='llama').","cause":"The model file type is not recognized, often due to non-standard file name or format.","error":"ValueError: Unknown model type: '...'. Must be one of: ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}