Spaces:
Running on Zero
Running on Zero
Upload 80 files
Browse files- app.py +12 -11
- obliteratus/.DS_Store +0 -0
app.py
CHANGED
|
@@ -85,15 +85,16 @@ def obliterate(model_choice: str, method_choice: str, progress=gr.Progress()):
|
|
| 85 |
def on_log(msg):
|
| 86 |
log_lines.append(msg)
|
| 87 |
|
| 88 |
-
def on_stage(
|
|
|
|
| 89 |
icon = {"summon": "\u26a1", "probe": "\u2692\ufe0f", "distill": "\u269b\ufe0f",
|
| 90 |
-
"excise": "\u2702\ufe0f", "verify": "\u2705", "rebirth": "\u2b50"}.get(
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
|
| 98 |
try:
|
| 99 |
from obliteratus.abliterate import AbliterationPipeline
|
|
@@ -115,8 +116,8 @@ def obliterate(model_choice: str, method_choice: str, progress=gr.Progress()):
|
|
| 115 |
|
| 116 |
# Keep the model + tokenizer in memory for chat
|
| 117 |
with _lock:
|
| 118 |
-
_state["model"] = pipeline.model
|
| 119 |
-
_state["tokenizer"] = pipeline.tokenizer
|
| 120 |
_state["status"] = "ready"
|
| 121 |
|
| 122 |
log_lines.append("\n" + "=" * 50)
|
|
@@ -171,7 +172,7 @@ def chat_respond(message: str, history: list[dict], system_prompt: str,
|
|
| 171 |
streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
| 172 |
gen_kwargs = {
|
| 173 |
**inputs,
|
| 174 |
-
"max_new_tokens": max_tokens,
|
| 175 |
"do_sample": temperature > 0,
|
| 176 |
"temperature": max(temperature, 0.01),
|
| 177 |
"top_p": 0.9,
|
|
|
|
| 85 |
def on_log(msg):
|
| 86 |
log_lines.append(msg)
|
| 87 |
|
| 88 |
+
def on_stage(result):
|
| 89 |
+
stage_key = result.stage
|
| 90 |
icon = {"summon": "\u26a1", "probe": "\u2692\ufe0f", "distill": "\u269b\ufe0f",
|
| 91 |
+
"excise": "\u2702\ufe0f", "verify": "\u2705", "rebirth": "\u2b50"}.get(stage_key, "\u25b6")
|
| 92 |
+
if result.status == "running":
|
| 93 |
+
log_lines.append(f"\n{icon} {stage_key.upper()} — {result.message}")
|
| 94 |
+
stage_order = {"summon": 0, "probe": 1, "distill": 2,
|
| 95 |
+
"excise": 3, "verify": 4, "rebirth": 5}
|
| 96 |
+
idx = stage_order.get(stage_key, 0)
|
| 97 |
+
progress((idx + 1) / 6, desc=f"{stage_key.upper()}")
|
| 98 |
|
| 99 |
try:
|
| 100 |
from obliteratus.abliterate import AbliterationPipeline
|
|
|
|
| 116 |
|
| 117 |
# Keep the model + tokenizer in memory for chat
|
| 118 |
with _lock:
|
| 119 |
+
_state["model"] = pipeline.handle.model
|
| 120 |
+
_state["tokenizer"] = pipeline.handle.tokenizer
|
| 121 |
_state["status"] = "ready"
|
| 122 |
|
| 123 |
log_lines.append("\n" + "=" * 50)
|
|
|
|
| 172 |
streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
|
| 173 |
gen_kwargs = {
|
| 174 |
**inputs,
|
| 175 |
+
"max_new_tokens": int(max_tokens),
|
| 176 |
"do_sample": temperature > 0,
|
| 177 |
"temperature": max(temperature, 0.01),
|
| 178 |
"top_p": 0.9,
|
obliteratus/.DS_Store
CHANGED
|
Binary files a/obliteratus/.DS_Store and b/obliteratus/.DS_Store differ
|
|
|