Instructions to use truegleai/deepseek-coder-api with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use truegleai/deepseek-coder-api with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf truegleai/deepseek-coder-api:Q4_K_M # Run inference directly in the terminal: llama cli -hf truegleai/deepseek-coder-api:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf truegleai/deepseek-coder-api:Q4_K_M # Run inference directly in the terminal: llama cli -hf truegleai/deepseek-coder-api:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf truegleai/deepseek-coder-api:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf truegleai/deepseek-coder-api:Q4_K_M
Use Docker
docker model run hf.co/truegleai/deepseek-coder-api:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use truegleai/deepseek-coder-api with Ollama:
ollama run hf.co/truegleai/deepseek-coder-api:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use truegleai/deepseek-coder-api with Docker Model Runner:
docker model run hf.co/truegleai/deepseek-coder-api:Q4_K_M
- Lemonade
How to use truegleai/deepseek-coder-api with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull truegleai/deepseek-coder-api:Q4_K_M
Run and chat with the model
lemonade run user.deepseek-coder-api-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Upload folder using huggingface_hub
Browse filesFiles changed (5)
- .gitattributes+1
- DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.ggufAdded+3
- README.mdAdded+34
- app.pyAdded+100
- requirements.txtAdded+4
32 unmodified lines3334353632 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textDeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text123version https://git-lfs.github.com/spec/v1oid sha256:38bc76f3326b49b4d81d1027d092bf7ce5b4ed2de4136d1d2e7e6347c3ec8376size 1036441648012345678910111213141516171819202122232425262728293031323334---title: DeepSeek Coder V2 Lite 16Bemoji: 💻colorFrom: bluecolorTo: greensdk: gradiosdk_version: 4.0.0app_file: app.pypinned: false---
# 🚀 o87Dev - Maximum Capacity Deployment
**Strategy:** Deploy the largest viable model (`DeepSeek-Coder-V2-Lite-Instruct-16B-Q4_K_M`) on Hugging Face's free CPU tier.
## ⚙️ Technical Details- **Model:** DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.gguf (10.4GB)- **Quantization:** Q4_K_M (Optimal quality/size for free tier)- **Loader:** `llama-cpp-python` (CPU optimized)- **Context:** 2048 tokens (max for free tier stability)
## 📊 Performance Expectations- **First load:** ~60-120 seconds (model loads from disk)- **Inference speed:** ~2-5 tokens/second on CPU- **Memory usage:** ~12-14GB of 16GB available
## 🎯 Usage Tips1. First request triggers model load (be patient)2. Keep prompts under 500 tokens for best results3. Use temperature 0.7-0.9 for creative tasks4. Monitor memory usage in Space logs
## 🔗 IntegrationThis Space serves as the primary AI endpoint for the o87Dev local API server.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100import gradio as grfrom huggingface_hub import hf_hub_downloadfrom llama_cpp import Llamaimport timeimport os
# ConfigurationMODEL_NAME = "DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.gguf"MODEL_PATH = MODEL_NAME # Since we placed it in the same directory
# Initialize model (will be loaded on first use)llm = None
def load_model(): """Lazy-load the model only when needed.""" global llm if llm is None: print(f"⏳ Loading model {MODEL_NAME}... This may take 1-2 minutes on first run.") start_time = time.time() # CPU-optimized settings for free tier llm = Llama( model_path=MODEL_PATH, n_ctx=2048, # Context size (smaller = less memory) n_threads=2, # Use 2 CPU threads n_gpu_layers=0, # CPU only on free tier verbose=False ) load_time = time.time() - start_time print(f"✅ Model loaded in {load_time:.1f} seconds. Ready for inference.") return llm
def generate_code(prompt, max_tokens=256, temperature=0.7): """Main generation function.""" try: model = load_model() # Format prompt for DeepSeek-Coder Instruct models formatted_prompt = f"### Instruction:\n{prompt}\n\n### Response:\n" # Generate output = model( formatted_prompt, max_tokens=max_tokens, temperature=temperature, top_p=0.95, echo=False, stop=["###", "\n\n\n"] ) return output['choices'][0]['text'].strip() except Exception as e: return f"❌ Error: {str(e)}"
# Create Gradio interfacedemo = gr.Interface( fn=generate_code, inputs=[ gr.Textbox( label="Code Prompt", placeholder="Write a Python function to reverse a string...", lines=4 ), gr.Slider( minimum=32, maximum=512, value=256, step=32, label="Max Tokens" ), gr.Slider( minimum=0.1, maximum=1.0, value=0.7, step=0.1, label="Temperature" ) ], outputs=gr.Code( label="Generated Code", language="python" ), title="💻 DeepSeek Coder V2 Lite (16B) - o87Dev", description="**CPU Deployment** - Largest viable model on Hugging Face Spaces free tier. ⚠️ **First request loads model (~1-2 min)**", examples=[ ["Write a Python function to check if a number is prime"], ["Create a React component for a login form"], ["Explain binary search algorithm in Python"] ])
# Launch with queue for better handling on free tierif __name__ == "__main__": demo.launch( server_name="0.0.0.0", server_port=7860, share=False # Set to True if you want a public link )1234gradio>=4.0.0llama-cpp-python>=0.3.0 # CPU-optimized GGUF loaderhuggingface-hub>=0.20.0sentencepiece>=0.1.99 # Tokenizer for many models.gitattributes+1
DeepSeek-Coder-V2-Lite-Instruct-Q4_K_M.ggufAdded+3
README.mdAdded+34
app.pyAdded+100
requirements.txtAdded+4