67 items
Streaming Without a Background Thread
Code QuizAutoTokenizer and AutoModel Loading
Code Quiz4-bit Loading with BitsAndBytesConfig
Code QuizGenerating and Decoding Output
Code QuizDeploying Open Models on Cloud GPUs
Slides / VideoSecuring Self-Hosted Model Servers
Slides / VideoDevice Placement with device_map
Code QuizHalf-Precision Loading with torch_dtype
Code QuizConfiguring Sampling Parameters
Code QuizLoading a Model with the Pipeline
Code QuizApplying a Chat Template
Code QuizSlicing Off the Prompt Tokens
Code QuizWhere trust_remote_code Belongs
Code QuizStop Sequence with stop_strings
Code QuizLocal Embedding and Reranker Models
Slides / VideoBenchmarking Local Inference Speed
Slides / VideoServing LoRA Adapters Locally
Slides / VideoContainerizing Local Model Deployments
Slides / VideoServing Quantized Models: Speed vs Quality
Slides / VideoChat Templates Per Model
Slides / VideoOpenAI-Compatible Local API Endpoints
Slides / VideoCPU Offloading and Mixed Inference
Slides / VideoModel Sharding and Parallelism
Slides / VideoEstimating VRAM for a Model
Slides / VideoPagedAttention and KV Cache Management
Slides / VideoProduction Serving Engines for LLMs
Slides / VideoLocal Inference Runtimes Compared
Slides / VideoModel Weight Formats Explained
Slides / VideoLandscape of Open Models
Slides / VideoEstimating VRAM from Parameter Count
Code QuizBatched Generation Padding Side
Code QuizMerging a LoRA Adapter
Code QuizLoading a Model from a Local Path
Code QuizAuthenticating for Gated HF Models
Code QuizGPU Offloading with n_gpu_layers
Code QuizKV Cache During Generation
Code QuizLocal Embeddings with sentence-transformers
Code Quizmax_new_tokens vs max_length
Code QuizDefault context window too small
Code QuizLoading a GGUF with llama-cpp
Code QuizvLLM model name mismatch
Code QuizOpenAI client base_url path
Code QuizReading an Ollama response
Code QuizMissing pad token for GPT-2
Code QuizOpen Model Licensing and Commercial Use
Slides / VideoOpen-Source vs Open-Weight vs Proprietary
Slides / VideoWhy Run LLMs Locally
Slides / VideoEdge and On-Device Constraints
FlashcardChat Templates per Model
FlashcardCloud GPU Providers for Self-Hosting
FlashcardServing LoRA Adapters Locally
FlashcardEvaluating Quantization Quality Loss
FlashcardContainerizing Model Deployments
FlashcardSecurity of Self-Hosted Inference
FlashcardContext Length and RoPE Scaling
FlashcardPagedAttention and vLLM
FlashcardHugging Face Hub Downloading
FlashcardLocal Inference Runtimes
FlashcardMemory Offloading
FlashcardOpen-Source Model Landscape
FlashcardOpen Weights vs Open Source
FlashcardGGUF Quantization Formats
FlashcardMulti-GPU Inference
FlashcardOpenAI-Compatible Local API
FlashcardGPU vs CPU vs Apple Silicon
FlashcardVRAM Estimation
FlashcardModel Weight Formats
FlashcardMerging a LoRA Adapter
A script saves a base model unchanged because the LoRA merge method is never actually called.
from peft import PeftModel
from transformers import AutoModelForCausalLM
base = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf")
model = PeftModel.from_pretrained(base, "./my-lora-adapter")
merged = model.merge_and_unload
merged.save_pretrained("./merged-model")What is the bug that prevents the adapter from being merged?