Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

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

Open
therockwin1 opened this issue Apr 15, 2023 · 9 comments
Open

Comments

@therockwin1
Copy link

╭─────────────────────────────── 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?

@therockwin1 therockwin1 changed the title Kohya LoRA Dreambooth V15.0.0 'class_token' is not defined running cell 5.2. Dataset Config error: 'class_token' is not defined Apr 15, 2023
@therockwin1
Copy link
Author

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?

@sleel
Copy link

sleel commented Apr 15, 2023

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

@sincerity11
Copy link

same here
image

@user58823
Copy link

user58823 commented Apr 15, 2023

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.

@therockwin1
Copy link
Author

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'.

@therockwin1
Copy link
Author

image

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

@user58823
Copy link

@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).

@therockwin1
Copy link
Author

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

Linaqruf added a commit that referenced this issue Apr 25, 2023
@BinaryQuantumSoul
Copy link

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

Thank you, it worked

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants