Linaqruf / kohya-trainer

Adapted from https://note.com/kohya_ss/n/nbf7ce8d80f29 for easier cloning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

running cell 5.2. Dataset Config error: 'class_token' is not defined

therockwin1 opened this issue · comments

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <cell line: 129>:130 │
│ in process_folder_recursively:65 │
│ in get_class_token_from_folder_name:85 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
NameError: name 'class_token' is not defined

================
I am using Kohya LoRA Dreambooth v15.0.0, everything was fine until I came to "5.2. Dataset Config", the error as above. where should I input the class_token, which cell is for class token can somebody tell me please?

IMG_1381 PNG

I found in youtube an older version, where I can see "class_token"in the cell "5.2 Dateset Config".
however in the latest version(v15.0.0), the "class_token" is missing. sorry but is it a bug?

commented

I also encountered this problem that,
│ in <cell line: 97>:97
│ in get_subfolders_with_supported_images:38
FileNotFoundError: [Errno 2] No such file or directory: ''
and
5.5. Start Training
ValueError: file not found / ファイルが見つかりません:
/content/LoRA/config/dataset_config.toml

same here
image

I'm getting the same errors. It seems to be caused by having an empty 'reg_data_dir' value (reg_data_dir = "") in cell '3.1.'. Also possibly by having it point to a non-existent/empty folder as well.

Also omitting the 'activation_word' in step '5.2.' or entering only one word instead of two (separated by a space or comma) results in the "name 'class_token' is not defined" error above. This makes 'activation_word' not optional, as the description implies.

Looks like get_subfolders_with_supported_images and get_class_token_from_folder_name can't handle empty and missing folders and some 'activation_word' values.

Luckily you can still just use v14 in the meantime.

I'm getting the same errors. It seems to be caused by having an empty 'reg_data_dir' value (reg_data_dir = "") in cell '3.1.'. Also possibly by having it point to a non-existent/empty folder as well.

Also omitting the 'activation_word' in step '5.2.' or entering only one word instead of two (separated by a space or comma) results in the "name 'class_token' is not defined" error above. This makes 'activation_word' not optional, as the description implies.

Looks like get_subfolders_with_supported_images and get_class_token_from_folder_name can't handle empty and missing folders and some 'activation_word' values.

Luckily you can still just use v14 in the meantime.

in my case I had inputted the 'reg_data_dir' in 3.1 and 'activation_word' in 5.2.

I think the problem is the 'class_token' issue. Can you tell me where I can input the 'class_token' ? If not, the code should be modified so that we can define 'class_token'.

image

I have compared the V14 and V15, please refer to the above image.

@therockwin1 I haven't actually looked that deep into it, but it seems the 'instance_token' and the 'class_token' inputs from earlier versions were merged into one – the 'activation_word'. However, the now internal 'class_token' variable is only set properly when you enter a two word value as the 'activation_word', separated with a space or a comma ",".

That means for the 'activation_word' you need something like "instance class" or "instance,class", to not have it error on line 85 of the cell (return class_token).

@user58823 I have just tried to input a 2 words 'activation_word', and it worked! Thank you!

@user58823 I have just tried to input a 2 words 'activation_word', and it worked! Thank you!

Thank you, it worked