From 67d5fccc6eef8baff01aba1c6f3f8268766181ee Mon Sep 17 00:00:00 2001 From: bglglzd Date: Sun, 12 Jul 2026 21:14:33 +0300 Subject: [PATCH] Polish docs and comments in transformers.js --- CONTRIBUTING.md | 16 ++++++++-------- README.md | 4 ++-- .../transformers/docs/source/guides/dtypes.md | 2 +- .../transformers/docs/source/guides/webgpu.md | 2 +- .../docs/source/integrations/vercel-ai-sdk.md | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c98dc60eb..3617832ef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -267,16 +267,16 @@ Follow the steps below to start contributing: the pull request. ### Pull request checklist -☐ The pull request title should summarize your contribution. +☐ The pull request title should summarize your contribution. ☐ If your pull request addresses an issue, please mention the issue number in the pull request description to make sure they are linked (and people viewing the issue know you -are working on it). +are working on it). ☐ To indicate a work in progress please prefix the title with `[WIP]`. These are -useful to avoid duplicated work, and to differentiate it from PRs ready to be merged. -☐ Make sure existing tests pass (`pnpm test`). -☐ Make sure the build completes successfully (`pnpm build`). -☐ Make sure your code is [formatted properly with Prettier](#code-formatting) (`pnpm format:check`). -☐ If adding a new feature, also add tests for it. +useful to avoid duplicated work, and to differentiate it from PRs ready to be merged. +☐ Make sure existing tests pass (`pnpm test`). +☐ Make sure the build completes successfully (`pnpm build`). +☐ Make sure your code is [formatted properly with Prettier](#code-formatting) (`pnpm format:check`). +☐ If adding a new feature, also add tests for it. ☐ If your changes affect user-facing functionality, update the relevant documentation. ### Tests @@ -364,4 +364,4 @@ The recommended way to develop and test changes is to use the watch mode build a 4. Test your changes in your test project. The changes will be automatically reflected since the package is linked via the `file:` protocol. -This workflow allows for rapid iteration and testing during development. \ No newline at end of file +This workflow allows for rapid iteration and testing during development. diff --git a/README.md b/README.md index 93772b020..f1db89eb5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@


- + transformers.js javascript library logo @@ -31,7 +31,7 @@ Transformers.js is designed to be functionally equivalent to Hugging Face's [tra - 🗣️ **Audio**: automatic speech recognition, audio classification, and text-to-speech. - 🐙 **Multimodal**: embeddings, zero-shot audio classification, zero-shot image classification, and zero-shot object detection. -Transformers.js uses [ONNX Runtime](https://onnxruntime.ai/) to run models in the browser. The best part about it, is that you can easily [convert](#convert-your-models-to-onnx) your pretrained PyTorch, TensorFlow, or JAX models to ONNX using [🤗 Optimum](https://github.com/huggingface/optimum#onnx--onnx-runtime). +Transformers.js uses [ONNX Runtime](https://onnxruntime.ai/) to run models in the browser. The best part about it, is that you can easily [convert](#convert-your-models-to-onnx) your pretrained PyTorch, TensorFlow, or JAX models to ONNX using [🤗 Optimum](https://github.com/huggingface/optimum#onnx--onnx-runtime). For more information, check out the full [documentation](https://huggingface.co/docs/transformers.js). diff --git a/packages/transformers/docs/source/guides/dtypes.md b/packages/transformers/docs/source/guides/dtypes.md index b3e24727c..3c4d03334 100644 --- a/packages/transformers/docs/source/guides/dtypes.md +++ b/packages/transformers/docs/source/guides/dtypes.md @@ -5,7 +5,7 @@ Before Transformers.js v3, we used the `quantized` option to specify whether to The list of available quantizations depends on the model, but some common ones are: full-precision (`"fp32"`), half-precision (`"fp16"`), 8-bit (`"q8"`, `"int8"`, `"uint8"`), and 4-bit (`"q4"`, `"bnb4"`, `"q4f16"`).

- + Available dtypes for mixedbread-ai/mxbai-embed-xsmall-v1 diff --git a/packages/transformers/docs/source/guides/webgpu.md b/packages/transformers/docs/source/guides/webgpu.md index 3d6c2adb0..bdecc06ca 100644 --- a/packages/transformers/docs/source/guides/webgpu.md +++ b/packages/transformers/docs/source/guides/webgpu.md @@ -2,7 +2,7 @@ WebGPU is a new web standard for accelerated graphics and compute. The [API](https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API) enables web developers to use the underlying system's GPU to carry out high-performance computations directly in the browser. WebGPU is the successor to [WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and provides significantly better performance, because it allows for more direct interaction with modern GPUs. Lastly, it supports general-purpose GPU computations, which makes it just perfect for machine learning! -> [!WARNING] +> [!WARNING] > As of October 2024, global WebGPU support is around 70% (according to [caniuse.com](https://caniuse.com/webgpu)), meaning some users may not be able to use the API. > > If the following demos do not work in your browser, you may need to enable it using a feature flag: diff --git a/packages/transformers/docs/source/integrations/vercel-ai-sdk.md b/packages/transformers/docs/source/integrations/vercel-ai-sdk.md index 9f5d54154..76fa1a88f 100644 --- a/packages/transformers/docs/source/integrations/vercel-ai-sdk.md +++ b/packages/transformers/docs/source/integrations/vercel-ai-sdk.md @@ -6,7 +6,7 @@ This guide covers the core concepts and API patterns. For a full step-by-step pr ## Why use the Vercel AI SDK with Transformers.js? -The `@browser-ai/transformers-js` provider builds on top of `@huggingface/transformers` to give you a standard AI SDK interface — handling Web Worker setup, message passing, progress tracking, streaming, interrupt handling, and state management, so you can use the same `streamText`, `generateText`, and `useChat` APIs you'd use with any other AI SDK provider. +The `@browser-ai/transformers-js` provider builds on top of `@huggingface/transformers` to give you a standard AI SDK interface — handling Web Worker setup, message passing, progress tracking, streaming, interrupt handling, and state management, so you can use the same `streamText`, `generateText`, and `useChat` APIs you'd use with any other AI SDK provider. Read more about this [here](https://www.browser-ai.dev/docs/ai-sdk-v6/transformers-js/why). ## Installation