Skip to content

setup yaml#231

Merged
lazarusA merged 3 commits intomainfrom
la/yaml_config
Feb 19, 2026
Merged

setup yaml#231
lazarusA merged 3 commits intomainfrom
la/yaml_config

Conversation

@lazarusA
Copy link
Member

closes #230

still work in progress. But almost there.

@gemini-code-assist
Copy link

Summary of Changes

Hello @lazarusA, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request lays the groundwork for robust configuration management by integrating YAML file support. It introduces new utilities to handle the loading and saving of model and training parameters, enhancing the ability to reproduce experiments and manage complex settings. The changes also ensure that all training arguments are captured and stored with the training results, providing a comprehensive record of each run.

Highlights

  • YAML Configuration Integration: Introduced the YAML and OrderedCollections packages to enable reading and writing configuration files in YAML format.
  • New Configuration Utilities: Added a new utility file, src/utils/config_yaml.jl, which provides functions for loading and saving hybrid model and training configurations to YAML files.
  • Training Argument Persistence: Modified the TrainResults struct in src/train.jl to store all training arguments, allowing for better reproducibility and inspection of past training runs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Project.toml
    • Added OrderedCollections package dependency.
    • Added YAML package dependency.
  • src/EasyHybrid.jl
    • Imported OrderedDict from OrderedCollections.
    • Imported load_file and write_file from YAML.
    • Included the new config_yaml.jl utility file.
  • src/train.jl
    • Added train_args field to the TrainResults struct.
    • Updated the train function to capture and return training arguments within TrainResults.
  • src/utils/config_yaml.jl
    • Added load_hybrid_config function to load YAML files.
    • Added save_hybrid_config function to write configurations to YAML files.
    • Added get_hybrid_config function to extract configuration from a HybridModel object.
    • Added get_train_config function to extract configuration from TrainResults object.
Activity
  • The pull request is currently a work in progress, but is nearing completion.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces YAML configuration capabilities by adding OrderedCollections and YAML packages, and new functions for loading and saving hybrid model configurations. It also updates the TrainResults struct to include train_args, allowing for better tracking of training parameters. The changes are well-contained and improve the configurability and reproducibility of the models.

NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
NamedDims = "356022a1-0364-5f58-8944-0da4b18d706f"
OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"

Choose a reason for hiding this comment

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

medium

The OrderedCollections dependency has been added. Please ensure that this package is necessary for the YAML functionality and that its inclusion does not introduce any unnecessary overhead or conflicts with existing dependencies.

Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StyledStrings = "f489334b-da3d-4c2e-b8f0-e476e12c162b"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"

Choose a reason for hiding this comment

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

medium

The YAML dependency has been added. This is a core dependency for the new configuration features. Please confirm that the chosen version 0.4.16 is compatible with other packages and the Julia version.

NCDatasets = "0.14.8"
NamedDims = "1.2.3"
OptimizationOptimisers = "0.3.7"
OrderedCollections = "1.8.1"

Choose a reason for hiding this comment

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

medium

The OrderedCollections compatibility entry has been added. Ensure that the specified version range 1.8.1 is accurate and covers the required functionality without introducing breaking changes.

Static = "1.3.1"
Statistics = "1"
StyledStrings = "1.0.3, 1.11.0"
YAML = "0.4.16"

Choose a reason for hiding this comment

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

medium

The YAML compatibility entry has been added. Please verify that the version 0.4.16 is the correct and stable version to use for this project.

src/train.jl Outdated
st
best_epoch
best_loss
train_args

Choose a reason for hiding this comment

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

medium

Adding train_args to TrainResults is a good improvement for reproducibility, as it allows all training parameters to be stored with the results. This is a high-value addition for debugging and understanding past training runs.

src/train.jl Outdated
best_epoch,
best_agg_loss
best_agg_loss,
(; nepochs, batchsize, opt, patience, autodiff_backend, return_gradients, array_type, training_loss, loss_types, extra_loss, agg, train_from, random_seed, file_name, hybrid_name, return_model, monitor_names, folder_to_save, plotting, show_progress, yscale)

Choose a reason for hiding this comment

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

medium

The train_args tuple is being constructed with a comprehensive list of training parameters. This ensures that all relevant arguments are captured and stored in TrainResults, which is excellent for traceability and reproducibility. Consider if any other kwargs passed to train should also be explicitly captured here for completeness.

Comment on lines +10 to +16
function get_hybrid_config(hm::HybridModel)
hm_config = Dict{String,Any}()
for field in fieldnames(typeof(hm))
hm_config[string(field)] = getfield(hm, field)
end
return hm_config
end

Choose a reason for hiding this comment

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

medium

The get_hybrid_config function dynamically extracts all fields from a HybridModel instance into a dictionary. This is a flexible approach for serializing model configurations. Ensure that all fields are suitable for direct serialization to YAML.

Comment on lines +18 to +24
function get_train_config(train_args::TrainResults)
train_config = Dict{String,Any}()
for field in fieldnames(typeof(train_args))
train_config[string(field)] = getfield(train_args, field)
end
return train_config
end No newline at end of file

Choose a reason for hiding this comment

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

medium

Similar to get_hybrid_config, get_train_config extracts all fields from TrainResults. This is crucial for saving the complete training state and arguments, enhancing reproducibility. Consider if any fields within TrainResults might contain non-serializable objects that would cause issues when writing to YAML.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.84%. Comparing base (1df1aaa) to head (fbd0dff).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/config_yaml.jl 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #231      +/-   ##
==========================================
+ Coverage   50.31%   50.84%   +0.53%     
==========================================
  Files          27       28       +1     
  Lines        1932     1957      +25     
==========================================
+ Hits          972      995      +23     
- Misses        960      962       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lazarusA lazarusA merged commit 54cf4d1 into main Feb 19, 2026
14 checks passed
@lazarusA lazarusA deleted the la/yaml_config branch March 6, 2026 07:59
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.

setup YAML config workflow

1 participant