Home›Local LLM / Open Models›Transformers.jsでクロスオリジンストレージAPIを試す

Transformers.jsでクロスオリジンストレージAPIを試すExperimenting with the proposed Cross-Origin Storage API in Transformers.js

元記事を読むRead original articlehuggingface.co(新しいタブで開きます)(opens in a new tab)
AI 要約AI summary

提案中のCross-Origin Storage APIをTransformers.jsで実験的に活用し、異なるオリジン間でモデルファイルをキャッシュ共有できる可能性を示した。重複ダウンロードを削減しブラウザ上のローカルAI体験を改善できる。

This post explores using the proposed Cross-Origin Storage API with Transformers.js to share cached model files across different web origins, potentially eliminating redundant downloads and improving in-browser local AI performance.

AI 生成の要約と解説(解説は要約と収集メタデータに基づく)で、元記事全文の転載・翻訳ではありません。日本語版と英語版は言語ごとに独立して生成しています。正確性は元記事 (huggingface.co) でご確認ください。AI-generated summary and explainer (the latter based on the summaries and collected metadata), not a copy or translation of the full source article. Generated independently for each language. Verify accuracy at the original source (huggingface.co).

クロスオリジンストレージ

提案段階にあるCross-Origin Storage APIをTransformers.jsで試す、Chromeチームのゲスト記事が公開された。異なるオリジン間でキャッシュ済みのモデルファイルを共有し、重複ダウンロードをなくせる可能性があるとされる。

筆者はGoogleのChromeチームでDeveloper Relations Engineerを務めるThomas Steinerだ。この試みは、ブラウザ上で動くローカルAIの体験改善につながると説明されている。

pipeline()

Transformers.jsは、タスク別のパイプラインを通じて、ウェブ開発者がウェブアプリでtransformerの力を手軽に使えるようにするライブラリだ。ブラウザ内で推論を実行するには、pipeline()のインスタンスを作成し、そのパイプラインで使いたいタスクを指定する。

ASRパイプライン

具体例として示されているのは、自動音声認識(ASR)パイプラインの設定だ。コードではhttps://cdn.jsdelivr.net/npm/@huggingface/transformers@4.2.0からpipelineをインポートしている。そして、用意したasrに音声ファイル「jfk.wav」を渡し、awaitで結果を受け取る。

タスクを指定してパイプラインを作り、入力を渡して結果を得る。この流れが、ブラウザ内推論の基本形として紹介されている。

モデルの指定

この例でモデルに指定されているのは、Xenova/whisper-tiny.en だ。筆者はこれを、一般的な英語の自動音声認識タスクに向いたとても良い選択だと述べている。

モデルファイルはブラウザ側にキャッシュされて使われる。Cross-Origin Storage APIの実験は、そのキャッシュをオリジンをまたいで共有できるかを探るものだ。

Transformers.js and Cross-Origin Storage

This guest post, written by Thomas Steiner, a Developer Relations Engineer on the Chrome team at Google, looks at experimenting with the proposed Cross-Origin Storage API in Transformers.js. According to the post, the aim is to share cached model files across different web origins, which could remove redundant downloads and improve in-browser local AI performance.

Pipelines for In-Browser Inference

The post describes Transformers.js as a simple way for Web developers to use transformers in their web apps through task-specific pipelines. To run inference in the browser, a developer creates an instance of pipeline() and specifies the task the pipeline should handle.

As a concrete example, the post shows how to set up an automatic speech recognition (ASR) pipeline. The snippet imports pipeline from a jsDelivr CDN URL for the @huggingface/transformers package at version 4.2.0. It then awaits a call to the ASR pipeline with an audio file named jfk.wav and stores the output in a variable called result.

The Model Choice

The author notes that the source code specifies Xenova/whisper-tiny.en as the model. He calls it a very decent choice for common English automatic speech recognition tasks.

What the Experiment Explores

The central idea is the proposed Cross-Origin Storage API. As framed in the post, it is a way to let model files that have already been cached be reused across different origins. The stated potential benefit is fewer repeated downloads of the same model, which would improve the experience of running local AI in the browser.

The API is described as a proposal, and the post presents its use with Transformers.js as an experiment. The conclusions are therefore tentative: the post speaks of what the approach could achieve, not of an established result.

ポコとTECHガイドPoko & TECH Guide

ポコと当サイトのTECHガイドが、記事の要約と収集した情報から読みどころを語るAI生成の対話です。Poko and TECH Dashboard's own TECH Guide discuss the article's highlights in an AI-generated conversation based on its summary and collected source details.

  1. ポコPokoこの記事で試しているクロスオリジンストレージAPIって、何をするものなの?What does this Cross-Origin Storage API in the post actually do?
  2. TECHガイドTECH Guide提案中のAPIで、異なるオリジン間でキャッシュ済みのモデルファイルを共有できる可能性を探っています。Transformers.jsで実験的に使っているんです。It's a proposed API, and the post explores whether different origins could share cached model files. They try it out experimentally with Transformers.js.
  3. ポコPokoじゃあ、別のサイトでも同じモデルを何回もダウンロードしなくてよくなるのかな?So would different sites stop downloading the same model over and over?
  4. TECHガイドTECH Guideそこが狙いで、重複ダウンロードを減らせるかもしれないと書かれています。ブラウザ上のローカルAI体験の改善につながる、という位置づけですね。That's the aim. The post says redundant downloads could be reduced, which could improve in-browser local AI experiences.
  5. ポコPokoブラウザでAIを動かすWeb開発者や使う人に、ムダな待ち時間が減るかもってことだね。So web developers and users running AI in the browser might wait less. Is that right?
  6. TECHガイドTECH Guideその方向ですね。ただ、APIはまだ提案中で、この記事も実験の段階です。使えるようになると決まったわけではないので、そこは気をつけたいです。That's the direction. But the API is still proposed and this is an experiment, so it's not settled that you can rely on it yet.
記事情報・収集記録Article details & collection record
出典Source
Hugging Face Blog公式Official
公開日時 (JST)Published (JST)
収集日時 (JST)Collected (JST)
配信形式Format
ブログBlog
原文言語Source language
英語English
重要度の位置づけImportance in this lane
MediumMedium priority(Local LLM / Open Models 239件中、同等以上 192件)(192 of 239 Local LLM / Open Models entries are equal or higher)
出典の平均重要度(掲載直近 30 件・最大 30 件)Source average (last 30 listed, up to 30)
2.0 / 31=情報 · 2=中 · 3=高1=Info · 2=Medium · 3=High
情報の寿命Half-life
短命 (ニュース)Short-lived (news)

🏠Local LLM / Open Models の他の記事More from Local LLM / Open Modelsもっと見る →View more →

ページ上部へScroll to top