Load native binary for a specific GPU variant
Loads the appropriate platform-specific binary with automatic fallback:
Use this for advanced scenarios where you need direct binary access or want to check variant availability before creating a context.
Optional
GPU variant: 'cuda', 'vulkan', or undefined for CPU
Native binary module with createContext method
Error if no binary available for the current platform
// Load default (CPU) binaryconst binary = loadBinary();// Load CUDA binary (falls back to CPU if unavailable)const binary = loadBinary('cuda');// Create context from loaded binaryconst ctx = await binary.createContext({ modelPath: './model.gguf' }); Copy
// Load default (CPU) binaryconst binary = loadBinary();// Load CUDA binary (falls back to CPU if unavailable)const binary = loadBinary('cuda');// Create context from loaded binaryconst ctx = await binary.createContext({ modelPath: './model.gguf' });
Load native binary for a specific GPU variant
Loads the appropriate platform-specific binary with automatic fallback:
Use this for advanced scenarios where you need direct binary access or want to check variant availability before creating a context.