$ show LDLINGLINGLING/adan_application
This repository is a personal cookbook and project showcase centered on the MiniCPM family of large language models (MiniCPM, MiniCPM-V, MiniCPM3). It contains over a dozen distinct application projects, including multi-modal OCR + visual grounding (OCR_VG), cross-modal image-text search, ReAct-style agent planning (agent_auto_plan), MBTI personality role-play, low-memory RAG (4G_memory_rag), AWQ quantization, embedding extraction, SFT/DPO fine-tuning pipelines, and Windows agent demos. Each project includes source code, shell scripts, and accompanying Chinese/English tutorials in markdown format. The codebase is primarily a collection of independent, loosely coupled modules rather than a unified application. It demonstrates practical usage of MiniCPM models for fine-tuning, deployment with vLLM/Ollama/llama.cpp, and integration with LangChain. The quality is functional but inconsistent: many modules contain hardcoded paths, duplicated logic, and lack tests, yet several components (ReAct data generation, image slicing utilities, LangChain wrapper) exhibit sufficient isolation and craftsmanship to be reusable across projects. The repo is actively maintained with a recent commit, but dependency on unmerged forks and version-specific model files poses a medium technical drift risk.
The LLM identified 4 files worth highlighting for reuse:
Generates ReAct-format training data for agent fine-tuning. Uses a teacher model (Qwen2.5-72B) to produce tool-calling trajectories given a query and tools. The output can be used to train a smaller model to perform ReAct reasoning. The script is parameterized (teacher model, tools, output path) and can be adapted to different domains or tool sets with minimal changes.
Contains image preprocessing utilities optimized for multi-modal models: `slice_image`, `find_best_resize`, `split_to_patches`. These handle high-resolution images by slicing them into grids, resizing to optimal dimensions, and generating attention masks. The logic is model-agnostic and can be reused in any vision-language pipeline requiring variable-resolution input.
Provides a self-contained LangChain RAG integration using MiniCPM. Includes custom `MiniCPM_LLM` wrapper, embedding setup, vector store (Chroma), prompt template, and a Gradio interface. The pattern is generic and can be adapted to any LLM by replacing the wrapper class. Demonstrates a clean, reusable RAG pipeline without tight coupling to the rest of the repo.
Implements a set of utility functions for the agent planning loop: `call_plugin` (tool execution with error handling), `generate_scheme` (task decomposition prompt), `add_reflexion` (self-correction after failures). The function structure adheres to the ReAct pattern and is loosely coupled, making it portable to other agent frameworks with minimal changes.