benchmark_profiles.py 738 B

123456789101112131415161718192021222324
  1. from fastapi import APIRouter
  2. from gpustack.server.deps import CurrentUserDep
  3. from gpustack.utils.compat_importlib import pkg_resources
  4. import yaml
  5. router = APIRouter()
  6. @router.get("/default-config")
  7. async def get_default_profiles_config(user: CurrentUserDep):
  8. builtin_profiles_config_path = get_builtin_profiles_config_file_path()
  9. with open(builtin_profiles_config_path, "r") as f:
  10. return yaml.safe_load(f)
  11. def get_builtin_profiles_config_file_path() -> str:
  12. profiles_config_file_name = "profiles_config.yaml"
  13. profiles_config_file_path = str(
  14. pkg_resources.files("gpustack.assets.profiles_config").joinpath(
  15. profiles_config_file_name
  16. )
  17. )
  18. return profiles_config_file_path