Genai Vision 标志

Genai Vision

社区
j4flmao
genai-vision

Use this skill when the user says 'generate images', 'Stable Diffusion', 'SDXL', 'FLUX', 'diffusers pipeline', 'image-to-image', 'inpainting', 'Whisper transcription', 'speech to image pipeline'. Implements local or self-hosted image generation with Hugging Face diffusers and speech transcription with Whisper, including memory optimization, reproducibility, licensing, and safety checks. Do NOT use for: vision-language understanding / VLM pipelines (rnd/ai-agents/multimodal-pipelines), training diffusion models from scratch (fundamental-truths/statistical-mechanics for theory), or classic CV tasks like detection (ml computer-vision skill).

概览

发布者j4flmao
代码仓库agent-skills
技能名称genai-vision
星标数
41
复刻数
6
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 j4flmao 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Genai Vision AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/j4flmao/agent-skills/tree/main/skills/ai/genai-vision
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p .claude/skills
cp -r /tmp/agent-skills/skills/ai/genai-vision .claude/skills/genai-vision
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Genai Vision,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Genai Vision。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Genai Vision 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

GenAI Vision & Audio

Purpose

Ship image generation and speech transcription with open models: pick a model whose license fits the use case, load it in half precision with sensible memory settings, make outputs reproducible, and wrap it in a service that handles queuing and safety. The diffusers library provides the image pipelines; Whisper (via faster-whisper or transformers) handles audio.

Agent Protocol

Trigger

"stable diffusion", "SDXL", "FLUX", "diffusers", "text-to-image", "img2img", "inpainting", "LoRA for SD", "Whisper", "transcribe audio".

Input Context

  • Use case (commercial or not), target quality, latency per image.
  • GPU (VRAM size) or CPU-only constraints.
  • Need for conditioning (img2img, inpainting, ControlNet, LoRA styles).
  • Audio language(s) and real-time vs batch transcription.

Output Artifact

Model choice with license note, pipeline code, memory/performance settings, serving outline.

Response Format

Model: {repo id}  License: {license}  VRAM: {approx}
Pipeline: {class}  dtype: {fp16|bf16}  Steps/guidance: {n}/{g}
Memory: {cpu offload|vae tiling|none}
Repro: seed={n} recorded with prompt + model revision
Audio: {whisper variant, compute_type}

Completion Criteria

  • License verified for intended use.
  • Device selected dynamically; half precision used on GPU.
  • Seed, model revision, and parameters logged per output.
  • Safety/NSFW policy defined for user-facing generation.

Model Selection (verify licenses on the model card before use)

Model familyNotesLicense (check card)
Stable Diffusion 1.5Small, huge LoRA ecosystem; original runwayml repo was removed, mirrors existCreativeML OpenRAIL-M
SDXL base 1.01024px, good quality/VRAM balanceCreativeML OpenRAIL++-M
SD 3.5 (Medium/Large)MMDiT architecture, better text renderingStability AI Community License (revenue threshold)
FLUX.1 [schnell]Few-step, high qualityApache-2.0
FLUX.1 [dev]Higher quality, guidance-distilledNon-commercial license

Text-to-Image (diffusers)

python
from __future__ import annotations

import json
import logging
from pathlib import Path

import torch
from diffusers import AutoPipelineForText2Image

log = logging.getLogger("genai")
MODEL_ID = "stabilityai/stable-diffusion-xl-base-1.0"


def pick_device() -> tuple[str, torch.dtype]:
    if torch.cuda.is_available():
        return "cuda", torch.float16
    if torch.backends.mps.is_available():
        return "mps", torch.float16
    return "cpu", torch.float32  # CPU kernels need fp32; expect minutes per image


def load_pipeline(low_vram: bool = False):
    device, dtype = pick_device()
    pipe = AutoPipelineForText2Image.from_pretrained(
        MODEL_ID, torch_dtype=dtype, variant="fp16" if dtype == torch.float16 else None,
        use_safetensors=True,
    )
    if low_vram and device == "cuda":
        pipe.enable_model_cpu_offload()   # needs `accelerate`; do not also call .to("cuda")
    else:
        pipe.to(device)
    return pipe, device


