An error occurred when running the example according to the documentation.
python scripts/prepare_data.py --dataset sharegpt
bash ./examples/run_llama3.1_8b_eagle3_online.sh 4 2
rank0]: Traceback (most recent call last):
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/multiprocess/pool.py", line 125, in worker
[rank0]: result = (True, func(*args, **kwds))
[rank0]: ^^^^^^^^^^^^^^^^^^^
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/datasets/utils/py_utils.py", line 585, in _write_generator_to_queue
[rank0]: for i, result in enumerate(func(**kwargs)):
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/datasets/arrow_dataset.py", line 3998, in _map_single
[rank0]: for i, batch in iter_outputs(shard_iterable):
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/datasets/arrow_dataset.py", line 3951, in iter_outputs
[rank0]: yield i, apply_function(example, i, offset=offset)
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/datasets/arrow_dataset.py", line 3872, in apply_function
[rank0]: processed_inputs = function(*fn_args, *additional_args, **fn_kwargs)
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/workspace/SpecForge/specforge/data/preprocessing.py", line 412, in preprocess_function
[rank0]: processed = preprocess_conversations(
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/workspace/SpecForge/specforge/data/preprocessing.py", line 166, in preprocess_conversations
[rank0]: input_ids, loss_mask = parser.parse(
[rank0]: ^^^^^^^^^^^^^
[rank0]: File "/workspace/SpecForge/specforge/data/parse.py", line 197, in parse
[rank0]: conversation = self.apply_chat_template(messages, tool=tool, **kwargs)
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/workspace/SpecForge/specforge/data/parse.py", line 123, in apply_chat_template
[rank0]: conversation = self.tokenizer.apply_chat_template(
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/transformers/tokenization_utils_base.py", line 1666, in apply_chat_template
[rank0]: rendered_chat, generation_indices = render_jinja_template(
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/transformers/utils/chat_template_utils.py", line 539, in render_jinja_template
[rank0]: rendered_chat = compiled_template.render(
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/jinja2/environment.py", line 1295, in render
[rank0]: self.environment.handle_exception()
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/jinja2/environment.py", line 942, in handle_exception
[rank0]: raise rewrite_traceback_stack(source=source)
[rank0]: File "<template>", line 52, in top-level template code
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/jinja2/sandbox.py", line 401, in call
[rank0]: return __context.call(__obj, *args, **kwargs)
[rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[rank0]: File "/usr/local/python3.11.14/lib/python3.11/site-packages/transformers/utils/chat_template_utils.py", line 447, in raise_exception
[rank0]: raise jinja2.exceptions.TemplateError(message)
[rank0]: jinja2.exceptions.TemplateError: Cannot put tools in the first user message when there's no first user message!
Checklist
Describe the bug
An error occurred when running the example according to the documentation.
Environment:
torch 2.8.0+cpu
torch_npu 2.8.0.post2
torchao 0.9.0
torchaudio 2.8.0
torchvision 0.23.0
sglang 0.5.9
sglang-router 0.3.2
datasets 4.8.5
transformers 4.57.1
Reproduction
Error message:
Environment
Using quay.io/ascend/sglang:v0.5.9-cann8.5.0-a3
Environment:
torch 2.8.0+cpu
torch_npu 2.8.0.post2
torchao 0.9.0
torchaudio 2.8.0
torchvision 0.23.0
sglang 0.5.9
sglang-router 0.3.2
datasets 4.8.5
transformers 4.57.1