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

Separate config and observation on model execute signature #377

Closed

Conversation

demakoff
Copy link

@demakoff demakoff commented Jan 8, 2024

Types of changes

  • Enhancement (project structure, spelling, grammar, formatting)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

A description of the changes proposed in the Pull Request

@demakoff demakoff changed the title Separate config Separate config and observation on model execute signature Jan 8, 2024
functional-unit-duration: 1
functional-unit-time: minutes
functional-unit: requests
carbon: 0.0013944444444444442
Copy link
Author

Choose a reason for hiding this comment

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

carbon was added because of new logic on sci model. Looks like sci example was just a bit outdated. Anyway not related to my changes.

@@ -30,7 +31,5 @@ graph:
operational-carbon: 5
embodied-carbon: 0.02
requests: 100
functional-unit-duration: 1
Copy link
Author

Choose a reason for hiding this comment

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

Here is exactly an idea of the change, to remove config props pollution on outputs.

@@ -306,6 +306,123 @@ describe('lib/supercomputer: ', () => {
);
});

it('passes output from earlier executed model to the later ones as an input', async () => {
Copy link
Author

Choose a reason for hiding this comment

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

IMO having all the test related entities and logic inside of the test itself increases readability and maintainability.

@@ -112,10 +111,10 @@ export class ModelsUniverse {

const Model = await this.handModel(model, path);

const callback = async (graphOptions: GraphOptions) => {
Copy link
Author

Choose a reason for hiding this comment

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

It was just not relevant to the data comes here...

/**
* Flattens config entries.
*/
private flattenConfigValues(config: Config) {
Copy link
Author

Choose a reason for hiding this comment

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

It seemed a pretty dangerous thing (flattening of config) because would lead to issues once two models will have the same config prop name. With the updated implementation all model configs are absolutely separated from each other.

const configValues = this.flattenConfigValues(config);
const nestedConfigValues = this.flattenConfigValues(nestedConfig);

return inputs.map((input: any) => ({
Copy link
Author

Choose a reason for hiding this comment

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

Exactly here we put everything (observations and all the configs) in one box.

specificInputs,
config,
childrenConfig
const outputs = await pipeline.reduce(
Copy link
Author

Choose a reason for hiding this comment

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

Observatory class was replaced with this reduce function.
I believe now it has less complexity and more readability.

);
await supercomputer.compute();

expect(modelsHandbook.getInitializedModel).toHaveBeenNthCalledWith(
Copy link
Author

Choose a reason for hiding this comment

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

Additionally, we will check that the model is initialized with a proper config.

@jmcook1186
Copy link
Contributor

Hi @demakoff , thanks for looking at this. We will take longer than usual to review this because our first task for @narekhovhannisyan and I is to review @jawache's specification, then we will focus on reviewing the implementation.

Then, we are going to be very careful about reviewing this because it will necessarily introduce a lot of breaking changes across several repositories, so we only want to do it once, and we want all the necessary fixes in place first.

@demakoff
Copy link
Author

demakoff commented Jan 8, 2024

Hi @demakoff , thanks for looking at this. We will take longer than usual to review this because our first task for @narekhovhannisyan and I is to review @jawache's specification, then we will focus on reviewing the implementation.

Then, we are going to be very careful about reviewing this because it will necessarily introduce a lot of breaking changes across several repositories, so we only want to do it once, and we want all the necessary fixes in place first.

Sure, I understand, no probs at all. Let me know if I can assist in any way...

@jmcook1186
Copy link
Contributor

HI - thanks for the work on this but we decided to go in another direction and refactor the whole codebase into a more functional style. Closing this out. Thanks!

@jmcook1186 jmcook1186 closed this Feb 15, 2024
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