MCPcopy Create free account
hub / github.com/huggingface/transformers.js / getModelText

Function getModelText

packages/transformers/src/utils/hub.js:549–557  ·  view source on GitHub ↗
(modelPath, fileName, fatal = true, options = {})

Source from the content-addressed store, hash-verified

547 * @throws Will throw an error if the file is not found and `fatal` is true.
548 */
549export async function getModelText(modelPath, fileName, fatal = true, options = {}) {
550 const buffer = await getModelFile(modelPath, fileName, fatal, options, false);
551 if (buffer === null) {
552 return null;
553 }
554
555 const decoder = new TextDecoder('utf-8');
556 return decoder.decode(/** @type {Uint8Array} */ (buffer));
557}
558
559/**
560 * Fetches a JSON file from a given path and file name.

Callers 3

from_pretrainedMethod · 0.90
from_pretrainedMethod · 0.90
getModelJSONFunction · 0.85

Calls 2

getModelFileFunction · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected