INNER CODE UNIT · Python

hf_dir

FareedKhan-dev/kimi-k3-in-c · tools/_paths.py:57

def hf_dir() -> str | None:
    """Locate the released Kimi K3 files (tiktoken.model, config.json, ...).

    Returns the first directory that contains tiktoken.model, or None. Set K3_HF_DIR to
    skip the search. Returning None rather than raising is deliberate: several callers
    can do useful work without the model files and should say so specifically.
    """
    override = os.environ.get("K3_HF_DIR")
    if override:
        return override if os.path.isfile(os.path.join(override, "tiktoken.model")) else None

    home = os.path.expanduser("~")
    candidates = [
        os.path.join(ROOT, "kimi_k3_hf", "files"),
        os.path.join(os.path.dirname(ROOT), "kimi_k3_hf", "files"),
        os.path.join(home, "k3model"),
        os.path.join(home, "k3", "hf"),
        os.path.join(home, "k3c", "hf_files"),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…