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
I was getting some nonsensical results for a little while until it occurred to me that some words are multiple tokens (and punctuation, etc, are tokens as well).
Here's some code I'm using to do it:
#Process prompt editing
if prompt_edit is not None:
tokens_conditional_edit = clip_tokenizer(prompt_edit, padding="max_length", max_length=clip_tokenizer.model_max_length, truncation=True, return_tensors="pt", return_overflowing_tokens=True)
embedding_conditional_edit = clip(tokens_conditional_edit.input_ids.to(device)).last_hidden_state
init_attention_edit(tokens_conditional, tokens_conditional_edit)
#My code starts here
for t in prompt_edit_token_weights:
token_word = prompt_token(prompt_edit, t[0])
print(f"{token_word}: {t[1]}")
else:
for t in prompt_edit_token_weights:
token_word = prompt_token(prompt, t[0])
print(f"{token_word}: {t[1]}")
Probably ought to check and make sure I'm not misunderstanding anything, but it appears to work.
The text was updated successfully, but these errors were encountered:
Yeah, I'll get back to working on it during the week. Adding a more intuitive prompt editing method, such as using brackets (eg. a landscape of (mountains:-10) with (rivers and trees:+3)) would be for me one of the high priority improvements that can be added.
I was getting some nonsensical results for a little while until it occurred to me that some words are multiple tokens (and punctuation, etc, are tokens as well).
Here's some code I'm using to do it:
Probably ought to check and make sure I'm not misunderstanding anything, but it appears to work.
The text was updated successfully, but these errors were encountered: