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

Add RAI checker for installed backends #137

Merged
merged 6 commits into from
Feb 8, 2022

Conversation

al-rigazzi
Copy link
Collaborator

This PR mainly adds CONFIG.get_installed_backends, a property returning a list of installed Redis AI backends.

This is used e.g. in tests, to check whether the corresponding test should be run. This also helps distinguishing between tests we cannot run because there is no backend, and tests we cannot run because the library is not installed (e.g. test_freeze_model which does not need Redis AI).

Notice that for backend tests, we also check whether the module is (still) available, to prevent cases in which a user might have built RedisAI in another env.

@Spartee
Copy link
Contributor

Spartee commented Feb 4, 2022

Thanks for catching this and taking care of it. My main thought on this is: if it's only used in tests... should it just be in conftest.py?

I suppose it might be nice to have this functionality internally. I can think of at least one use case which is to be able to discern wether a user has built any backends at all when initializing an Orchestrator. Can you think of others I'm missing?

If we do want it internally, it's not necessarily a configuration option as much as it is a helper function. smartsim/_core/util/helpers.py might be a better location. That is unless we want the user to be able to pass in the locations of the backends at some point... This is an option RedisAI supports with BACKENDSPATH. I think if we do leave it in config, we should make sure that's the route we want to go and if so, make a note about it in the code.

I'm personally leaning towards a helper function. thoughts??

Copy link
Contributor

@Spartee Spartee left a comment

Choose a reason for hiding this comment

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

See comment above

@al-rigazzi
Copy link
Collaborator Author

al-rigazzi commented Feb 4, 2022

@Spartee Yeah, I think we can move it to smartsim/_core/util/helpers.py and promote it to function (instead of it being a property of CONFIG as it is now). Still, it could make sense to support BACKENDSPATH anyhow, what do you think?

Copy link
Member

@MattToast MattToast left a comment

Choose a reason for hiding this comment

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

Quick fix on unused import and typo-ed variable name that i think is causing tests to error. Otherwise lgtm!!

try:
from tensorflow import keras

from smartsim.tf import freeze_model
except (ImportError, SmartSimError):
should_run = False
tf_availavble = False
Copy link
Member

Choose a reason for hiding this comment

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

tf_available

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, fixed

@@ -27,6 +27,7 @@
import os
from functools import lru_cache
from pathlib import Path
from typing import List
Copy link
Member

Choose a reason for hiding this comment

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

Remove unused typing module

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed

This PR adds data loaders which can be used with TensorFlow
and PyTorch to train (or fit) a model. The loaders
get the data from the Orchestrator and can be used
when training in a distributed fashion (e.g with Horovod).

[ committed by @al-rigazzi ]
[ reviewed by @Spartee and @MattToast ]
Copy link
Contributor

@Spartee Spartee left a comment

Choose a reason for hiding this comment

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

LGTM. Eventually we want to add this to the CLI. maybe a `smart build --check-installed`` command? Either way, glad to have this functionality.

@al-rigazzi al-rigazzi merged commit 103d53e into CrayLabs:develop Feb 8, 2022
@al-rigazzi al-rigazzi deleted the rai-module-checker branch February 8, 2022 21:22
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