Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero order search #14

Merged
merged 10 commits into from
Feb 28, 2025
Merged

Zero order search #14

merged 10 commits into from
Feb 28, 2025

Conversation

sayakpaul
Copy link
Owner

@sayakpaul sayakpaul commented Feb 21, 2025

image

Config:

{
    "pretrained_model_name_or_path": "black-forest-labs/FLUX.1-dev",
    "torch_dtype": "bf16",
    "pipeline_call_args": {
        "height": 1024,
        "width": 1024,
        "max_sequence_length": 512,
        "guidance_scale": 3.5,
        "num_inference_steps": 50
    },
    "verifier_args": {
        "name": "gemini", 
        "max_new_tokens": 800,
        "choice_of_metric": "overall_score"
    },
    "search_args": {
        "search_method": "zero-order",
        "search_rounds": 4,
        "threshold": 0.95,
        "num_neighbors": 4
    }
}

Copy link
Collaborator

@willisma willisma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@willisma
Copy link
Collaborator

Let me know your opinion on this:
we also observed similar effect as in the sample you shown above, that the search converge to some fix point without further improving, so I wonder if we should either:

  1. for one search round, if all neighbor noises are worse, restart the round without increment the round number
  2. for one search round, if all neighbor noises are worse, reject this round, save the center noise n, and sample a new noise to perform the rest of the search, and in the end compare the saved noise and the new noise to see which is better

@sayakpaul
Copy link
Owner Author

sayakpaul commented Feb 24, 2025

for one search round, if all neighbor noises are worse, reject this round, save the center noise n, and sample a new noise to perform the rest of the search, and in the end compare the saved noise and the new noise to see which is better

We could do this. We will have datapoint from each search that will help us do it easily I believe.

for one search round, if all neighbor noises are worse, reject this round

Regarding this we compare the performance of the neighbor noises w.r.t the base noise right?

@willisma
Copy link
Collaborator

for one search round, if all neighbor noises are worse, reject this round, save the center noise n, and sample a new noise to perform the rest of the search, and in the end compare the saved noise and the new noise to see which is better

We could do this. We will have datapoint from each search that will help us do it easily I believe.

for one search round, if all neighbor noises are worse, reject this round

Regarding this we compare the performance of the neighbor noises w.r.t the base noise right?

yes that's correct

@sayakpaul
Copy link
Owner Author

@willisma I went with 2.

{
    "pretrained_model_name_or_path": "black-forest-labs/FLUX.1-dev",
    "torch_dtype": "bf16",
    "pipeline_call_args": {
        "height": 1024,
        "width": 1024,
        "max_sequence_length": 512,
        "guidance_scale": 3.5,
        "num_inference_steps": 50
    },
    "verifier_args": {
        "name": "gemini", 
        "max_new_tokens": 800,
        "choice_of_metric": "overall_score"
    },
    "search_args": {
        "search_method": "zero-order",
        "search_rounds": 4,
        "threshold": 0.95,
        "num_neighbors": 4
    }
}
python main.py --prompt="a tiny astronaut hatching from an egg on the moon" --num_prompts=None --pipeline_config_path=configs/flux.1_dev_zero_order.json

image

If you could take a look and let me know your comments, that would be helpful.

@sayakpaul sayakpaul requested a review from willisma February 25, 2025 10:24
main.py Outdated
print("Using the best noise from the previous round.")
prev_dp = best_datapoint_per_round[previous_round]
noises = {int(prev_dp["best_noise_seed"]): prev_dp["best_noise"]}
else:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused about here & the should_generate_noise flag; what's the difference between the two?

@sayakpaul
Copy link
Owner Author

@willisma sorry to be bothering again, hopefully, this is the last one. Could you check the changes in 8b47348?

When rejecting the current round, I am:

  • Not serializing the artifacts (datapoint JSON and images)
  • Sampling a new base noise and continuing with the rest of the process.

LMK.

image

@sayakpaul sayakpaul merged commit 4c6a5bc into main Feb 28, 2025
@sayakpaul sayakpaul deleted the zero-order-search branch February 28, 2025 06:39
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.

2 participants