opensi·si

Public API of @huggingface/transformers. Everything re-exported from

Index

Public API of @huggingface/transformers. Everything re-exported from this file is considered stable — other imports are internal and may change.

Start here

  • pipeline() — the one-call entry point for every task.
  • Environment — env fields and LogLevel enum.

Model loading

  • Pipelines — task-specific pipeline classes (TextGenerationPipeline, etc.).
  • Models — AutoModel* classes (one per task).
  • Tokenizers — AutoTokenizer, chat templates, Message.
  • Processors — AutoProcessor, AutoImageProcessor, AutoFeatureExtractor.
  • Configs — AutoConfig / PretrainedConfig.

Generation

  • Generation config — sampling and beam-search parameters.
  • Generation parameters — full shape of generate() arguments.
  • Logits processors — modify next-token probabilities.
  • Stopping criteria — control when generation halts.
  • Streamers — receive tokens as they're produced.

Data types and I/O

  • Tensors — Tensor, shape ops, math, I/O.
  • Images — RawImage, load_image().
  • Audio — RawAudio, load_audio().
  • Video — RawVideo, RawVideoFrame, load_video() (experimental).

Utilities

  • Hub options — shared from_pretrained() option shapes.
  • Maths — softmax, cos_sim, typed-array helpers.
  • Model registry — inspect or clear the model cache.
  • Random — seedable MT19937 PRNG matching Python's random.

Type Definitions

DeviceType

Type: keyof typeof DEVICE_TYPES

DataType

Type: keyof typeof DATA_TYPES

Source and license

Source: Transformers.js documentation, adapted for this site. Licensing and attribution follow the terms of the upstream project.