-
Notifications
You must be signed in to change notification settings - Fork 548
Open
Description
Running Kaggle-Qwen3_(32B)_A100-Reasoning-Conversational.ipynb
While running this cell:
reasoning_conversations = tokenizer.apply_chat_template(
reasoning_dataset.map(generate_conversation, batched = True)["conversations"],
tokenize = False,
)It throws this error:
---------------------------------------------------------------------------
UndefinedError Traceback (most recent call last)
Cell In[8], [line 1](vscode-notebook-cell:?execution_count=8&line=1)
----> [1](vscode-notebook-cell:?execution_count=8&line=1) reasoning_conversations = tokenizer.apply_chat_template(
2 reasoning_dataset.map(generate_conversation, batched = True)["conversations"],
3 tokenize = False,
4 )
File ~/project/.venv/lib/python3.12/site-packages/transformers/tokenization_utils_base.py:1640, in PreTrainedTokenizerBase.apply_chat_template(self, conversation, tools, documents, chat_template, add_generation_prompt, continue_final_message, tokenize, padding, truncation, max_length, return_tensors, return_dict, return_assistant_tokens_mask, tokenizer_kwargs, **kwargs)
1637 raise ValueError("continue_final_message is not compatible with return_assistant_tokens_mask.")
1639 template_kwargs = {**self.special_tokens_map, **kwargs} # kwargs overwrite special tokens if both are present
-> [1640](https://vscode-remote+ssh-002.vscode-resource.vscode-cdn.net/home/user/project/unsloth-notebooks/~/project/.venv/lib/python3.12/site-packages/transformers/tokenization_utils_base.py:1640) rendered_chat, generation_indices = render_jinja_template(
1641 conversations=conversations,
1642 tools=tools,
1643 documents=documents,
1644 chat_template=chat_template,
1645 return_assistant_tokens_mask=return_assistant_tokens_mask,
1646 continue_final_message=continue_final_message,
1647 add_generation_prompt=add_generation_prompt,
1648 **template_kwargs,
1649 )
1651 if not is_batched:
1652 rendered_chat = rendered_chat[0]
File ~/project/.venv/lib/python3.12/site-packages/transformers/utils/chat_template_utils.py:521, in render_jinja_template(conversations, tools, documents, chat_template, return_assistant_tokens_mask, continue_final_message, add_generation_prompt, **kwargs)
519 all_generation_indices.append(generation_indices)
520 else:
--> [521](https://vscode-remote+ssh-002.vscode-resource.vscode-cdn.net/home/user/project/unsloth-notebooks/~/project/.venv/lib/python3.12/site-packages/transformers/utils/chat_template_utils.py:521) rendered_chat = compiled_template.render(
522 messages=chat,
523 tools=tool_schemas,
524 documents=documents,
525 add_generation_prompt=add_generation_prompt,
526 **kwargs,
527 )
528 if continue_final_message:
529 final_message = chat[-1]["content"]
File ~/project/.venv/lib/python3.12/site-packages/jinja2/environment.py:1295, in Template.render(self, *args, **kwargs)
1293 return self.environment.concat(self.root_render_func(ctx)) # type: ignore
1294 except Exception:
-> [1295](https://vscode-remote+ssh-002.vscode-resource.vscode-cdn.net/home/user/project/unsloth-notebooks/~/project/.venv/lib/python3.12/site-packages/jinja2/environment.py:1295) self.environment.handle_exception()
File ~/project/.venv/lib/python3.12/site-packages/jinja2/environment.py:942, in Environment.handle_exception(self, source)
937 """Exception handling helper. This is used internally to either raise
938 rewritten exceptions or return a rendered traceback for the template.
939 """
940 from .debug import rewrite_traceback_stack
--> [942](https://vscode-remote+ssh-002.vscode-resource.vscode-cdn.net/home/user/project/unsloth-notebooks/~/project/.venv/lib/python3.12/site-packages/jinja2/environment.py:942) raise rewrite_traceback_stack(source=source)
File <template>:23, in top-level template code()
UndefinedError: 'list object' has no attribute 'content'Metadata
Metadata
Assignees
Labels
No labels