mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-01-28 09:21:59 -05:00
Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> Signed-off-by: paperspace <29749331+aarnphm@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
25 lines
824 B
Python
25 lines
824 B
Python
"""Utilities function for OpenLLM.
|
|
|
|
User can import these function for convenience, but
|
|
we won't ensure backward compatibility for these functions. So use with caution.
|
|
"""
|
|
from __future__ import annotations
|
|
import typing as t
|
|
|
|
import openllm_core
|
|
|
|
if t.TYPE_CHECKING:
|
|
import openllm
|
|
|
|
def generate_labels(llm: openllm.LLM[t.Any, t.Any]) -> dict[str, t.Any]:
|
|
return {'backend': llm.__llm_backend__, 'framework': 'openllm', 'model_name': llm.config['model_name'], 'architecture': llm.config['architecture'], 'serialisation': llm._serialisation}
|
|
|
|
__all__ = ['generate_labels']
|
|
|
|
def __dir__() -> t.Sequence[str]:
|
|
return sorted(__all__)
|
|
|
|
def __getattr__(it: str) -> t.Any:
|
|
if hasattr(openllm_core.utils, it): return getattr(openllm_core.utils, it)
|
|
else: raise AttributeError(f'module {__name__} has no attribute {it}')
|