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

Upgrade examples to BioNeMo 2 #3095

Merged
merged 14 commits into from
Feb 27, 2025
Merged

Upgrade examples to BioNeMo 2 #3095

merged 14 commits into from
Feb 27, 2025

Conversation

holgerroth
Copy link
Collaborator

@holgerroth holgerroth commented Dec 6, 2024

Fixes # .

Description

Upgrade existing bionemo example to use version 2.4 (upcoming release)

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Quick tests passed locally by running ./runtest.sh.
  • In-line docstrings updated.
  • Documentation updated.

@holgerroth holgerroth marked this pull request as ready for review February 21, 2025 21:07
@holgerroth
Copy link
Collaborator Author

/build

@farhadrgh
Copy link
Collaborator

farhadrgh commented Feb 21, 2025

Suggestion regarding accumulation TB history for the clients. Clients recording TB history locally from trainer:

from tensorboard.backend.event_processing.event_accumulator import EventAccumulator

def get_tensorboard_history(trainer):
    # Get the log directory from trainer's logger
    log_dir = trainer.logger.experiment.log_dir
    
    # Create an EventAccumulator object
    event_acc = EventAccumulator(log_dir)
    event_acc.Reload()  # Load all data
    
    # Get available tags (metrics)
    tags = event_acc.Tags()['scalars']
    
    # Extract history for each metric
    history = {}
    for tag in tags:
        events = event_acc.Scalars(tag)
        # Each event has attributes: wall_time, step, value
        history[tag] = [(e.step, e.value) for e in events]
    
    return history

And then after sharing through Shareable object you create a TB writer to accumulate them all:

tb_writer = SummaryWriter('continuous_logs')
for shareable in shareables:
    metrics_history = shareable['history']
    # Write each metric to the continuous log
    for metric_name, values in metrics_history.items():
        for step, value in values:
            global_step = (current_round * max_steps_per_round) + step
            writer.add_scalar(f'continuous/{metric_name}',  value, global_step=global_step)

@holgerroth holgerroth requested a review from farhadrgh February 21, 2025 21:53
Copy link
Collaborator

@farhadrgh farhadrgh left a comment

Choose a reason for hiding this comment

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

LGTM

@holgerroth
Copy link
Collaborator Author

TB accumulation will be addressed in a separate PR. Filed an issue for tracking #3249

@holgerroth
Copy link
Collaborator Author

/build

@holgerroth
Copy link
Collaborator Author

/build

@holgerroth holgerroth requested a review from NAEV95 February 25, 2025 18:57
@holgerroth
Copy link
Collaborator Author

/build

@holgerroth holgerroth enabled auto-merge (squash) February 25, 2025 21:16
@holgerroth
Copy link
Collaborator Author

/build

Copy link
Collaborator

@YuanTingHsieh YuanTingHsieh left a comment

Choose a reason for hiding this comment

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

LGTM

@holgerroth
Copy link
Collaborator Author

/build

@holgerroth holgerroth merged commit 9ed5ba7 into NVIDIA:main Feb 27, 2025
20 checks passed
@holgerroth holgerroth deleted the bionemo2.1 branch February 28, 2025 00:23
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.

3 participants