1、 A:data.map 传给 messages_preprocess 的第一个参数是整行字典 {"messages": [...]},不是 messages 列表本身。所以 apply_chat_template 收到的是一个 dict,模板引擎尝试用 [0] 索引它就炸了。 2、Traceback (most recent call last): 3、File "/home/emoai/.pycharm_helpers/pydev/pydevd.py", line 1647, in _exec pydev_imports.execfile(file, globals, locals) # execute the script ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/emoai/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/mnt/d/NaturalLanguage-P/LoRAQwen3/main.py", line 130, in 4、 0%| | 0/180 [00:00<?, ?it/s]Traceback (most recent call last):
Traceback (most recent call last):
File "/mnt/d/NaturalLanguage-P/LoRAQwen3/main.py", line 122, in
main()
File "/mnt/d/NaturalLanguage-P/LoRAQwen3/main.py", line 104, in main
dataset = data.map(
^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/datasets/arrow_dataset.py", line 576, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/datasets/arrow_dataset.py", line 3633, in map
for rank, done, content in Dataset._map_single(unprocessed_kwargs):
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/datasets/arrow_dataset.py", line 3973, in _map_single
for i, example in iter_outputs(shard_iterable):
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/datasets/arrow_dataset.py", line 3951, in iter_outputs
yield i, apply_function(example, i, offset=offset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/datasets/arrow_dataset.py", line 3872, in apply_function
processed_inputs = function(fn_args, *additional_args, **fn_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/LoRAQwen3/main.py", line 16, in messages_preprocess
input_ids = tokenizer.apply_chat_template(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/tokenization_utils_base.py", line 3107, in apply_chat_template
rendered_chat, generation_indices = render_jinja_template(
^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/utils/chat_template_utils.py", line 581, in render_jinja_template
rendered_chat = compiled_template.render(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/jinja2/environment.py", line 1295, in render
self.environment.handle_exception()
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/jinja2/environment.py", line 942, in handle_exception
raise rewrite_traceback_stack(source=source)
File "", line 15, in top-level template code
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/jinja2/sandbox.py", line 293, in getitem
return obj[argument]
~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: datasets.formatting.formatting.LazyRow object has no element 0
File "/mnt/d/NaturalLanguage-P/LoRAQwen3/main.py", line 124, in
main()
File "/mnt/d/NaturalLanguage-P/LoRAQwen3/main.py", line 115, in main
trainer.train(resume_from_checkpoint=True)
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/trainer.py", line 1414, in train
raise ValueError(f"No valid checkpoint found in output directory ({args.output_dir})")
ValueError: No valid checkpoint found in output directory (/mnt/d/NaturalLanguage-P/LoRAQwen3/output)
A:
A:
File "/mnt/d/NaturalLanguage-P/LoRAQwen3/main.py", line 131, in
main()
File "/mnt/d/NaturalLanguage-P/LoRAQwen3/main.py", line 122, in main
trainer.train(resume_from_checkpoint=resume)
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/trainer.py", line 1433, in train
return inner_training_loop(
^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/trainer.py", line 1515, in _inner_training_loop
self._run_epoch(
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/trainer.py", line 1710, in _run_epoch
batch_samples, num_items_in_batch = self.get_batch_samples(epoch_iterator, num_batches, self.args.device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/trainer.py", line 2116, in get_batch_samples
batch_samples.append(next(epoch_iterator))
^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/accelerate/data_loader.py", line 577, in iter
current_batch = next(dataloader_iter)
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 741, in next
data = self._next_data()
^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 801, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/torch/utils/data/_utils/fetch.py", line 57, in fetch
return self.collate_fn(data)
^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/data/data_collator.py", line 542, in call
batch = pad_without_fast_tokenizer_warning(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/data/data_collator.py", line 63, in pad_without_fast_tokenizer_warning
padded = tokenizer.pad(*pad_args, **pad_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mnt/d/NaturalLanguage-P/huggingface/lib/python3.12/site-packages/transformers/tokenization_utils_base.py", line 2696, in pad
raise ValueError(
ValueError: type of {'input_ids': [151644, 8948, 198, 56568, 101909, 111019, 100014, 57621, 105017, 118797, 31548, 1773, 56568, 100645, 91680, 66017, 101431, 4718, 64429, 3837, 104484, 66017, 73192, 5373, 104136, 5373, 46100, 99922, 5373, 72640, 5373, 24562, 103630, 5373, 33447, 103630, 57191, 366, 26865, 29, 1773, 118181, 101097, 104133, 44931, 5122, 99535, 99916, 55502, 1773, 66017, 100645, 100470, 101137, 31991, 100166, 5122, 4913, 99535, 99916, 55502, 66582, 20450, 3252, 917, 2198, 104766, 3252, 917, 2198, 99558, 104013, 3252, 917, 2198, 101108, 31905, 3252, 917, 2198, 101108, 99877, 3252, 917, 9207, 13989, 151645, 198, 151644, 872, 198, 14880, 45181, 100431, 9370, 111019, 100014, 15946, 118797, 99558, 99535, 99916, 55502, 105017, 3407, 101882, 5122, 91680, 66017, 4718, 3837, 100148, 73192, 3837, 100148, 104136, 3837, 100148, 46100, 99922, 3837, 100148, 366, 26865, 29, 3837, 100148, 42855, 38342, 91282, 44931, 8997, 66017, 68805, 5122, 4913, 99535, 99916, 55502, 66582, 20450, 3252, 917, 2198, 104766, 3252, 917, 2198, 99558, 104013, 3252, 917, 2198, 101108, 31905, 3252, 917, 2198, 101108, 99877, 3252, 917, 9207, 60, 630, 111019, 100014, 28311, 45785, 5122, 16, 24, 19, 21, 12, 16, 15, 12, 16, 15, 198, 40301, 32571, 5122, 29437, 19, 40301, 198, 60396, 5122, 99479, 100536, 103791, 33108, 36993, 99312, 36587, 198, 110644, 5122, 99479, 100536, 103791, 33108, 36993, 99312, 36587, 220, 29258, 99809, 108245, 100356, 104939, 10236, 118, 121, 94237, 101060, 101882, 102005, 44991, 99193, 104893, 220, 16, 24, 19, 21, 12, 16, 15, 12, 16, 15, 50331, 19, 40301, 368, 220, 108102, 5122, 101882, 109558, 76921, 58695, 44054, 112, 100536, 103791, 33108, 36993, 99312, 36587, 220, 29258, 99809, 108245, 100356, 104939, 10236, 118, 121, 94237, 101060, 101882, 102005, 44991, 99193, 104893, 33576, 106013, 111179, 99612, 105021, 10958, 106004, 99837, 5122, 99908, 99310, 47815, 45861, 99479, 100536, 103791, 9909, 101259, 115484, 7552, 57218, 100458, 118586, 102659, 99446, 99458, 101361, 75108, 107471, 33108, 36993, 36589, 74413, 100122, 104159, 102098, 99312, 36587, 1773, 99479, 100536, 103791, 103988, 102772, 17881, 53930, 111618, 113232, 101802, 62945, 3837, 99489, 99754, 39165, 99721, 1773, 99479, 104057, 100016, 24641, 36987, 106046, 17340, 117034, 101091, 111618, 109100, 99604, 3837, 100002, 99876, 57621, 53930, 104175, 103972, 99200, 16530, 102486, 3837, 60894, 108245, 99754, 100356, 99295, 26288, 99463, 53930, 104939, 82641, 32945, 99446, 99458, 59532, 24641, 36987, 106046, 17340, 109706, 100136, 112268, 108033, 104304, 1773, 101114, 36667, 116156, 104304, 53930, 103026, 3837, 77288, 101553, 21317, 103971, 36667, 104899, 111957, 5373, 99599, 36667, 104658, 99980, 99786, 17340, 44793, 68536, 101188, 111811, 99489, 99532, 105777, 99702, 99389, 53930, 100385, 32945, 33576, 106013, 111179, 99612, 105021, 10958, 106004, 99837, 5122, 33108, 36993, 99200, 103984, 101888, 99200, 114305, 108708, 106212, 9370, 104075, 112420, 99566, 8903, 102384, 80565, 3837, 101895, 103984, 99937, 18493, 99808, 100478, 100161, 100370, 15946, 3837, 100349, 32463, 103670, 102727, 99346, 103984, 100628, 99994, 34204, 20450, 68536, 104005, 42067, 36993, 3837, 115873, 99399, 99645, 16530, 100242, 3837, 75882, 103984, 17714, 114090, 32463, 20929, 101523, 100551, 68153, 86119, 3837, 99798, 34204, 63703, 105311, 75108, 8903, 104005, 99903, 93488, 40820, 100993, 92536, 70589, 3837, 17714, 106004, 33108, 36993, 109153, 45861, 99774, 32571, 42067, 36993, 1773, 33108, 36993, 35987, 36993, 112420, 99566, 105286, 101984, 3837, 100458, 16744, 48888, 101242, 3837, 36993, 82224, 106175, 106837, 1773, 47815, 45861, 99903, 101888, 35987, 99903, 29826, 74220, 104190, 9370, 101898, 109917, 101383, 85248, 67338, 1773, 33576, 106013, 111179, 99612, 105021, 10958, 106357, 99837, 5122, 104507, 57566, 99908, 107889, 100715, 107709, 106357, 100807, 100222, 103108, 104208, 105246, 101984, 101060, 100770, 3837, 67338, 109639, 3837, 47534, 100028, 101245, 100221, 64689, 102005, 44991, 99193, 104893, 9370, 100138, 90395, 102256, 100625, 105818, 110816, 52129, 111529, 1773, 100625, 94443, 99835, 99645, 102784, 103984, 108455, 105181, 99462, 18493, 100770, 107185, 36587, 24641, 5122, 103928, 100428, 102561, 32664, 99908, 100956, 57452, 33108, 119066, 101407, 100623, 57218, 18493, 100657, 54926, 100907, 106530, 9370, 100426, 100238, 33108, 104304, 100428, 102561, 28946, 99639, 107536, 53930, 121249, 1773, 117960, 85641, 45629, 110840, 99295, 47534, 100028, 100143, 85361, 100809, 99253, 31838, 106962, 104939, 100138, 1773, 100770, 115855, 85361, 100809, 99253, 3837, 82641, 99650, 99350, 34204, 101963, 23031, 44991, 99193, 104893, 81217, 57566, 99908, 99721, 107078, 9370, 104999, 104939, 101079, 1773, 151645, 198, 151644, 77091, 198, 4913, 99535, 99916, 55502, 66582, 20450, 3252, 16, 24, 19, 21, 12, 16, 15, 12, 16, 15, 2198, 104766, 3252, 111179, 2198, 99558, 104013, 3252, 33108, 36993, 99200, 5373, 101895, 5373, 103670, 102727, 99346, 2198, 101108, 31905, 3252, 104561, 100675, 2198, 101108, 99877, 3252, 106013, 5373, 108245, 5373, 99479, 100536, 103791, 33108, 36993, 9207, 13989, 151645, 198], 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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