Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

debug: decode first sample after train_on_completions masking

Roland Tannous7f1fd28acd77
diff --git a/studio/backend/core/training/trainer.py b/studio/backend/core/training/trainer.py
index 94f2d4d5a07..1c18bd5b595 100644
--- a/studio/backend/core/training/trainer.py
+++ b/studio/backend/core/training/trainer.py
@@ -2690,6 +2690,16 @@ class UnslothTrainer:
)
print(f"Post-filter dataset size: {filtered_len} samples\n")
+ # [DEBUG] Decode first sample AFTER train_on_completions applied
+ try:
+ _row = self.trainer.train_dataset[0]
+ _space = self.tokenizer(" ", add_special_tokens=False).input_ids[0]
+ print("[DEBUG] === After train_on_completions ===", flush=True)
+ print(f"[DEBUG] input_ids decoded:\n{self.tokenizer.decode(_row['input_ids'])}\n", flush=True)
+ print(f"[DEBUG] labels decoded (-100 → space):\n{self.tokenizer.decode([_space if x == -100 else x for x in _row['labels']])}\n", flush=True)
+ except Exception as _dbg_e:
+ print(f"[DEBUG] Could not decode post-completions sample: {_dbg_e}", flush=True)
+
except Exception as e:
logger.warning(f"Failed to apply train on responses only: {e}")
train_on_responses_enabled = False