nsfwalex Claude Opus 4.8 commited on
Commit
7d87ebe
·
1 Parent(s): 288cccb

Revert assistant to gemma-4-E4B (bf16) — 12B 8-bit was too slow

Browse files

- VLM_MODEL_ID default -> prithivMLmods/gemma-4-E4B-it-Uncensored-MAX
(model_type gemma4), small/fast, loads bf16 (~8GB).
- VLM_LOAD_8BIT default -> 0 (bf16); set =1 only for the big 12B.
- requirements unchanged (transformers git main already supports gemma4),
so this is an app reload, not a full rebuild.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -150,20 +150,18 @@ print("Pipelines loaded!")
150
  # describing a reference image. Loaded once, bf16 — fits alongside the two
151
  # diffusion pipelines on the shared GPU.
152
  # -----------------------------------------------------------------------------
153
- # Prior models, kept for easy revert (set VLM_MODEL_ID back to one of these):
154
- # "rodrigomt/Qwen3.5-4B-Uncensored-Aggressive" # no generation_config; needed eos pinning
155
- # "prithivMLmods/gemma-4-E4B-it-Uncensored-MAX" # model_type gemma4; under-rated explicit content (~2)
156
- # "ccharnkij/Qwen3.5-9B-Uncensored" # 9B Qwen3.5 VL, ~18.8 GB bf16 (the previous default)
157
- # Current: gemma-4-12B "unified" (text+image+audio+video), abliterated/uncensored.
158
- # model_type=gemma4_unified / Gemma4UnifiedForConditionalGeneration NEWER than the
159
- # earlier gemma4, so it needs a very recent transformers (requirements pins git main).
160
- # It's ~24 GB in bf16, which does NOT fit on the zero-a10g (~24 GB) next to the two
161
- # diffusion pipelines, so we load it 8-bit (bitsandbytes, ~12 GB) by DEFAULT.
162
- # Flip VLM_LOAD_8BIT=0 to load full bf16 (only safe on a bigger GPU). Stop tokens are
163
- # handled model-agnostically by _resolve_vlm_eos_ids() (this model ships a proper
164
- # generation_config + chat_template.jinja).
165
- VLM_MODEL_ID = os.environ.get("VLM_MODEL_ID", "OpenYourMind/gemma-4-12B-it-abliterated-uncensored")
166
- VLM_LOAD_8BIT = os.environ.get("VLM_LOAD_8BIT", "1").lower() not in ("0", "false", "no", "")
167
 
168
  print(f"Loading assistant: {VLM_MODEL_ID} (8bit={VLM_LOAD_8BIT}) ...")
169
  vlm_processor = AutoProcessor.from_pretrained(
 
150
  # describing a reference image. Loaded once, bf16 — fits alongside the two
151
  # diffusion pipelines on the shared GPU.
152
  # -----------------------------------------------------------------------------
153
+ # Other models, kept for easy revert (set VLM_MODEL_ID, and VLM_LOAD_8BIT for big ones):
154
+ # "rodrigomt/Qwen3.5-4B-Uncensored-Aggressive" # no generation_config; needed eos pinning
155
+ # "ccharnkij/Qwen3.5-9B-Uncensored" # 9B Qwen3.5 VL, ~18.8 GB bf16
156
+ # "OpenYourMind/gemma-4-12B-it-abliterated-uncensored" # gemma4_unified, ~24GB; needs VLM_LOAD_8BIT=1 (slow)
157
+ # Current: gemma-4-E4B (model_type=gemma4 / Gemma4ForConditionalGeneration), multimodal,
158
+ # uncensored. Small/fastloads full bf16 (~8 GB, fits the zero-a10g alongside the
159
+ # diffusion pipelines). The 12B above was accurate but too slow at 8-bit; this is the
160
+ # speed pick. Stop tokens are handled model-agnostically by _resolve_vlm_eos_ids()
161
+ # (this model ships a proper generation_config). VLM_LOAD_8BIT=1 forces bitsandbytes
162
+ # 8-bit (only needed for the 12B); default is bf16.
163
+ VLM_MODEL_ID = os.environ.get("VLM_MODEL_ID", "prithivMLmods/gemma-4-E4B-it-Uncensored-MAX")
164
+ VLM_LOAD_8BIT = os.environ.get("VLM_LOAD_8BIT", "0").lower() not in ("0", "false", "no", "")
 
 
165
 
166
  print(f"Loading assistant: {VLM_MODEL_ID} (8bit={VLM_LOAD_8BIT}) ...")
167
  vlm_processor = AutoProcessor.from_pretrained(