unsloth/studio/backend/core/inference
Daniel Han fca32d5a5b Add Krea 2 Turbo: diffusion family, inference loader, LoRA training (diffusers 0.39)
Inference:
- krea-2 DiffusionFamily (Krea2Pipeline / Krea2Transformer2DModel, base
  krea/Krea-2-Turbo, bf16 only, no GGUF/sd.cpp mapping yet)
- Per-component pipeline loader (core/inference/diffusion_krea2.py): the krea
  repo is exported with transformers 5.2, so the tokenizer config
  (extra_special_tokens as a list, no slow-tokenizer vocab files) and the
  text encoder rope settings (rope_parameters vs rope_scaling) need explicit
  compat on the 4.x line; values are copied verbatim and equal the 4.x
  Qwen3-VL defaults, so the math is unchanged. from_pretrained also
  type-checks the tokenizer against the declared slow class, so the pipeline
  is assembled through its constructor with the model_index init config
  (is_distilled carries Turbo's fixed mu=1.15 schedule)
- Trust allowlist entry, curated picker entry + 8 step / cfg 0 defaults,
  int8 exclusion token for the M=1 Krea2TimestepEmbedding projection

Training:
- krea-2 _FamilySpec in the DiT trainer: phased conditioning/transformer
  load through the compat loader, shared Qwen-Image VAE latent path,
  fixed-512 text embeds (static shapes, plain concat collate), inline 2x2
  latent packing + shared position grid, the authors' recommended LoRA
  target set and rank/alpha 32, lr 3e-4, 512px presets
- GPU smokes on B200: nf4 2.9 steps/s at 11.5 GB, bf16 3.4 steps/s at
  30.1 GB, bf16 + regional compile 5.2 steps/s; adapter round-trip
  generation verified
2026-07-03 13:25:54 +00:00
..
__init__.py Studio: make code comments and docstrings more succinct (#6029) 2026-06-08 23:07:28 -07:00
_html_to_md.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
anthropic_compat.py Studio: improve OpenAI- and Anthropic-compatible API spec compliance (#6010) 2026-06-09 17:13:25 +02:00
api_monitor.py Studio: trim serving-log noise and surface llama-server engine stats (#6377) 2026-06-17 05:37:57 -07:00
audio_codecs.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
chat_template_helpers.py Studio: make code comments and docstrings more succinct (#6029) 2026-06-08 23:07:28 -07:00
chat_templates.py Studio: bundle Gemma 4 chat templates (E2B/E4B + larger) and auto-apply to unsloth/gemma-4-*-GGUF (#6245) 2026-06-12 05:49:39 -07:00
defaults.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
diffusion.py Add Krea 2 Turbo: diffusion family, inference loader, LoRA training (diffusers 0.39) 2026-07-03 13:25:54 +00:00
diffusion_arch_patches.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-01 01:25:36 +00:00
diffusion_attention.py Studio diffusion (Phase 10): attention-backend selection (#6701) 2026-07-01 15:38:53 -03:00
diffusion_cache.py Studio diffusion (Phase 12): First-Block-Cache step caching for many-step DiT (#6703) 2026-07-01 15:40:52 -03:00
diffusion_compile_cache.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-01 01:25:36 +00:00
diffusion_controlnet.py Harden ControlNet resolve, gallery metadata, and the control-type picker 2026-07-02 05:54:22 +00:00
diffusion_device.py Studio diffusion (Phase 16): route no-GPU loads to the native sd.cpp engine (#6724) 2026-07-01 15:43:56 -03:00
diffusion_eager_patches.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-01 01:25:36 +00:00
diffusion_engine_router.py Merge remote-tracking branch 'origin/image-generation' into diffusion-image-workflows 2026-07-02 03:36:50 +00:00
diffusion_families.py Add Krea 2 Turbo: diffusion family, inference loader, LoRA training (diffusers 0.39) 2026-07-03 13:25:54 +00:00
diffusion_gguf_compile.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-01 01:25:36 +00:00
diffusion_krea2.py Add Krea 2 Turbo: diffusion family, inference loader, LoRA training (diffusers 0.39) 2026-07-03 13:25:54 +00:00
diffusion_lora.py Refactor diffusion LoRA training into a family-aware platform 2026-07-02 14:55:09 +00:00
diffusion_memory.py Merge remote-tracking branch 'origin/image-generation' into diffusion-image-workflows 2026-07-02 03:55:35 +00:00
diffusion_patch_backend.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-01 01:25:36 +00:00
diffusion_precision.py Studio diffusion (Phase 4): native stable-diffusion.cpp engine for CPU/Mac (#6679) 2026-07-01 15:03:53 -03:00
diffusion_prequant.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-07-02 03:30:16 +00:00
diffusion_speed.py Merge remote-tracking branch 'origin/image-generation' into diffusion-image-workflows 2026-07-01 23:39:29 +00:00
diffusion_transformer_quant.py Add Krea 2 Turbo: diffusion family, inference loader, LoRA training (diffusers 0.39) 2026-07-03 13:25:54 +00:00
external_provider.py Studio: harden background consumer loops and streaming paths against silent UI freezes (#6653) 2026-06-26 03:31:33 -07:00
gpu_arbiter.py Studio diffusion (Phase 16): route no-GPU loads to the native sd.cpp engine (#6724) 2026-07-01 15:43:56 -03:00
image_gallery.py Studio diffusion (Phase 1): cross-platform device policy, fp16 guard, lock split, validate-before-evict (#6670) 2026-06-30 16:33:47 -03:00
inference.py fix(studio): handle multimodal list content in inference text paths (#4383) (#6480) 2026-06-23 01:26:11 -07:00
key_exchange.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
llama_cpp.py Reduce comments across recent fixes (#6776) 2026-06-30 23:13:36 -07:00
llama_http.py fix(studio/llama_cpp): disable trust_env on the loopback health probe (#6750) (#6752) 2026-06-30 19:09:26 +02:00
llama_keepwarm.py Studio: opt-in OpenAI /v1 model auto-switch and idle keep-warm (#6392) 2026-07-01 06:42:23 -07:00
llama_server_args.py studio: return a clean model id from the OpenAI API instead of the local .gguf path (#6518) 2026-06-26 16:07:53 -03:00
llama_stats.py Studio: trim serving-log noise and surface llama-server engine stats (#6377) 2026-06-17 05:37:57 -07:00
local_model_resolver.py Studio: opt-in OpenAI /v1 model auto-switch and idle keep-warm (#6392) 2026-07-01 06:42:23 -07:00
mcp_client.py Studio: enable stdio MCP servers on a loopback bind (#6295) 2026-06-15 03:02:32 +01:00
mcp_config_import.py studio: show MCP "Import config" on the add-server form (#6030) 2026-06-11 16:17:22 +01:00
message_content.py fix(studio): handle multimodal list content in inference text paths (#4383) (#6480) 2026-06-23 01:26:11 -07:00
mlx_inference.py Expose runtime context length for hub models (#6154) 2026-06-11 22:13:53 +03:00
model_ids.py studio: list the full local model catalog from /v1/models (#6519) 2026-06-26 20:42:06 -03:00
orchestrator.py Studio: harden background consumer loops and streaming paths against silent UI freezes (#6653) 2026-06-26 03:31:33 -07:00
pricing.py Reduce and tighten code comments and docstrings repo-wide (#6095) 2026-06-08 23:09:51 -07:00
providers.py Studio: Add custom provider option to Connections (#6112) 2026-06-12 13:09:35 +02:00
runtime_context.py Expose runtime context length for hub models (#6154) 2026-06-11 22:13:53 +03:00
safetensors_agentic.py Studio: show tool-call progress for large GGUF tool arguments (#6484) 2026-06-22 05:50:10 -07:00
sd_cpp_args.py Merge remote-tracking branch 'origin/image-generation' into diffusion-image-workflows 2026-07-02 02:25:16 +00:00
sd_cpp_backend.py Merge remote-tracking branch 'origin/diffusion-lora' into diffusion-controlnet 2026-07-02 06:40:54 +00:00
sd_cpp_engine.py Merge remote-tracking branch 'origin/image-generation' into diffusion-image-workflows 2026-07-02 06:36:45 +00:00
tensor_fallback.py studio: deterministic VRAM auto-fit for GGUF (MTP reserve, compute buffer, total-based budget) (#6312) 2026-06-17 03:10:22 -07:00
tool_call_parser.py Fix Gemma 4 GGUF OpenAI API streams (#6476) 2026-06-23 06:13:56 -07:00
tool_loop_controller.py Studio: clean-room compact RAG (knowledge bases, hybrid search, fast indexing) (#5910) 2026-06-09 21:17:04 -07:00
tools.py Whole-document context for RAG chat attachments (#6693) 2026-06-30 15:55:23 +02:00
worker.py Generalize transformers tier selection by probing AutoConfig (#6550) 2026-06-22 08:20:06 -07:00