Skip to content

fix(janus): handle None values in image generation mode#44814

Closed
BillionClaw wants to merge 1 commit intohuggingface:mainfrom
BillionClaw:clawoss/fix/janus-test-1773827464
Closed

fix(janus): handle None values in image generation mode#44814
BillionClaw wants to merge 1 commit intohuggingface:mainfrom
BillionClaw:clawoss/fix/janus-test-1773827464

Conversation

@BillionClaw
Copy link
Copy Markdown

Fixes #44792

This PR fixes the failing test test_model_generate_images for the Janus model.

Problem

When generating images with the Janus model, generation_config.num_return_sequences and generation_config.max_length can be None, causing the following errors:

  • TypeError when num_return_sequences is None and used as expand_size
  • TypeError when max_length is None and used in max() comparison

Fix

  • Added null check for generation_config.num_return_sequences with default value of 1
  • Added null check for generation_config.max_length with default value of 0

These changes ensure that the image generation mode works correctly when these configuration values are not explicitly set.

Fixes huggingface#44792

- Add null check for generation_config.num_return_sequences (default to 1)
- Add null check for generation_config.max_length (default to 0)
@github-actions
Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: janus

@kaixuanliu
Copy link
Copy Markdown
Contributor

Hi @BillionClaw , Just curious why you submit this PR, rather than use #44793

@zucchini-nlp
Copy link
Copy Markdown
Member

As mentioned in the other PR

we just need to call _prepare_generation_config in the very beginning, it is missing

I'll close this as duplicate, it's the same GH user so I assume you can update #44793 as per review comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed test case test_model_generate_images for janus model

3 participants