You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I implemented textual inversion follwowing this link, but I think there is something wrong with eos_token_id in stable-diffusion-v1-5 text encoder config.
The config file is like this, this means eos_token_id == 2:
ifself.eos_token_id==2:
# The `eos_token_id` was incorrect before PR #24773: Let's keep what have been done here.# A CLIP model with such `eos_token_id` in the config can't work correctly with extra new tokens added# ------------------------------------------------------------# text_embeds.shape = [batch_size, sequence_length, transformer.width]# take features from the eot embedding (eot_token is the highest number in each sequence)# casting to torch.int for onnx compatibility: argmax doesn't support int64 inputs with opset 14pooled_output=last_hidden_state[
torch.arange(last_hidden_state.shape[0], device=last_hidden_state.device),
input_ids.to(dtype=torch.int, device=last_hidden_state.device).argmax(dim=-1),
]
I think this means current code is not compatible with textual inversion (because we just get the embedding of newly added token with token id 49408, not the eos token.
I might be wrong, but it will be really helpful for giving me any comments.
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
Describe the bug
Hi, I implemented textual inversion follwowing this link, but I think there is something wrong with
eos_token_id
in stable-diffusion-v1-5 text encoder config.The config file is like this, this means
eos_token_id == 2
:but in transformers modeling_clip.py,
I think this means current code is not compatible with textual inversion (because we just get the embedding of newly added token with token id 49408, not the eos token.
I might be wrong, but it will be really helpful for giving me any comments.
Thank you.
Reproduction
accelerate launch textual_inversion.py
--pretrained_model_name_or_path=$MODEL_NAME
--train_data_dir=$DATA_DIR
--learnable_property="object"
--placeholder_token=""
--initializer_token="dog"
--resolution=512
--train_batch_size=1
--gradient_accumulation_steps=4
--max_train_steps=3000
--learning_rate=5.0e-04
--scale_lr
--lr_scheduler="constant"
--lr_warmup_steps=0 \
System Info
diffusers 0.32.0.dev0
Who can help?
No response
The text was updated successfully, but these errors were encountered: