Skip to content

Function: readGgufFileInfo()

ts
function readGgufFileInfo(pathOrUri: string, options: {
  readTensorInfo: true;
  sourceType: "network" | "filesystem";
  ignoreKeys: [];
  logWarnings: true;
  fetchRetryOptions: ggufDefaultFetchRetryOptions;
  fetchHeaders: {};
  spliceSplitFiles: true;
  signal: AbortSignal;
  tokens: ModelFileAccessTokens;
 }): Promise<GgufFileInfo>

Read a GGUF file and return its metadata and tensor info (unless readTensorInfo is set to false). Only the parts of the file required for the metadata and tensor info are read.

Parameters

ParameterTypeDescription
pathOrUristring
optionsobject
options.readTensorInfo?booleanWhether to read the tensor info from the file's header. Defaults to true.
options.sourceType?"network" | "filesystem"Set to a specific value to force it to only use that source type. By default, it detects whether the path is a network URL or a filesystem path and uses the appropriate reader accordingly.
options.ignoreKeys?string[]Metadata keys to ignore when parsing the metadata. For example, ["tokenizer.ggml.tokens"]
options.logWarnings?booleanWhether to log warnings Defaults to true.
options.fetchRetryOptions?OptionsRelevant only when fetching from a network
options.fetchHeaders?Record<string, string>Relevant only when fetching from a network
options.spliceSplitFiles?booleanWhen split files are detected, read the metadata of the first file and splice the tensor info from all the parts. Defaults to true.
options.signal?AbortSignal-
options.tokens?ModelFileAccessTokens-

Returns

Promise<GgufFileInfo>

Defined in

gguf/readGgufFileInfo.ts:20