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

Read embeddings config during bootstrap/load and instance creation #387

Merged
merged 3 commits into from
Sep 5, 2024

Conversation

markstur
Copy link
Contributor

@markstur markstur commented Sep 4, 2024

When CONFIG_FILES setting is not used, the caikit-nlp config values are not read from environment variables unless caikit has already imported caikit-nlp. The code was loading the embedding config too soon in this case so the env vars were ignored.

This commit reads the config during bootstrap and load for settings that are needed at bootstrap/load time and also reads config during module init for runtime settings.

In addition:

  • bootstrap() kwargs can be used (e.g. for trust_remote_code param)
  • load() was made to work with model_path as ModuleConfig (because str is deprecated and spammy)
  • utils/env_val_to_int was removed because the caikit config handles this well
  • utils/env_val_to_bool was NOT YET removed because the caikit config does not handle this quite as well

When CONFIG_FILES setting is not used, the caikit-nlp config values
are not read from environment variables unless caikit has already
imported caikit-nlp.  The code was loading the embedding config too
soon in this case so the env vars were ignored.

This commit reads the config during bootstrap and load for settings that are needed
at bootstrap/load time and also reads config during module init for runtime settings.

In addition:

* bootstrap() kwargs can be used (e.g. for trust_remote_code param)
* load() was made to work with model_path as ModuleConfig (because str is deprecated and spammy)
* utils/env_val_to_int was removed because the caikit config handles this well
* utils/env_val_to_bool was NOT YET removed because the caikit config does not handle this quite as well

Signed-off-by: Mark Sturdevant <[email protected]>
@markstur markstur force-pushed the embedding_get_config branch from 91d83be to 272eeb1 Compare September 4, 2024 18:14
assert 1 == conf.get("true", expected_default)
assert 1 == int(conf.get("true", expected_default))

assert "oh-oh" == conf.get("non_int", 123) # default not used (got "uh-oh")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: oh-oh with the given example instead of uh-oh in comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clarified with "non int str"

ModuleConfig should always have a model_path, but this check will
make the error better if this gets called with an empty ModuleConfig.

Signed-off-by: Mark Sturdevant <[email protected]>
Signed-off-by: Mark Sturdevant <[email protected]>
Copy link
Collaborator

@evaline-ju evaline-ju left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for the updates!

@evaline-ju evaline-ju merged commit fbe5637 into caikit:main Sep 5, 2024
5 checks passed
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