Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

1.2 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0

import { usePlatformStore } from "@/config/env";
import {
  type HostClass,
  classifyHost,
} from "@/features/model-picker/components/model-selector/host-artifact-policy";
import { useMemo } from "react";
import { useGpuInfo } from "./use-gpu-info";

export function useHostClass(): HostClass {
  const gpu = useGpuInfo();
  const deviceType = usePlatformStore((s) => s.deviceType);
  return useMemo(
    () =>
      classifyHost({
        deviceType,
        deviceBackend: gpu.backend,
        budgetKnown: gpu.budgetKnown,
        denseQuantSupported: gpu.denseQuantSupported,
      }),
    [deviceType, gpu.backend, gpu.budgetKnown, gpu.denseQuantSupported],
  );
}

export function useNvfp4Diffusion(): boolean {
  return useGpuInfo().nvfp4Diffusion;
}

/** Whether /api/system answered, so a false useNvfp4Diffusion() is not just the unloaded default. */
export function useNvfp4DiffusionKnown(): boolean {
  return useGpuInfo().budgetKnown;
}

export function useDenseQuantSchemes(): readonly string[] {
  return useGpuInfo().denseQuantSchemes;
}