Repository navigation
Closed
unslothai/unsloth-zoo
#1225Description
When dataset have same prompt, it will throw error when calling standardize_sharegpt, see the following example, the only difference in good.csv and bad.csv is name column, which good.csv I added a 2 in name.
from datasets import load_dataset
from unsloth import to_sharegpt
from unsloth import standardize_sharegpt
from pprint import pprint
# bad.csv
'''
PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,,S
2,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,,S
'''
# good.csv
'''
PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,,S
2,0,3,"Braund2, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,,S
'''
dataset = load_dataset(
"csv",
data_files = "./bad.csv",
# data_files = "./good.csv",
split = "train",
)
dataset = to_sharegpt(
dataset,
merged_prompt = "{Name}",
conversation_extension = 2, # Randomnly combines conversations into 1! Good for long convos
output_column_name = "Survived",
)
pprint(dataset[0])
dataset = standardize_sharegpt(dataset)and this is the output
🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.
🦥 Unsloth Zoo will now patch everything to make training faster!
Generating train split: 2 examples [00:00, 375.38 examples/s]
Merging columns: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 339.33 examples/s]
Converting to ShareGPT: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 560.25 examples/s]
Flattening the indices: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 807.68 examples/s]
Flattening the indices: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 741.44 examples/s]
Extending conversations: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 650.23 examples/s]
{'conversations': [{'from': 'human', 'value': "('Braund, Mr. Owen Harris',)"},
{'from': 'gpt', 'value': '0'},
{'from': 'human', 'value': "('Braund, Mr. Owen Harris',)"},
{'from': 'gpt', 'value': '0'}]}
Traceback (most recent call last):
File "/home/avenger2/git/test/bug.py", line 38, in <module>
dataset = standardize_sharegpt(dataset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/avenger2/.pyenv/versions/3.11.11/lib/python3.11/site-packages/unsloth/chat_templates.py", line 1447, in standardize_sharegpt
raise TypeError(
TypeError: Unsloth: ['0', "('Braund, Mr. Owen Harris',)"] are not in aliases. Please update aliases.
and below is my environment
🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.
🦥 Unsloth Zoo will now patch everything to make training faster!
==((====))== Unsloth 2025.2.12: Fast Llama patching. Transformers: 4.48.3.
\\ /| GPU: NVIDIA A100-PCIE-40GB. Max memory: 39.431 GB. Platform: Linux.
O^O/ \_/ \ Torch: 2.6.0+cu124. CUDA: 8.0. CUDA Toolkit: 12.4. Triton: 3.2.0
\ / Bfloat16 = TRUE. FA [Xformers = 0.0.29.post3. FA2 = False]
"-____-" Free Apache license: http://github.com/unslothai/unsloth
Unsloth: Fast downloading is enabled - ignore downloading bars which are red colored!
Metadata
Metadata
Assignees
Labels
No labels
Activity
rohit64singh commentedon Feb 20, 2025
Getting same issue, found any solution to resolve this issue ?
variable commentedon Mar 3, 2025
Same problem
woofy0 commentedon Mar 29, 2025
I ran into the same problem but it was due to my training data, basically it didn't have enough unique questions/responses. I was training on a dataset of 1 row to make sure the code worked before I provided a lot of data.
Part of the standardize_sharegpt code is:
My training data was basically question and response, so my keys[0] would be "human" or "gpt" and keys[1] would be the actual questions/responses.
Since you're supposed to use a large set of varying questions/responses/text for your training data, it assumes the key with the least amount of unique values must be your "role" key.
Since that wasn't the case for my training data, it ended up thinking the key that contained my questions/responses was the "role" key and couldn't match it up with standard roles used in different models and complains.
So add more unique question and responses to the training data and it should get around that error.
Hope that helps.
Baseline the unsloth-zoo 2026.10.6 and transformers 5.20.0 scan findi…