Agent skill

unsloth-inference

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/cuba6112/skillfactory/tree/main/skills/unsloth-inference

SKILL.md

Overview

Unsloth models can be deployed using native optimized inference or through production serving engines like vLLM and SGLang. Native inference is accelerated 2x via for_inference(), while production serving requires merging LoRA weights into the base model.

When to Use

  • When performing local testing or simple application deployment.
  • When building high-throughput production endpoints using vLLM or SGLang.
  • When creating OpenAI-compatible APIs for drop-in replacement in existing apps.

Decision Tree

  1. Is throughput the priority?
    • Yes: Merge to 16-bit and use vLLM.
  2. Is VRAM for serving extremely limited?
    • Yes: Merge to 4-bit or use GGUF via Ollama.
  3. Running simple Python inference?
    • Yes: Call FastLanguageModel.for_inference(model).

Workflows

Native Optimized Inference

  1. Load fine-tuned model and tokenizer using FastLanguageModel.
  2. Call FastLanguageModel.for_inference(model) to enable optimized kernels.
  3. Use model.generate() with inputs formatted via the chat template.

Merging LoRA for vLLM Serving

  1. Select export method: 'merged_16bit' (quality) or 'merged_4bit' (VRAM).
  2. Run model.save_pretrained_merged("serving_model", tokenizer, save_method='merged_16bit').
  3. Start vLLM server pointing to the 'serving_model' directory.

Non-Obvious Insights

  • Calling FastLanguageModel.for_inference(model) is mandatory for speed; it performs on-the-fly weight fusion and enables specialized Triton kernels for the forward pass.
  • Most production serving engines (vLLM, SGLang) cannot use LoRA adapters directly without performance hits; merging them into the base model during export is the standard best practice.
  • The unsloth-cli provides a pre-built OpenAI-compatible endpoint, making it easy to serve models locally and test with standard API clients.

Evidence

  • "Unsloth itself provides 2x faster inference natively as well, so always do not forget to call FastLanguageModel.for_inference(model)." Source
  • "model.save_pretrained_merged("output", tokenizer, save_method = "merged_16bit")" Source

Scripts

  • scripts/unsloth-inference_tool.py: Script for running local optimized inference.
  • scripts/unsloth-inference_tool.js: Helper to test OpenAI-compatible endpoints.

Dependencies

  • unsloth
  • torch
  • vllm (optional for production)
  • sglang (optional for production)

References

  • [[references/README.md]]

Expand your agent's capabilities with these related and highly-rated skills.

cuba6112/skillfactory

prompt-engineering

Comprehensive prompt engineering techniques for Claude models. Use this skill when crafting, optimizing, or debugging prompts for Claude API, Claude Code, or any Claude-powered application. Covers system prompts, role prompting, multishot examples, chain of thought, XML structuring, long context handling, extended thinking, prompt chaining, Claude 4.x-specific best practices, and agentic orchestration including subagents, agent loops, skills, MCP integration, and multi-agent workflows.

0 0
Explore
cuba6112/skillfactory

adk-rag-agent

Build RAG (Retrieval-Augmented Generation) agents with Google ADK and Vertex AI RAG Engine. Use when implementing document Q&A, knowledge base search, or citation-backed responses. Covers VertexAiRagRetrieval tool, corpus setup, and citation formatting.

0 0
Explore
cuba6112/skillfactory

headless-cli-agents

Build agentic systems using Claude CLI in headless mode or the Claude Agent SDK. Use when building automation pipelines, CI/CD integrations, multi-agent orchestration, or programmatic Claude interactions. Covers CLI flags (-p, --output-format), session management (--resume, --continue), Python SDK (claude-agent-sdk), custom tools, and agent loop patterns.

0 0
Explore
cuba6112/skillfactory

notion-knowledge-capture

Capture conversations and decisions into structured Notion pages; use when turning chats/notes into wiki entries, how-tos, decisions, or FAQs with proper linking.

0 0
Explore
cuba6112/skillfactory

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

0 0
Explore
cuba6112/skillfactory

gh-fix-ci

Inspect GitHub PR checks with gh, pull failing GitHub Actions logs, summarize failure context, then create a fix plan and implement after user approval. Use when a user asks to debug or fix failing PR CI/CD checks on GitHub Actions and wants a plan + code changes; for external checks (e.g., Buildkite), only report the details URL and mark them out of scope.

0 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results