Commit Graph

457 Commits (a6f6a37dea8a2ac9d0e936e7f830b7564ae25ca4)

Author SHA1 Message Date
awsr d474f28cb3
RUF013 update 2026-03-23 22:53:34 -07:00
vladmandic 760b0121bc update register_api
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-20 08:07:05 +01:00
vladmandic d679fbb8fb move rembg to internal
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-20 08:04:21 +01:00
vladmandic 87659823fc gpu info for xpu and log exclude list
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-19 15:01:49 +01:00
vladmandic 5a5e3cc381 use rate-limit for api logging
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-19 08:52:10 +01:00
vladmandic fb2f9ea650 new server info panel
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-18 15:37:57 +01:00
vladmandic d588ced2ef fix rate limiter
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-17 11:52:53 +01:00
vladmandic 742eeb8691 new server settings section
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-17 10:07:48 +01:00
vladmandic de7959397c fb merge phase 3
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-16 10:32:12 +01:00
vladmandic 12fd4d30f1 fb merge phase 2
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-16 08:09:07 +01:00
vladmandic 7a409a9e83 patch installer
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-16 06:30:24 +01:00
vladmandic 729eca460e initialize grading params
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-14 12:52:37 +01:00
vladmandic c86674047a fix state end
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-14 12:46:43 +01:00
vladmandic e0faa149dd cleanup
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-13 14:44:58 +01:00
vladmandic f9abe07035 cleanup logging and update requirements
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-13 13:02:41 +01:00
vladmandic af1531af5a revert gallery appy
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-13 12:06:33 +01:00
vladmandic f89afe0add revert gallery api
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-13 12:06:26 +01:00
vladmandic 56d0307f13 merge: modules/api/models.py 2026-03-13 08:10:14 +01:00
vladmandic a23abb356e merge: modules/api/xyz_grid.py 2026-03-12 14:16:50 +01:00
vladmandic cbc1b7c994 merge: modules/api/script.py 2026-03-12 14:16:50 +01:00
vladmandic 07954ee849 merge: modules/api/process.py 2026-03-12 14:16:50 +01:00
vladmandic a93358b3ac merge: modules/api/nudenet.py 2026-03-12 14:16:50 +01:00
vladmandic ee1b76b1c9 merge: modules/api/loras.py 2026-03-12 14:16:50 +01:00
vladmandic ac5ae390d8 merge: modules/api/helpers.py 2026-03-12 14:16:50 +01:00
vladmandic 62dcf352eb merge: modules/api/gpu.py 2026-03-12 14:16:50 +01:00
vladmandic b388f7c582 merge: modules/api/generate.py 2026-03-12 14:16:50 +01:00
vladmandic a2624bebdc merge: modules/api/endpoints.py 2026-03-12 14:16:50 +01:00
vladmandic 86fba0b544 merge: modules/api/control.py 2026-03-12 14:16:50 +01:00
vladmandic eb94fa3f38 merge: modules/api/caption.py 2026-03-12 14:16:50 +01:00
vladmandic b2f95b91bf cleanup upload
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-12 09:20:19 +01:00
vladmandic 20e8b8ab18 add upload api endpoint
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-09 16:02:05 +01:00
vladmandic afff46f2ac add google-flash-3.1-image
Signed-off-by: vladmandic <mandic00@live.com>
2026-02-27 10:53:22 +01:00
Vladimir Mandic bd39638df1 fix pydantic 2026-02-20 08:29:52 +01:00
Vladimir Mandic f78f0eb4a5 refactor imports 2026-02-19 15:28:24 +01:00
Vladimir Mandic 4006b3e093 pylint 2026-02-19 11:36:20 +01:00
Vladimir Mandic e5c494f999 cleanup logger 2026-02-19 11:09:13 +01:00
Vladimir Mandic a3074baf8b unified logger 2026-02-19 09:46:42 +01:00
Vladimir Mandic bfe014f5da modernize typing 2026-02-19 09:15:37 +01:00
Vladimir Mandic 6fdd3a53cf reduce mandatory requirements
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-02-18 17:53:08 +01:00
Vladimir Mandic 41f206dec9
Merge pull request #4637 from CalamitousFelicitousness/refactor/remove-face-restoration
Refactor/remove face restoration
2026-02-11 11:12:34 +01:00
CalamitousFelicitousness 80014fac7c fix(caption): address PR review feedback
- Remove superfluous SimpleNamespace import in cli/api-caption.py, use Map instead
- Drop _ prefix from internal helper functions in modules/api/caption.py
- Move DeepDanbooru model path to top-level models folder instead of nesting under CLIP
2026-02-11 02:50:06 +00:00
CalamitousFelicitousness 6c20e49897 refactor(caption): extract caption API into standalone module
Move all caption/interrogate/tagger/VQA API code out of the monolithic
endpoints.py and models.py into a new self-contained modules/api/caption.py,
following the loras.py / nudenet.py self-registering pattern.

- Move 15 Pydantic models (ReqCaption, ResCaption, ReqVQA, ResVQA,
  ReqTagger, ResTagger, dispatch union types, etc.) from models.py
- Move 11 handler functions from endpoints.py
- Deduplicate ~150 lines via shared _do_openclip, _do_tagger, _do_vqa
  core functions called by both direct and dispatch endpoints
- Add register_api() that registers all 8 caption routes
- Add promptgen field to ResVLMPrompts (bug fix: handler returned it
  but response model silently dropped it)
- Improve all endpoint docstrings and Field descriptions for API docs
2026-02-11 02:50:06 +00:00
CalamitousFelicitousness 443a73b740 refactor(caption): code review fixes for offload, inference, and maintainability
Comprehensive review of modules/caption/ addressing memory management,
consistency, and code quality:

