Skip to content

Entropic time scheduler#1024

Merged
nvdreidenbach merged 9 commits intoNVIDIA:mainfrom
btrentini:entropic-time-scheduler
Aug 20, 2025
Merged

Entropic time scheduler#1024
nvdreidenbach merged 9 commits intoNVIDIA:mainfrom
btrentini:entropic-time-scheduler

Conversation

@btrentini
Copy link
Copy Markdown
Collaborator

@btrentini btrentini commented Aug 5, 2025

Description

Generates an entropic time schedule by remapping time based on the
cumulative information gain provided by a predictor function.

Inspired by the work from Dejan Stancevic, Florian Handke, & Luca Ambrogioni. (2025).
Entropic Time Schedulers for Generative Diffusion Models (https://arxiv.org/abs/2504.13612)

This entropy rate is used to create an optimized, data-dependent time-stepping schedule for the generative process.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactor
  • Documentation update
  • Other (please describe):

CI Pipeline Configuration

Configure CI behavior by applying the relevant labels:

Note

By default, the notebooks validation tests are skipped unless explicitly enabled.

Authorizing CI Runs

We use copy-pr-bot to manage authorization of CI
runs on NVIDIA's compute resources.

  • If a pull request is opened by a trusted user and contains only trusted changes, the pull request's code will
    automatically be copied to a pull-request/ prefixed branch in the source repository (e.g. pull-request/123)
  • If a pull request is opened by an untrusted user or contains untrusted changes, an NVIDIA org member must leave an
    /ok to test comment on the pull request to trigger CI. This will need to be done for each new commit.

Usage

from bionemo.moco.schedules.inference_time_schedules import (
    EntropicInferenceSchedule, 
    TimeDirection #Optional
)

def predictor_fn(t: Tensor, x: Tensor) -> Tensor:
    # Ensure t is broadcastable for concatenation
    if t.ndim == 1:
        t = t.unsqueeze(-1)
    if t.shape[0] != x.shape[0]:
        t = t.expand(x.shape[0], -1)
    
    model_input = torch.cat([x, t], dim=-1)
    return model(model_input)

def x_0_sampler_fn(n_samples: int) -> Tensor:
    return #Noise Sampler

def x_1_sampler_fn(n_samples: int) -> Tensor:
    return #Target Sampler

inference_sched = EntropicInferenceSchedule(
    predictor=predictor_fn,
    x_0_sampler=x_0_sampler_fn,
    x_1_sampler=x_1_sampler_fn,
    nsteps=_FLOW_STEPS,
    n_schedule_points=10,      # More points -> more accurate schedule, but slower to generate
    batch_size=batch_size,
    direction=TimeDirection.UNIFIED,
    device=DEVICE,
)

schedule = inference_sched.generate_schedule().to(DEVICE)  
dts      = inference_sched.discretize().to(DEVICE)         

Pre-submit Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly
  • [] I have added/updated tests as needed
  • [] All existing tests pass successfully

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Aug 5, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@btrentini
Copy link
Copy Markdown
Collaborator Author

@nvdreidenbach FYI

In my next iteration I intend to modify _calculate_entropy_rate to make it more general

@nvdreidenbach nvdreidenbach added INCLUDE_NOTEBOOKS_TESTS ciflow:notebooks Run Jupyter notebooks execution tests for docs and bionemo2 labels Aug 12, 2025
Copy link
Copy Markdown
Collaborator

@nvdreidenbach nvdreidenbach left a comment

Choose a reason for hiding this comment

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

lgtm. Please merge after running the notebook tests to make sure there are no memory issues. Also remove vscode settings

@nvdreidenbach
Copy link
Copy Markdown
Collaborator

/ok to test

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Aug 13, 2025

/ok to test

@nvdreidenbach, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

@nvdreidenbach
Copy link
Copy Markdown
Collaborator

/ok to test

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Aug 13, 2025

/ok to test

@nvdreidenbach, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

@nvdreidenbach
Copy link
Copy Markdown
Collaborator

/ok to test cd43133

auto-merge was automatically disabled August 14, 2025 08:55

Head branch was pushed to by a user without write access

@btrentini
Copy link
Copy Markdown
Collaborator Author

/ok to test 2878d66

@nvdreidenbach
Copy link
Copy Markdown
Collaborator

/ok to test 2878d66

@btrentini
Copy link
Copy Markdown
Collaborator Author

/ok to test 5c20730

@btrentini btrentini force-pushed the entropic-time-scheduler branch from 5c20730 to 2ff04aa Compare August 15, 2025 17:27
@btrentini
Copy link
Copy Markdown
Collaborator Author

/ok to test 2ff04aa

@nvdreidenbach
Copy link
Copy Markdown
Collaborator

/ok to test 5c20730

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Aug 15, 2025

/ok to test 5c20730

@nvdreidenbach, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@nvdreidenbach
Copy link
Copy Markdown
Collaborator

/ok to test 2ff04aa

@youhanl-nvidia
Copy link
Copy Markdown
Collaborator

lgtm. Nice works!

Copy link
Copy Markdown
Collaborator

@youhanl-nvidia youhanl-nvidia left a comment

Choose a reason for hiding this comment

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

Looks good to me. Approved.

@nvdreidenbach nvdreidenbach added this pull request to the merge queue Aug 20, 2025
Merged via the queue into NVIDIA:main with commit b6bd5ed Aug 20, 2025
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow:notebooks Run Jupyter notebooks execution tests for docs and bionemo2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants