opencode-skills-antigravity 1.0.39 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +10 -1
  2. package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
  3. package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
  4. package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
  5. package/bundled-skills/docs/maintainers/security-findings-triage-2026-03-29-refresh.csv +34 -0
  6. package/bundled-skills/docs/maintainers/security-findings-triage-2026-03-29-refresh.md +2 -0
  7. package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
  8. package/bundled-skills/docs/sources/sources.md +2 -2
  9. package/bundled-skills/docs/users/bundles.md +1 -1
  10. package/bundled-skills/docs/users/claude-code-skills.md +1 -1
  11. package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
  12. package/bundled-skills/docs/users/getting-started.md +1 -1
  13. package/bundled-skills/docs/users/kiro-integration.md +1 -1
  14. package/bundled-skills/docs/users/usage.md +4 -4
  15. package/bundled-skills/docs/users/visual-guide.md +4 -4
  16. package/bundled-skills/hugging-face-cli/SKILL.md +192 -195
  17. package/bundled-skills/hugging-face-community-evals/SKILL.md +213 -0
  18. package/bundled-skills/hugging-face-community-evals/examples/.env.example +3 -0
  19. package/bundled-skills/hugging-face-community-evals/examples/USAGE_EXAMPLES.md +101 -0
  20. package/bundled-skills/hugging-face-community-evals/scripts/inspect_eval_uv.py +104 -0
  21. package/bundled-skills/hugging-face-community-evals/scripts/inspect_vllm_uv.py +306 -0
  22. package/bundled-skills/hugging-face-community-evals/scripts/lighteval_vllm_uv.py +297 -0
  23. package/bundled-skills/hugging-face-dataset-viewer/SKILL.md +120 -120
  24. package/bundled-skills/hugging-face-gradio/SKILL.md +304 -0
  25. package/bundled-skills/hugging-face-gradio/examples.md +613 -0
  26. package/bundled-skills/hugging-face-jobs/SKILL.md +25 -18
  27. package/bundled-skills/hugging-face-jobs/index.html +216 -0
  28. package/bundled-skills/hugging-face-jobs/references/hardware_guide.md +336 -0
  29. package/bundled-skills/hugging-face-jobs/references/hub_saving.md +352 -0
  30. package/bundled-skills/hugging-face-jobs/references/token_usage.md +570 -0
  31. package/bundled-skills/hugging-face-jobs/references/troubleshooting.md +475 -0
  32. package/bundled-skills/hugging-face-jobs/scripts/cot-self-instruct.py +718 -0
  33. package/bundled-skills/hugging-face-jobs/scripts/finepdfs-stats.py +546 -0
  34. package/bundled-skills/hugging-face-jobs/scripts/generate-responses.py +587 -0
  35. package/bundled-skills/hugging-face-model-trainer/SKILL.md +11 -12
  36. package/bundled-skills/hugging-face-model-trainer/references/gguf_conversion.md +296 -0
  37. package/bundled-skills/hugging-face-model-trainer/references/hardware_guide.md +283 -0
  38. package/bundled-skills/hugging-face-model-trainer/references/hub_saving.md +364 -0
  39. package/bundled-skills/hugging-face-model-trainer/references/local_training_macos.md +231 -0
  40. package/bundled-skills/hugging-face-model-trainer/references/reliability_principles.md +371 -0
  41. package/bundled-skills/hugging-face-model-trainer/references/trackio_guide.md +189 -0
  42. package/bundled-skills/hugging-face-model-trainer/references/training_methods.md +150 -0
  43. package/bundled-skills/hugging-face-model-trainer/references/training_patterns.md +203 -0
  44. package/bundled-skills/hugging-face-model-trainer/references/troubleshooting.md +282 -0
  45. package/bundled-skills/hugging-face-model-trainer/references/unsloth.md +313 -0
  46. package/bundled-skills/hugging-face-model-trainer/scripts/convert_to_gguf.py +424 -0
  47. package/bundled-skills/hugging-face-model-trainer/scripts/dataset_inspector.py +417 -0
  48. package/bundled-skills/hugging-face-model-trainer/scripts/estimate_cost.py +150 -0
  49. package/bundled-skills/hugging-face-model-trainer/scripts/train_dpo_example.py +106 -0
  50. package/bundled-skills/hugging-face-model-trainer/scripts/train_grpo_example.py +89 -0
  51. package/bundled-skills/hugging-face-model-trainer/scripts/train_sft_example.py +122 -0
  52. package/bundled-skills/hugging-face-model-trainer/scripts/unsloth_sft_example.py +512 -0
  53. package/bundled-skills/hugging-face-paper-publisher/SKILL.md +11 -4
  54. package/bundled-skills/hugging-face-paper-publisher/examples/example_usage.md +326 -0
  55. package/bundled-skills/hugging-face-paper-publisher/references/quick_reference.md +216 -0
  56. package/bundled-skills/hugging-face-paper-publisher/scripts/paper_manager.py +606 -0
  57. package/bundled-skills/hugging-face-paper-publisher/templates/arxiv.md +299 -0
  58. package/bundled-skills/hugging-face-paper-publisher/templates/ml-report.md +358 -0
  59. package/bundled-skills/hugging-face-paper-publisher/templates/modern.md +319 -0
  60. package/bundled-skills/hugging-face-paper-publisher/templates/standard.md +201 -0
  61. package/bundled-skills/hugging-face-papers/SKILL.md +241 -0
  62. package/bundled-skills/hugging-face-trackio/.claude-plugin/plugin.json +19 -0
  63. package/bundled-skills/hugging-face-trackio/SKILL.md +117 -0
  64. package/bundled-skills/hugging-face-trackio/references/alerts.md +196 -0
  65. package/bundled-skills/hugging-face-trackio/references/logging_metrics.md +206 -0
  66. package/bundled-skills/hugging-face-trackio/references/retrieving_metrics.md +251 -0
  67. package/bundled-skills/hugging-face-vision-trainer/SKILL.md +595 -0
  68. package/bundled-skills/hugging-face-vision-trainer/references/finetune_sam2_trainer.md +254 -0
  69. package/bundled-skills/hugging-face-vision-trainer/references/hub_saving.md +618 -0
  70. package/bundled-skills/hugging-face-vision-trainer/references/image_classification_training_notebook.md +279 -0
  71. package/bundled-skills/hugging-face-vision-trainer/references/object_detection_training_notebook.md +700 -0
  72. package/bundled-skills/hugging-face-vision-trainer/references/reliability_principles.md +310 -0
  73. package/bundled-skills/hugging-face-vision-trainer/references/timm_trainer.md +91 -0
  74. package/bundled-skills/hugging-face-vision-trainer/scripts/dataset_inspector.py +814 -0
  75. package/bundled-skills/hugging-face-vision-trainer/scripts/estimate_cost.py +217 -0
  76. package/bundled-skills/hugging-face-vision-trainer/scripts/image_classification_training.py +383 -0
  77. package/bundled-skills/hugging-face-vision-trainer/scripts/object_detection_training.py +710 -0
  78. package/bundled-skills/hugging-face-vision-trainer/scripts/sam_segmentation_training.py +382 -0
  79. package/bundled-skills/jq/SKILL.md +273 -0
  80. package/bundled-skills/odoo-edi-connector/SKILL.md +32 -10
  81. package/bundled-skills/odoo-woocommerce-bridge/SKILL.md +9 -5
  82. package/bundled-skills/tmux/SKILL.md +370 -0
  83. package/bundled-skills/transformers-js/SKILL.md +639 -0
  84. package/bundled-skills/transformers-js/references/CACHE.md +339 -0
  85. package/bundled-skills/transformers-js/references/CONFIGURATION.md +390 -0
  86. package/bundled-skills/transformers-js/references/EXAMPLES.md +605 -0
  87. package/bundled-skills/transformers-js/references/MODEL_ARCHITECTURES.md +167 -0
  88. package/bundled-skills/transformers-js/references/PIPELINE_OPTIONS.md +545 -0
  89. package/bundled-skills/transformers-js/references/TEXT_GENERATION.md +315 -0
  90. package/bundled-skills/viboscope/SKILL.md +64 -0
  91. package/package.json +1 -1
