{"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,"search_vec":"'0.2.27':44 'acceler':38 'activ':45 'api':19 'bind':3 'c/c':9 'ctransform':1 'cuda':39,52 'develop':46 'etc':31 'falcon':26 'format':34 'ggml':12,49 'ggml/gguf':33 'gguf':50 'gpt':28 'gpt-j':27 'gpu':37 'high':17 'high-level':16 'implement':7 'infer':21,48 'j':29 'latest':42 'level':18 'librari':13 'llama':25 'llm':47 'metal':40,53 'model':6,24 'option':36 'popular':23 'provid':14 'python':2 'rocm':41,54 'starcod':30 'transform':5,51 'use':10 'version':43","created_at":"2026-05-01T08:07:57.768691+00:00","updated_at":"2026-05-01T08:07:57.768691+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.2.27","cli_name":"","cli_version":null,"type":"library","homepage":"https://ctransformers.dev","github":"https://github.com/marella/ctransformers","docs":null,"changelog":null,"pypi":"https://pypi.org/project/ctransformers/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","llm-agents"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}