-
Notifications
You must be signed in to change notification settings - Fork 9
[Do not merge] feat(RHOAIENG-33971): Add LM-Eval inline provider and unit tests #60
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
Open
christinaexyou
wants to merge
1
commit into
trustyai-explainability:main
Choose a base branch
from
christinaexyou:RHOAIENG-33971-lmeval-inline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| module: llama_stack_provider_lmeval.inline | ||
| config_class: llama_stack_provider_lmeval.config.LMEvalEvalProviderConfig | ||
| pip_packages: ["lm-eval"] | ||
| api_dependencies: ["inference", "files"] | ||
| optional_api_dependencies: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| version: "2" | ||
| image_name: trustyai-lmeval | ||
| apis: | ||
| - inference | ||
| - eval | ||
| - files | ||
| providers: | ||
| inference: | ||
| - provider_id: vllm | ||
| provider_type: remote::vllm | ||
| config: | ||
| url: ${env.VLLM_URL:=http://localhost:8080/v1} | ||
| max_tokens: ${env.VLLM_MAX_TOKENS:=4096} | ||
| api_token: ${env.VLLM_API_TOKEN:=fake} | ||
| tls_verify: ${env.VLLM_TLS_VERIFY:=false} | ||
| eval: | ||
| - provider_id: trustyai_lmeval | ||
| provider_type: inline::trustyai_lmeval | ||
| config: | ||
| base_url: ${env.BASE_URL:=http://localhost:8321/v1} | ||
| use_k8s: ${env.USE_K8S:=false} | ||
| files: | ||
| - provider_id: meta-reference-files | ||
| provider_type: inline::localfs | ||
| config: | ||
| storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/trustyai-lmeval/files} | ||
| metadata_store: | ||
| type: sqlite | ||
| db_path: ${env.METADATA_STORE_DB_PATH:=~/.llama/distributions/trustyai-lmeval}/registry.db} | ||
| external_providers_dir: ./providers.d | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +0,0 @@ | ||
| import logging | ||
|
|
||
| from llama_stack.apis.datatypes import Api | ||
| from llama_stack.providers.datatypes import ProviderSpec | ||
|
|
||
| from .config import LMEvalEvalProviderConfig | ||
| from .lmeval import LMEval | ||
| from .provider import get_provider_spec | ||
|
|
||
| # Set up logging | ||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| async def get_adapter_impl( | ||
| config: LMEvalEvalProviderConfig, | ||
| deps: dict[Api, ProviderSpec] | None = None, | ||
| ) -> LMEval: | ||
| """Get an LMEval implementation from the configuration. | ||
|
|
||
| Args: | ||
| config: LMEval configuration | ||
| deps: Optional dependencies for testing/injection | ||
|
|
||
| Returns: | ||
| Configured LMEval implementation | ||
|
|
||
| Raises: | ||
| Exception: If configuration is invalid | ||
| """ | ||
| try: | ||
| if deps is None: | ||
| deps = {} | ||
|
|
||
| # Extract base_url from config if available | ||
| base_url = None | ||
| if hasattr(config, "model_args") and config.model_args: | ||
| for arg in config.model_args: | ||
| if arg.get("name") == "base_url": | ||
| base_url = arg.get("value") | ||
| logger.debug(f"Using base_url from config: {base_url}") | ||
| break | ||
|
|
||
| return LMEval(config=config) | ||
| except Exception as e: | ||
| raise Exception(f"Failed to create LMEval implementation: {str(e)}") from e | ||
|
|
||
|
|
||
| __all__ = [ | ||
| # Factory methods | ||
| "get_adapter_impl", | ||
| # Configurations | ||
| "LMEval", | ||
| "get_provider_spec", | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| """LMEval Inline Eval Llama Stack provider.""" | ||
|
|
||
| import logging | ||
|
|
||
| from llama_stack.apis.datatypes import Api | ||
| from llama_stack.providers.datatypes import ProviderSpec | ||
|
|
||
| from llama_stack_provider_lmeval.config import LMEvalEvalProviderConfig | ||
|
|
||
| from .lmeval import LMEvalInline | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| async def get_provider_impl( | ||
| config: LMEvalEvalProviderConfig, | ||
| deps: dict[Api, ProviderSpec] | None = None, | ||
| ) -> LMEvalInline: | ||
| """Get an inline Eval implementation from the configuration. | ||
|
|
||
| Args: | ||
| config: LMEvalEvalProviderConfig | ||
| deps: Optional[dict[Api, Any]] = None - can be ProviderSpec or API instances | ||
|
|
||
| Returns: | ||
| Configured LMEval Inline implementation | ||
|
|
||
| Raises: | ||
| Exception: If configuration is invalid | ||
| """ | ||
| try: | ||
| if deps is None: | ||
| deps = {} | ||
|
|
||
| # Extract base_url from config if available | ||
| base_url = None | ||
| if hasattr(config, "model_args") and config.model_args: | ||
| for arg in config.model_args: | ||
| if arg.get("name") == "base_url": | ||
| base_url = arg.get("value") | ||
| logger.debug("Using base_url from config: %s", base_url) | ||
| break | ||
|
|
||
| return LMEvalInline(config=config, deps=deps) | ||
| except Exception as e: | ||
| raise RuntimeError(f"Failed to create LMEval implementation: {str(e)}") from e | ||
|
|
||
|
|
||
| __all__ = [ | ||
| "get_provider_impl", | ||
| "LMEvalInline", | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: shall we start using
module:way of specifying the provider as lls-core is moving away fromexternal_providers_dir?