Commit Graph
7 Commits
Author SHA1 Message Date
slahiriandClaude Opus 4.5 9f6f30805b feat: Z-Image prompt pipeline redesign (WIP)
Changes:
- Add Z-Image prompt style with 6-part formula support
- Add vocabulary enhancement system (984 terms)
- Add classification improvements (age, clothing, subject count)
- Add Full and Z-Image prompt styles preserving Florence prose
- Add pipeline design document (docs/COMPOSE_PIPELINE_DESIGN.md)
- Remove RAG system (not working well)
- Remove use_rag input from compose node

Key insight: Pipeline should PRESERVE information, not destroy it.
- Florence descriptions kept intact (not tokenized)
- Tags organized into Z-Image categories
- NLP mode = structured output
- LLM mode = natural prose generation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 23:30:13 +05:30
slahiriandClaude Opus 4.5 5ef42c8c8e fix: enforce exact max_tokens_per_category limit
- Track total tokens in _collect_subject_details to prevent overflow
- Add final safety truncation in _get_tokens_for_category
- Ensures setting 80 returns exactly 80, not 81

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 20:56:14 +05:30
slahiriandClaude Opus 4.5 4d107597ea fix: max_tokens_per_category now properly overrides category limits
- When set > 50: uses user's limit for all categories (more detail)
- When set < 50: caps all categories to user's limit (less detail)
- When default (50): uses category-specific limits

Also fixes subject_details subcategory limits to distribute evenly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 20:48:21 +05:30
slahiriandClaude Opus 4.5 bb6a31bab6 fix: improve prompt accuracy with conflict resolution and token balancing
- Add mutually exclusive groups for contradictory tags (hair texture,
  eye color, body type, skin tone, positions, facing direction)
- Filter generic Western clothing when ethnic wear (saree, kimono, etc.) detected
- Add category-specific token limits to prevent overwhelming:
  - subject_details: 25 (was using default 50)
  - environment: 15, lighting: 12 (important for scene recreation)
- Prioritize short tags (<30 chars) over long sentences in subject_details
  (80% short tags, 20% long sentences for better image generation)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 19:42:56 +05:30
slahiriandClaude Opus 4.5 d11328ff90 feat: add STRUCTURED prompt style with category-segregated output
- Add STRUCTURED style that outputs each category on separate lines
- Fix '3d' token stripping - only strip booru patterns (1girl, 2boys)
- Increase max_tokens_per_category to 50 (was 5)
- Increase validator limits to preserve more information
- Preserve newlines throughout validation pipeline
- Disable truncation and duplicate removal by default

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 19:05:47 +05:30
slahiriandClaude Opus 4.5 fb05f55c9e feat(compose): implement Phase 4 - Prompt Assembly
Adds the assembler module that converts classified tokens into natural
language prompts:
- base.py: AssemblerConfig, AssembledPrompt, CategorySection classes
- rules.py: Phrase templates, gender detection, grammar helpers
- standard.py: StandardAssembler with NATURAL/TAGS/HYBRID styles

The assembler takes ClassifiedImage from Phase 3 and produces prompts
following the canonical category order.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 11:26:40 +05:30
slahiriandClaude Opus 4.5 c7859cf9f4 feat(compose): implement Phase 1 - Core Infrastructure
New data structures for tokenization pipeline:

tokenizer/base.py:
- ImageToken: unified token format (text, confidence, source, type)
- TokenType enum: TAG, PHRASE, KEY_VALUE, SENTENCE
- TokenSource enum: WD14, JOYTAG, PIXAI, FLORENCE_*, etc.
- TokenBatch: collection with filtering methods
- SOURCE_WEIGHTS: reliability weighting per source

classifier/categories.py:
- CanonicalCategory enum: 9 categories + UNCATEGORIZED, FILTERED_META
- SubjectDetailType enum: hair, eyes, face, body, clothing, skin, accessories
- CategoryKeywords: exact/prefix/suffix/contains pattern matching
- Keyword dictionaries for all categories
- META_FILTER_PATTERNS: patterns to filter out
- FLORENCE_KEY_TO_CATEGORY: key routing for florence_analyze

classifier/base.py:
- TokenClassification: classification result with primary/secondary categories
- ClassifiedImage: organized tokens by category for assembly

Tests:
- test_phase1_infrastructure.py: 21 unit tests (all passing)
- test_real_image.py: real metadata token extraction demo
- sample_metadata*.json: real image metadata samples

All 21 tests pass. Ready for Phase 2: Tokenization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 09:51:09 +05:30