@@ -0,0 +1,167 @@
1
+ # Supported Model Architectures
2
+
3
+ This document lists the model architectures currently supported by Transformers.js.
4
+
5
+ ## Natural Language Processing
6
+
7
+ ### Text Models
8
+ - **ALBERT** - A Lite BERT for Self-supervised Learning
9
+ - **BERT** - Bidirectional Encoder Representations from Transformers
10
+ - **CamemBERT** - French language model based on RoBERTa
11
+ - **CodeGen** - Code generation models
12
+ - **CodeLlama** - Code-focused Llama models
13
+ - **Cohere** - Command-R models for RAG
14
+ - **DeBERTa** - Decoding-enhanced BERT with Disentangled Attention
15
+ - **DeBERTa-v2** - Improved version of DeBERTa
16
+ - **DistilBERT** - Distilled version of BERT (smaller, faster)
17
+ - **GPT-2** - Generative Pre-trained Transformer 2
18
+ - **GPT-Neo** - Open source GPT-3 alternative
19
+ - **GPT-NeoX** - Larger GPT-Neo models
20
+ - **LLaMA** - Large Language Model Meta AI
21
+ - **Mistral** - Mistral AI language models
22
+ - **MPNet** - Masked and Permuted Pre-training
23
+ - **MobileBERT** - Compressed BERT for mobile devices
24
+ - **RoBERTa** - Robustly Optimized BERT
25
+ - **T5** - Text-to-Text Transfer Transformer
26
+ - **XLM-RoBERTa** - Multilingual RoBERTa
27
+
28
+ ### Sequence-to-Sequence
29
+ - **BART** - Denoising Sequence-to-Sequence Pre-training
30
+ - **Blenderbot** - Open-domain chatbot
31
+ - **BlenderbotSmall** - Smaller Blenderbot variant
32
+ - **M2M100** - Many-to-Many multilingual translation
33
+ - **MarianMT** - Neural machine translation
34
+ - **mBART** - Multilingual BART
35
+ - **NLLB** - No Language Left Behind (200 languages)
36
+ - **Pegasus** - Pre-training with extracted gap-sentences
37
+
38
+ ## Computer Vision
39
+
40
+ ### Image Classification
41
+ - **BEiT** - BERT Pre-Training of Image Transformers
42
+ - **ConvNeXT** - Modern ConvNet architecture
43
+ - **ConvNeXTV2** - Improved ConvNeXT
44
+ - **DeiT** - Data-efficient Image Transformers
45
+ - **DINOv2** - Self-supervised Vision Transformer
46
+ - **DINOv3** - Latest DINO iteration
47
+ - **EfficientNet** - Efficient convolutional networks
48
+ - **MobileNet** - Lightweight models for mobile
49
+ - **MobileViT** - Mobile Vision Transformer
50
+ - **ResNet** - Residual Networks
51
+ - **SegFormer** - Semantic segmentation transformer
52
+ - **Swin** - Shifted Window Transformer
53
+ - **ViT** - Vision Transformer
54
+
55
+ ### Object Detection
56
+ - **DETR** - Detection Transformer
57
+ - **D-FINE** - Fine-grained Distribution Refinement for object detection
58
+ - **DINO** - DETR with Improved deNoising anchOr boxes
59
+ - **Grounding DINO** - Open-set object detection
60
+ - **YOLOS** - You Only Look at One Sequence
61
+
62
+ ### Segmentation
63
+ - **CLIPSeg** - Image segmentation with text prompts
64
+ - **Mask2Former** - Universal image segmentation
65
+ - **SAM** - Segment Anything Model
66
+ - **EdgeTAM** - On-Device Track Anything Model
67
+
68
+ ### Depth & Pose
69
+ - **DPT** - Dense Prediction Transformer
70
+ - **Depth Anything** - Monocular depth estimation
71
+ - **Depth Pro** - Sharp monocular metric depth
72
+ - **GLPN** - Global-Local Path Networks for depth
73
+
74
+ ## Audio
75
+
76
+ ### Speech Recognition
77
+ - **Wav2Vec2** - Self-supervised speech representations
78
+ - **Whisper** - Robust speech recognition (multilingual)
79
+ - **HuBERT** - Self-supervised speech representation learning
80
+
81
+ ### Audio Processing
82
+ - **Audio Spectrogram Transformer** - Audio classification
83
+ - **DAC** - Descript Audio Codec
84
+
85
+ ### Text-to-Speech
86
+ - **SpeechT5** - Unified speech and text pre-training
87
+ - **VITS** - Conditional Variational Autoencoder with adversarial learning
88
+
89
+ ## Multimodal
90
+
91
+ ### Vision-Language
92
+ - **CLIP** - Contrastive Language-Image Pre-training
93
+ - **Chinese-CLIP** - Chinese version of CLIP
94
+ - **ALIGN** - Large-scale noisy image-text pairs
95
+ - **BLIP** - Bootstrapping Language-Image Pre-training
96
+ - **Florence-2** - Unified vision foundation model
97
+ - **LLaVA** - Large Language and Vision Assistant
98
+ - **Moondream** - Tiny vision-language model
99
+
100
+ ### Document Understanding
101
+ - **DiT** - Document Image Transformer
102
+ - **Donut** - OCR-free Document Understanding
103
+ - **LayoutLM** - Pre-training for document understanding
104
+ - **TrOCR** - Transformer-based OCR
105
+
106
+ ### Audio-Language
107
+ - **CLAP** - Contrastive Language-Audio Pre-training
108
+
109
+ ## Embeddings & Similarity
110
+
111
+ - **Sentence Transformers** - Sentence embeddings
112
+ - **all-MiniLM** - Efficient sentence embeddings
113
+ - **all-mpnet-base** - High-quality sentence embeddings
114
+ - **E5** - Text embeddings by Microsoft
115
+ - **BGE** - General embedding models
116
+ - **nomic-embed** - Long context embeddings
117
+
118
+ ## Specialized Models
119
+
120
+ ### Code
121
+ - **CodeBERT** - Pre-trained model for code
122
+ - **GraphCodeBERT** - Code structure understanding
123
+ - **StarCoder** - Code generation
124
+
125
+ ### Scientific
126
+ - **SciBERT** - Scientific text
127
+ - **BioBERT** - Biomedical text
128
+
129
+ ### Retrieval
130
+ - **ColBERT** - Contextualized late interaction over BERT
131
+ - **DPR** - Dense Passage Retrieval
132
+
133
+ ## Model Selection Tips
134
+
135
+ ### For Text Tasks
136
+ - **Small & Fast**: DistilBERT, MobileBERT
137
+ - **Balanced**: BERT-base, RoBERTa-base
138
+ - **High Accuracy**: RoBERTa-large, DeBERTa-v3-large
139
+ - **Multilingual**: XLM-RoBERTa, mBERT
140
+
141
+ ### For Vision Tasks
142
+ - **Mobile/Browser**: MobileNet, EfficientNet-B0
143
+ - **Balanced**: DeiT-base, ConvNeXT-tiny
144
+ - **High Accuracy**: Swin-large, DINOv2-large
145
+
146
+ ### For Audio Tasks
147
+ - **Speech Recognition**: Whisper-tiny (fast), Whisper-large (accurate)
148
+ - **Audio Classification**: Audio Spectrogram Transformer
149
+
150
+ ### For Multimodal
151
+ - **Vision-Language**: CLIP (general), Florence-2 (comprehensive)
152
+ - **Document AI**: Donut, LayoutLM
153
+ - **OCR**: TrOCR
154
+
155
+ ## Finding Models on Hugging Face Hub
156
+
157
+ Search for compatible models:
158
+ ```
159
+ https://huggingface.co/models?library=transformers.js
160
+ ```
161
+
162
+ Filter by task:
163
+ ```
164
+ https://huggingface.co/models?pipeline_tag=text-classification&library=transformers.js
165
+ ```
166
+
167
+ Check for ONNX support by looking for `onnx/` folder in model repository.
@@ -0,0 +1,545 @@
1
+ # Pipeline Options Reference
2
+
3
+ Guide to configuring model loading and inference using the `PretrainedModelOptions` parameter in the `pipeline()` function.
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Overview](#overview)
8
+ 2. [Basic Options](#basic-options)
9
+ 3. [Model Loading Options](#model-loading-options)
10
+ 4. [Device and Performance Options](#device-and-performance-options)
11
+ 5. [Common Configuration Patterns](#common-configuration-patterns)
12
+
13
+ ## Overview
14
+
15
+ The `pipeline()` function accepts three parameters:
16
+
17
+ ```javascript
18
+ import { pipeline } from '@huggingface/transformers';
19
+
20
+ const pipe = await pipeline(
21
+ 'task-name', // 1. Task type (e.g., 'sentiment-analysis')
22
+ 'model-id', // 2. Model identifier (optional, uses default if null)
23
+ options // 3. PretrainedModelOptions (optional)
24
+ );
25
+ ```
26
+
27
+ The third parameter, `options`, allows you to configure how the model is loaded and executed.
28
+
29
+ ### Available Options
30
+
31
+ ```typescript
32
+ interface PretrainedModelOptions {
33
+ // Progress tracking
34
+ progress_callback?: (info: ProgressInfo) => void;
35
+
36
+ // Model configuration
37
+ config?: PretrainedConfig;
38
+
39
+ // Cache and loading
40
+ cache_dir?: string;
41
+ local_files_only?: boolean;
42
+ revision?: string;
43
+
44
+ // Model-specific settings
45
+ subfolder?: string;
46
+ model_file_name?: string;
47
+
48
+ // Device and performance
49
+ device?: DeviceType | Record<string, DeviceType>;
50
+ dtype?: DataType | Record<string, DataType>;
51
+
52
+ // External data format (large models)
53
+ use_external_data_format?: boolean | number | Record<string, boolean | number>;
54
+
55
+ // ONNX Runtime settings
56
+ session_options?: InferenceSession.SessionOptions;
57
+ }
58
+ ```
59
+
60
+ ## Basic Options
61
+
62
+ ### Progress Callback
63
+
64
+ Track model download and loading progress. **Note:** Models consist of multiple files (model weights, config, tokenizer, etc.), and each file reports its own progress:
65
+
66
+ ```javascript
67
+ const fileProgress = {};
68
+
69
+ const pipe = await pipeline('sentiment-analysis', null, {
70
+ progress_callback: (info) => {
71
+ if (info.status === 'progress') {
72
+ fileProgress[info.file] = info.progress;
73
+ console.log(`${info.file}: ${info.progress.toFixed(1)}%`);
74
+ }
75
+
76
+ if (info.status === 'done') {
77
+ console.log(`✓ ${info.file} complete`);
78
+ }
79
+ }
80
+ });
81
+ ```
82
+
83
+ **Progress Info Types:**
84
+
85
+ ```typescript
86
+ type ProgressInfo = {
87
+ status: 'initiate' | 'download' | 'progress' | 'done' | 'ready';
88
+ name: string; // Model id or path
89
+ file: string; // File being processed
90
+ progress?: number; // Percentage (0-100, only for 'progress' status)
91
+ loaded?: number; // Bytes downloaded (only for 'progress' status)
92
+ total?: number; // Total bytes (only for 'progress' status)
93
+ };
94
+ ```
95
+
96
+ **Example: Browser Loading UI with Multiple Files**
97
+
98
+ ```javascript
99
+ const statusDiv = document.getElementById('status');
100
+ const progressContainer = document.getElementById('progress-container');
101
+ const fileProgressBars = {};
102
+
103
+ const pipe = await pipeline('image-classification', null, {
104
+ progress_callback: (info) => {
105
+ if (info.status === 'progress') {
106
+ // Create progress bar for each file if not exists
107
+ if (!fileProgressBars[info.file]) {
108
+ const fileDiv = document.createElement('div');
109
+ fileDiv.innerHTML = `
110
+ <div class="file-name">${info.file}</div>
111
+ <div class="progress-bar">
112
+ <div class="progress-fill" style="width: 0%"></div>
113
+ </div>
114
+ `;
115
+ progressContainer.appendChild(fileDiv);
116
+ fileProgressBars[info.file] = fileDiv.querySelector('.progress-fill');
117
+ }
118
+
119
+ // Update progress bar
120
+ fileProgressBars[info.file].style.width = `${info.progress}%`;
121
+
122
+ const mb = (info.loaded / 1024 / 1024).toFixed(2);
123
+ const totalMb = (info.total / 1024 / 1024).toFixed(2);
124
+ statusDiv.textContent = `${info.file}: ${mb}/${totalMb} MB`;
125
+ }
126
+
127
+ if (info.status === 'ready') {
128
+ statusDiv.textContent = 'Model ready!';
129
+ }
130
+ }
131
+ });
132
+ ```
133
+
134
+ For more progress tracking examples, see the examples in this section above.
135
+
136
+ ### Custom Configuration
137
+
138
+ Override the model's default configuration:
139
+
140
+ ```javascript
141
+ import { pipeline } from '@huggingface/transformers';
142
+
143
+ const pipe = await pipeline('text-generation', 'model-id', {
144
+ config: {
145
+ max_length: 512,
146
+ temperature: 0.8,
147
+ // ... other config options
148
+ }
149
+ });
150
+ ```
151
+
152
+ **Use cases:**
153
+ - Override default generation parameters
154
+ - Adjust model-specific settings
155
+ - Test different configurations without modifying model files
156
+
157
+ ## Model Loading Options
158
+
159
+ ### Cache Directory
160
+
161
+ Specify where to cache downloaded models:
162
+
163
+ ```javascript
164
+ // Node.js: Custom cache location
165
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
166
+ cache_dir: './my-custom-cache'
167
+ });
168
+ ```
169
+
170
+ **Default behavior:**
171
+ - If not specified, uses `env.cacheDir` (default: `./.cache`)
172
+ - Only applies when `env.useFSCache = true` (Node.js)
173
+ - Browser cache uses Cache API (configured via `env.cacheKey`)
174
+
175
+
176
+
177
+ ### Local Files Only
178
+
179
+ Prevent any network requests:
180
+
181
+ ```javascript
182
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
183
+ local_files_only: true
184
+ });
185
+ ```
186
+
187
+ **Use cases:**
188
+ - Offline applications
189
+ - Air-gapped environments
190
+ - Testing with pre-downloaded models
191
+ - Production deployments with bundled models
192
+
193
+ **Important:**
194
+ - Model must already be cached or available locally
195
+ - Throws error if model not found locally
196
+ - Requires `env.allowLocalModels = true`
197
+
198
+
199
+
200
+ ### Model Revision
201
+
202
+ Specify a specific model version (git branch, tag, or commit):
203
+
204
+ ```javascript
205
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
206
+ revision: 'v1.0.0' // Use specific version
207
+ });
208
+
209
+ // Or use a branch
210
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
211
+ revision: 'experimental'
212
+ });
213
+
214
+ // Or use a commit hash
215
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
216
+ revision: 'abc123def456'
217
+ });
218
+ ```
219
+
220
+ **Default:** `'main'` (latest version)
221
+
222
+ **Use cases:**
223
+ - Pin to stable release for production
224
+ - Test experimental features
225
+ - Reproduce results with specific model version
226
+ - Work with models under development
227
+
228
+ **Important:**
229
+ - Only applies to remote models (Hugging Face Hub)
230
+ - Ignored for local file paths
231
+ - Each revision is cached separately
232
+
233
+ ### Model Subfolder
234
+
235
+ Specify the subfolder within the model repository:
236
+
237
+ ```javascript
238
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
239
+ subfolder: 'onnx' // Default: 'onnx'
240
+ });
241
+ ```
242
+
243
+ **Default:** `'onnx'`
244
+
245
+ **Use cases:**
246
+ - Custom model repository structure
247
+ - Multiple model variants in same repo
248
+ - Organizational preferences
249
+
250
+
251
+
252
+ ### Model File Name
253
+
254
+ Specify a custom model file name (without `.onnx` extension):
255
+
256
+ ```javascript
257
+ const pipe = await pipeline('text-generation', 'model-id', {
258
+ model_file_name: 'decoder_model_merged'
259
+ });
260
+ // Loads: decoder_model_merged.onnx
261
+ ```
262
+
263
+ **Use cases:**
264
+ - Models with non-standard file names
265
+ - Select specific model variant
266
+ - Encoder-decoder models with separate files
267
+
268
+ **Note:** Currently only valid for encoder-only or decoder-only models.
269
+
270
+
271
+
272
+ ## Device and Performance Options
273
+
274
+ ### Device Selection
275
+
276
+ Choose where to run the model:
277
+
278
+ ```javascript
279
+ // Run on CPU (WASM - default)
280
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
281
+ device: 'wasm'
282
+ });
283
+
284
+ // Run on GPU (WebGPU)
285
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
286
+ device: 'webgpu'
287
+ });
288
+ ```
289
+
290
+ **Common devices:**
291
+ - `'wasm'` - WebAssembly (CPU, most compatible)
292
+ - `'webgpu'` - WebGPU (GPU, faster in browsers)
293
+ - `'cpu'` - CPU
294
+ - `'gpu'` - Auto-detect GPU
295
+ - `'cuda'` - NVIDIA CUDA (Node.js with GPU)
296
+
297
+ See the full list in the [devices.js source](https://github.com/huggingface/transformers.js/blob/main/src/utils/devices.js).
298
+
299
+ **Per-component device selection:**
300
+
301
+ For models with multiple components (encoder-decoder, vision-encoder-decoder, etc.):
302
+
303
+ ```javascript
304
+ const pipe = await pipeline('automatic-speech-recognition', 'model-id', {
305
+ device: {
306
+ encoder: 'webgpu', // Run encoder on GPU
307
+ decoder: 'wasm' // Run decoder on CPU
308
+ }
309
+ });
310
+ ```
311
+
312
+ **WebGPU Requirements:**
313
+ - Chrome/Edge 113+
314
+ - Enable chrome://flags/#enable-unsafe-webgpu (if needed)
315
+ - Adequate GPU memory
316
+
317
+
318
+
319
+ ### Data Type (Quantization)
320
+
321
+ Control model precision and size:
322
+
323
+ ```javascript
324
+ // Full precision (largest, most accurate)
325
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
326
+ dtype: 'fp32'
327
+ });
328
+
329
+ // Half precision (balanced)
330
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
331
+ dtype: 'fp16'
332
+ });
333
+
334
+ // 8-bit quantization (smaller, faster)
335
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
336
+ dtype: 'q8'
337
+ });
338
+
339
+ // 4-bit quantization (smallest, fastest)
340
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
341
+ dtype: 'q4'
342
+ });
343
+ ```
344
+
345
+ **Common data types:**
346
+ - `'fp32'` - 32-bit floating point (full precision)
347
+ - `'fp16'` - 16-bit floating point (half precision)
348
+ - `'q8'` - 8-bit quantized (good balance)
349
+ - `'q4'` - 4-bit quantized (maximum compression)
350
+ - `'int8'` - 8-bit integer
351
+ - `'uint8'` - 8-bit unsigned integer
352
+
353
+ See the full list in the [dtypes.js source](https://github.com/huggingface/transformers.js/blob/main/src/utils/dtypes.js).
354
+
355
+ **Per-component data type:**
356
+
357
+ ```javascript
358
+ const pipe = await pipeline('automatic-speech-recognition', 'model-id', {
359
+ dtype: {
360
+ encoder: 'fp32', // Encoder at full precision
361
+ decoder: 'q8' // Decoder quantized
362
+ }
363
+ });
364
+ ```
365
+
366
+ **Trade-offs:**
367
+
368
+ | Data Type | Model Size | Speed | Accuracy | Use Case |
369
+ |-----------|-----------|-------|----------|----------|
370
+ | `fp32` | Largest | Slowest | Highest | Research, maximum quality |
371
+ | `fp16` | Medium | Medium | High | Production, GPU inference |
372
+ | `q8` | Small | Fast | Good | Production, CPU inference |
373
+ | `q4` | Smallest | Fastest | Acceptable | Edge devices, real-time apps |
374
+
375
+
376
+
377
+ ### External Data Format
378
+
379
+ For models >= 2GB, ONNX uses external data format:
380
+
381
+ ```javascript
382
+ // Automatically detect and load external data
383
+ const pipe = await pipeline('text-generation', 'large-model-id', {
384
+ use_external_data_format: true
385
+ });
386
+
387
+ // Specify number of external data chunks
388
+ const pipe = await pipeline('text-generation', 'large-model-id', {
389
+ use_external_data_format: 5 // Load 5 chunks (model.onnx_data_0 to _4)
390
+ });
391
+ ```
392
+
393
+ **How it works:**
394
+ - Models >= 2GB split weights into separate files
395
+ - Main file: `model.onnx` (structure only)
396
+ - Data files: `model.onnx_data` or `model.onnx_data_0`, `model.onnx_data_1`, etc.
397
+
398
+ **Default behavior:**
399
+ - `false` - No external data (models < 2GB)
400
+ - `true` - Load external data automatically
401
+ - `number` - Load this many external data chunks
402
+
403
+ **Maximum chunks:** 100 (defined by `MAX_EXTERNAL_DATA_CHUNKS`)
404
+
405
+ **Per-component external data:**
406
+
407
+ ```javascript
408
+ const pipe = await pipeline('text-generation', 'large-model-id', {
409
+ use_external_data_format: {
410
+ encoder: true,
411
+ decoder: 3 // Decoder has 3 external data chunks
412
+ }
413
+ });
414
+ ```
415
+
416
+
417
+
418
+ ### Session Options
419
+
420
+ Advanced ONNX Runtime configuration:
421
+
422
+ ```javascript
423
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
424
+ session_options: {
425
+ executionProviders: ['webgpu', 'wasm'],
426
+ graphOptimizationLevel: 'all',
427
+ enableCpuMemArena: true,
428
+ enableMemPattern: true,
429
+ executionMode: 'sequential',
430
+ logSeverityLevel: 2,
431
+ logVerbosityLevel: 0
432
+ }
433
+ });
434
+ ```
435
+
436
+ **Common session options:**
437
+
438
+ | Option | Description | Default |
439
+ |--------|-------------|---------|
440
+ | `executionProviders` | Ordered list of execution providers | `['wasm']` |
441
+ | `graphOptimizationLevel` | Graph optimization: `'disabled'`, `'basic'`, `'extended'`, `'all'` | `'all'` |
442
+ | `enableCpuMemArena` | Enable CPU memory arena for faster memory allocation | `true` |
443
+ | `enableMemPattern` | Enable memory pattern optimization | `true` |
444
+ | `executionMode` | `'sequential'` or `'parallel'` | `'sequential'` |
445
+ | `logSeverityLevel` | 0=Verbose, 1=Info, 2=Warning, 3=Error, 4=Fatal | `2` |
446
+ | `freeDimensionOverrides` | Override dynamic dimensions (e.g., `{ batch_size: 1 }`) | - |
447
+
448
+ **Use cases:**
449
+ - Fine-tune performance for specific hardware
450
+ - Debug model execution issues
451
+ - Override dynamic shapes
452
+ - Control memory usage
453
+
454
+
455
+
456
+ ## Common Configuration Patterns
457
+
458
+ ### Development
459
+
460
+ Fast iteration with progress tracking:
461
+
462
+ ```javascript
463
+ import { pipeline } from '@huggingface/transformers';
464
+
465
+ const pipe = await pipeline('sentiment-analysis', null, {
466
+ progress_callback: (info) => {
467
+ if (info.status === 'progress') {
468
+ console.log(`${info.file}: ${info.progress.toFixed(1)}%`);
469
+ }
470
+ }
471
+ });
472
+ ```
473
+
474
+ ### Production (GPU)
475
+
476
+ Use WebGPU with fp16 for better performance:
477
+
478
+ ```javascript
479
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
480
+ device: 'webgpu',
481
+ dtype: 'fp16'
482
+ });
483
+ ```
484
+
485
+ ### Production (CPU)
486
+
487
+ Use quantization for smaller size and faster CPU inference:
488
+
489
+ ```javascript
490
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
491
+ dtype: 'q8' // or 'q4' for even smaller
492
+ });
493
+ ```
494
+
495
+ ### Offline/Local
496
+
497
+ Prevent network requests, use only local models:
498
+
499
+ ```javascript
500
+ import { pipeline, env } from '@huggingface/transformers';
501
+
502
+ env.allowLocalModels = true;
503
+ env.localModelPath = './models/';
504
+
505
+ const pipe = await pipeline('sentiment-analysis', 'model-id', {
506
+ local_files_only: true
507
+ });
508
+ ```
509
+
510
+ ### Per-Component Settings
511
+
512
+ For encoder-decoder models, configure each component separately:
513
+
514
+ ```javascript
515
+ const pipe = await pipeline('automatic-speech-recognition', 'model-id', {
516
+ device: {
517
+ encoder: 'webgpu',
518
+ decoder: 'wasm'
519
+ },
520
+ dtype: {
521
+ encoder: 'fp16',
522
+ decoder: 'q8'
523
+ }
524
+ });
525
+ ```
526
+
527
+ ## Related Documentation
528
+
529
+ - [Configuration Reference](./CONFIGURATION.md) - Environment configuration with `env` object
530
+ - [Text Generation Guide](./TEXT_GENERATION.md) - Text generation options and streaming
531
+ - [Model Architectures](./MODEL_ARCHITECTURES.md) - Supported models and selection tips
532
+ - [Main Skill Guide](../SKILL.md) - Getting started with Transformers.js
533
+
534
+ ## Best Practices
535
+
536
+ 1. **Progress Callbacks**: Use `progress_callback` for large models to show download progress
537
+ 2. **Quantization**: Use `q8` or `q4` for CPU inference to reduce size and improve speed
538
+ 3. **Device Selection**: Use `webgpu` for better performance when available
539
+ 4. **Offline-First**: Use `local_files_only: true` in production to avoid runtime downloads
540
+ 5. **Version Pinning**: Use `revision` to pin model versions for reproducible deployments
541
+ 6. **Memory Management**: Always dispose pipelines with `pipe.dispose()` when done
542
+
543
+ ---
544
+
545
+ This document covers all available options for the `pipeline()` function. For environment-level configuration (remote hosts, global cache settings, WASM paths), see the [Configuration Reference](./CONFIGURATION.md).