def generate(pipe, device: str, prompt: str, out: Path, seed: int = 0,
             steps: int = 30, guidance: float = 7.0, negative: str = "") -> Path:
    generator = torch.Generator(device="cpu" if device == "mps" else device).manual_seed(seed)
    image = pipe(prompt=prompt, negative_prompt=negative or None, num_inference_steps=steps,
                 guidance_scale=guidance, generator=generator).images[0]
    image.save(out)
    out.with_suffix(".json").write_text(json.dumps(
        {"model": MODEL_ID, "prompt": prompt, "negative": negative, "seed": seed,
         "steps": steps, "guidance": guidance}))
    log.info("generated %s seed=%d", out, seed)
    return out

Notes:

  • PyTorch 2.x uses scaled-dot-product attention by default; installing xformers is no longer required.
  • FLUX.1 [schnell] uses FluxPipeline, ~4 steps, guidance_scale=0.0.
  • Pin revision= on from_pretrained for reproducible production builds.

Conditioning Options

NeedTool
Edit an existing imageAutoPipelineForImage2Image (strength 0.3-0.8)
Replace a regionAutoPipelineForInpainting with a mask
Pose/edge/depth controlControlNet pipelines (StableDiffusionXLControlNetPipeline)
Style or subjectLoRA: pipe.load_lora_weights(path); scale via cross_attention_kwargs={"scale": 0.8} or adapter weights
Fast draftsDistilled/turbo models or LCM-LoRA with 4-8 steps

Memory & Speed

ProblemSetting
OOM on loadenable_model_cpu_offload(); smaller model; fp16 variant
OOM at high resolutionpipe.vae.enable_tiling() / enable_slicing()
ThroughputBatch prompts (num_images_per_prompt), torch.compile(pipe.unet) after warmup
LatencyFewer steps with a distilled model rather than cutting steps on a base model

Speech Transcription (Whisper)

python
from faster_whisper import WhisperModel   # CTranslate2 backend

def transcribe(path: str, device: str = "cuda") -> list[dict]:
    compute_type = "float16" if device == "cuda" else "int8"
    model = WhisperModel("large-v3", device=device, compute_type=compute_type)
    segments, info = model.transcribe(path, beam_size=5, vad_filter=True)
    return [{"start": s.start, "end": s.end, "text": s.text} for s in segments]

segments is a generator; transcription runs as you iterate. For lower latency use the turbo/distilled variants; for the Hugging Face stack use pipeline("automatic-speech-recognition", model="openai/whisper-large-v3-turbo").

Speech-to-Image Flow

Serving

  • Run the pipeline in a dedicated GPU worker; accept jobs via a queue (one model instance per GPU, batch where possible).
  • Return a job id immediately; generation takes seconds.
  • Cache loaded pipelines; loading SDXL takes far longer than one inference.
  • Apply prompt and output moderation for public endpoints; add provenance (C2PA metadata or visible/invisible watermark) where policy requires.

Anti-Patterns

  • Hardcoding .to("cuda") with no fallback.
  • Loading fp32 weights on GPU (double VRAM for no visible gain).
  • Calling .to("cuda") after enable_model_cpu_offload().
  • Using a non-commercial model in a commercial product.
  • Not storing seed/params: outputs cannot be reproduced or audited.

Checklist

  • Model license checked and recorded.
  • Dynamic device + fp16/bf16 on GPU; pinned revision.
  • Memory settings match VRAM.
  • Seed + params persisted with each image.
  • Queue-based GPU worker with timeouts.
  • Moderation and provenance for user-facing output.

References

  • Hugging Face diffusers documentation (AutoPipeline, memory optimization, LoRA loading).
  • Radford et al., "Robust Speech Recognition via Large-Scale Weak Supervision" (Whisper, 2022); SYSTRAN/faster-whisper.

常见问题

Genai Vision AI 技能有什么作用?

Use this skill when the user says 'generate images', 'Stable Diffusion', 'SDXL', 'FLUX', 'diffusers pipeline', 'image-to-image', 'inpainting', 'Whisper transcription', 'speech to image pipeline'. Implements local or self-hosted image generation with Hugging Face diffusers and speech transcription with Whisper, including memory optimization, reproducibility, licensing, and safety checks. Do NOT use for: vision-language understanding / VLM pipelines (rnd/ai-agents/multimodal-pipelines), training diffusion models from scratch (fundamental-truths/statistical-mechanics for theory), or classic CV...

为什么在 TypingMind 中使用 Genai Vision?

因为您只需安装一次,就能搭配任何模型使用。Genai Vision 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Genai Vision?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/j4flmao/agent-skills/tree/main/skills/ai/genai-vision。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Genai Vision?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Genai Vision 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Genai Vision 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Genai Vision AI 技能免费吗?

是的。j4flmao 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