INNER CODE UNIT · Python

ensure

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

def ensure(path: str) -> str:
    """Create a fixture directory and return it.

    Only ever call this on a path from this module. Calling makedirs on a hand-built
    path is what lets a generator silently populate a tree nothing reads.
    """
    os.makedirs(path, exist_ok=True)
    return path


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")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…