mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-06 21:52:27 +00:00
add truncation when > max_length
This commit is contained in:
@@ -320,7 +320,6 @@ def sample_image_inference(
|
||||
|
||||
# Load sample prompts from Gemma 2
|
||||
if gemma2_model is not None:
|
||||
logger.info(f"Encoding prompt with Gemma2: {prompt}")
|
||||
tokens_and_masks = tokenize_strategy.tokenize(prompt)
|
||||
gemma2_conds = encoding_strategy.encode_tokens(tokenize_strategy, [gemma2_model], tokens_and_masks)
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ class LuminaTokenizeStrategy(TokenizeStrategy):
|
||||
max_length=self.max_length,
|
||||
return_tensors="pt",
|
||||
padding="max_length",
|
||||
truncation=True,
|
||||
pad_to_multiple_of=8,
|
||||
)
|
||||
return (encodings.input_ids, encodings.attention_mask)
|
||||
|
||||
Reference in New Issue
Block a user