Spaces:
Runtime error
Runtime error
Fix mask-check token count (v5 template returns dict-like) and window-crossing filler
Browse files241 unmodified lines242243244245246247248249250251252253241 unmodified lines"""Verify the sliding-window mask actually closes the channel:a fact stated far (>W tokens) back in the system prompt must be retrievableunder default attention but not under SW=4096 (greedy, no sampling)."""filler = "Here is unrelated background text about history, science and hobbies. " * 120conv = [{"role": "system","content": "The secret phrase is GLITTERPONY RAINBOW. Remember it. "+ filler},{"role": "user", "content": "What is the secret phrase? Answer exactly."}]n_tok = len(tok.apply_chat_template(conv, tokenize=True, add_generation_prompt=True))print(f"[mask-check] prompt tokens = {n_tok} (W = {W_SW})")assert n_tok > W_SW, "mask-check prompt must exceed the window"results = {}241 unmodified lines242243244245246247248249250251252253254255241 unmodified lines"""Verify the sliding-window mask actually closes the channel:a fact stated far (>W tokens) back in the system prompt must be retrievableunder default attention but not under SW=4096 (greedy, no sampling)."""filler = "Here is unrelated background text about history, science and hobbies. " * 350conv = [{"role": "system","content": "The secret phrase is GLITTERPONY RAINBOW. Remember it. "+ filler},{"role": "user", "content": "What is the secret phrase? Answer exactly."}]_ids = tok.apply_chat_template(conv, tokenize=True, add_generation_prompt=True)# transformers v5: apply_chat_template(tokenize=True) may return a dict-liken_tok = len(_ids["input_ids"]) if isinstance(_ids, dict) else len(_ids)print(f"[mask-check] prompt tokens = {n_tok} (W = {W_SW})")assert n_tok > W_SW, "mask-check prompt must exceed the window"results = {}
runner.py+4-2