Inference correctness:
- Add devices.inference_context() to _qwen(), _smol(), _sa2() handlers
- Remove redundant @torch.no_grad() decorator from joycaption predict()
- Remove dead dtype=torch.bfloat16 kwarg from Florence loader

Memory management:
- Bound moondream3 image cache with LRU eviction (max 8 entries)
- Replace fragile id(image) cache keys with content-based md5 hash
- Add devices.torch_gc() after model loading in deepseek
- Move deepbooru model to CPU before dropping reference on unload
- Add external handler delegation to VQA.unload() (moondream3,
  joycaption, joytag, deepseek)
- Protect batch offload mutation with try/finally

Code deduplication:
- Extract strip_think_xml_tags() shared helper for Qwen/Gemma/SmolVLM
- Extract save_tags_to_file() into tagger.py from deepbooru and
  waifudiffusion

Documentation and clarity:
- Document deepseek global monkey-patches (LlamaFlashAttention2, attrdict)
- Document Florence task="task" as intentional design choice
- Add vendored-code comment to joytag.py
- Document openclip direct .to() usage vs sd_models.move_model
- Comment model.eval() calls that are required (trust_remote_code,
  custom loaders) vs removed where redundant (standard from_pretrained)

API robustness:
- Add HTTP 422 error response for VQA caption error strings in API
  endpoints (post_vqa, _dispatch_vlm)
2026-02-11 02:48:11 +00:00
CalamitousFelicitousness bf7a72f12e fix(caption): remove dead min_length param, split Florence/PromptGen prompts, fix gaze detection
- Remove caption_openclip_min_length from settings, API models, endpoints, and UI
  (clip_interrogator library has no min_length support; parameter was never functional)
- Split vlm_prompts_florence into base Florence prompts and PromptGen-only prompts
  (GENERATE_TAGS, Analyze, Mixed Caption require MiaoshouAI PromptGen fine-tune)
- Add 'promptgen' category to /vqa/prompts API endpoint
- Fix gaze detection: move DETECT_GAZE check before generic 'detect ' prefix
  to prevent "Detect Gaze" matching as detect target="Gaze"
- Update test suite: remove min_length tests, fix min_flavors to use mode='best',
  add acceptance-only notes, fix thinking trace detection, improve bracket/OCR tests,
  split Florence/PromptGen test coverage
2026-02-11 02:48:11 +00:00
CalamitousFelicitousness f4b5abde68 refactor: update API for caption module
Update API endpoints and models for caption module rename:
- modules/api/api.py - update imports and endpoint handlers
- modules/api/endpoints.py - update endpoint definitions
- modules/api/models.py - update request/response models
2026-02-11 02:48:11 +00:00
CalamitousFelicitousness 83fa8e39ba refactor(api): update cli tools for DeepBooru tagger migration
- Update cli/api-interrogate.py to use /sdapi/v1/tagger for DeepBooru
- Handle tagger response format (scores dict or tags string)
- Remove DeepBooru test from interrogate endpoint tests
- Update API model descriptions to reference tagger for anime tagging
2026-02-11 02:47:41 +00:00
CalamitousFelicitousness 7825f44581 refactor(api): remove DeepBooru from interrogate endpoint
DeepBooru/DeepDanbooru should only be accessed via the tagger endpoint.
The interrogate endpoint is now exclusively for OpenCLIP/BLIP.

- Remove DeepDanbooru handling from post_interrogate
- Update docstring to reference tagger endpoint for anime tagging
- Simplify code by removing if/else branching
2026-02-11 02:47:40 +00:00
CalamitousFelicitousness a04ba1e482 feat(api): add missing caption API parameters for UI parity
Add prompt field to VQA endpoint and advanced settings to OpenCLIP endpoint
to achieve full parity between UI and API capabilities.

VLM endpoint changes:
- Add prompt field for custom text input (required for 'Use Prompt' task)
- Pass prompt to vqa.interrogate instead of hardcoded empty string

OpenCLIP endpoint changes:
- Add 7 optional per-request override fields: min_length, max_length,
  chunk_size, min_flavors, max_flavors, flavor_count, num_beams
- Add get_clip_setting() helper for override support in openclip.py
- Apply overrides via update_interrogate_params() before interrogation

All new fields are optional with None defaults for backwards compatibility.
2026-02-11 02:47:40 +00:00
CalamitousFelicitousness 5fc46c042e docs(api): synchronize API descriptions with UI hints
Update API model field descriptions to match the hints in locale_en.json
for consistency between UI and API documentation.

Updated models:
- ReqInterrogate: clip_model, blip_model, mode
- ReqVQA: model, question, system
- ReqTagger: model, threshold, character_threshold, max_tags,
  include_rating, sort_alpha, use_spaces, escape_brackets,
  exclude_tags, show_scores
2026-02-11 02:47:40 +00:00
CalamitousFelicitousness f431141d2f feat(api): add LLM generation parameters to VQA endpoint
Add optional LLM generation parameters to the VQA API request model,
allowing per-request override of settings:

- max_tokens, temperature, top_k, top_p, num_beams, do_sample
- thinking_mode, prefill, keep_thinking, keep_prefill

Changes:
- Add 10 new optional fields to ReqVQA model with descriptive docs
- Update get_kwargs() to support per-request overrides via singleton
- Add helper functions get_keep_thinking(), get_keep_prefill()
- Update post_vqa endpoint to pass generation kwargs
- Add _generation_overrides instance variable to VQA class
2026-02-11 02:47:40 +00:00