From 35197292dac41f278982b675095c1f1e252cd0ee Mon Sep 17 00:00:00 2001 From: Qi Cai Date: Mon, 7 Apr 2025 22:54:41 +0800 Subject: [PATCH] update readme and fix pipeline text length --- .gitignore | 4 +++- README.md | 2 ++ .../pipelines/hidream_image/pipeline_hidream_image.py | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index fb71356..c28c075 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ __pycache__ tmp *_local.py *.jpg -*.png \ No newline at end of file +*.png +*.tar +*.txt diff --git a/README.md b/README.md index ef32bc1..bd680b7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # HiDream-I1 +![HiDream-I1 Demo](assets/demo.jpg) + `HiDream-I1` is a new open-source image generative foundation model with 17B parameters that achieves state-of-the-art image generation quality within seconds. ## Project Updates diff --git a/hi_diffusers/pipelines/hidream_image/pipeline_hidream_image.py b/hi_diffusers/pipelines/hidream_image/pipeline_hidream_image.py index 268e923..09d7c14 100644 --- a/hi_diffusers/pipelines/hidream_image/pipeline_hidream_image.py +++ b/hi_diffusers/pipelines/hidream_image/pipeline_hidream_image.py @@ -176,10 +176,10 @@ class HiDreamImagePipeline(DiffusionPipeline, FromSingleFileMixin): untruncated_ids = self.tokenizer_3(prompt, padding="longest", return_tensors="pt").input_ids if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal(text_input_ids, untruncated_ids): - removed_text = self.tokenizer_3.batch_decode(untruncated_ids[:, self.text_encoder_3.model_max_length - 1 : -1]) + removed_text = self.tokenizer_3.batch_decode(untruncated_ids[:, min(max_sequence_length, self.tokenizer_3.model_max_length) - 1 : -1]) logger.warning( "The following part of your input was truncated because `max_sequence_length` is set to " - f" {self.text_encoder_3.model_max_length} tokens: {removed_text}" + f" {min(max_sequence_length, self.tokenizer_3.model_max_length)} tokens: {removed_text}" ) prompt_embeds = self.text_encoder_3(text_input_ids.to(device), attention_mask=attention_mask.to(device))[0] @@ -262,10 +262,10 @@ class HiDreamImagePipeline(DiffusionPipeline, FromSingleFileMixin): untruncated_ids = self.tokenizer_4(prompt, padding="longest", return_tensors="pt").input_ids if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal(text_input_ids, untruncated_ids): - removed_text = self.tokenizer_4.batch_decode(untruncated_ids[:, self.text_encoder_4.model_max_length - 1 : -1]) + removed_text = self.tokenizer_4.batch_decode(untruncated_ids[:, min(max_sequence_length, self.tokenizer_4.model_max_length) - 1 : -1]) logger.warning( "The following part of your input was truncated because `max_sequence_length` is set to " - f" {self.text_encoder_4.model_max_length} tokens: {removed_text}" + f" {min(max_sequence_length, self.tokenizer_4.model_max_length)} tokens: {removed_text}" ) outputs = self.text_encoder_4(