# HuggingFace 統合

HuggingFaceに推論エンドポイントをデプロイした後、次のユーザーインターフェースが表示されるはずです：

<figure><img src="/files/LzaWy2gDY8Q5KBwnrqMC" alt="huggingface deploy interface"><figcaption></figcaption></figure>

このページでは、次の情報が必要です：

* エンドポイントURL
* モデルリポジトリ
* APIトークン。このトークンは、Call Examplesコードブロックで「Add API token」ボックスをチェックすることで確認できます。

これに加えて、モデルのコンテキストウィンドウも必要です。これはモデルの情報ページで見つけることができます。

この情報を収集したら、以下の例のようにJSON形式にフォーマットします：

```json
{
    "api_key":"your_api_key",
    "endpoint": "your_api_endpoint",
    "model_name": "meta-llama/Llama-2-7b-chat-hf",
    "context_window": 4096
}
```

次に、これを統合のCredentialフィールドに貼り付けます。

<figure><img src="/files/8ggExtQ490MKiJOBtzkR" alt="credential field"><figcaption></figcaption></figure>

資格情報が正常に検証されると、GenStudioのモデルリストにあなたのHuggingFaceモデルが表示されるはずです：

<figure><img src="/files/lT20VhxT4FVO6oqIaAIz" alt="huggingface model as genstudio model"><figcaption></figcaption></figure>

### HuggingFaceエンドポイントをゼロにスケーリング

ゼロにスケーリングすることは、Inference Endpointsが提供する動的な機能で、リソースの利用効率とコストを最適化することを目指しています。インテリジェントにリクエストパターンを監視し、アイドルタイム中にレプリカの数をゼロに減らすことで、必要なときだけリソースを使用することを保証します。

しかし、これはトラフィックが再開したときのコールドスタート期間を導入しますので、注意すべき点がいくつかあります。この機能の動作方法、利点、潜在的な課題について詳しくは、[HuggingFaceのAutoscalingに関するガイド](https://huggingface.co/docs/inference-endpoints/autoscaling) を参照してください。

### サポートされているモデル

現時点では、`text-generation` タグが付けられたモデルのエンドポイントのみをサポートしており、これらは `text-generation-inference` コンテナとしてデプロイされています。サポートされているモデルのリストを拡張するために取り組んでいます。

<figure><img src="/files/s4E8y0tUEq2nSGzIAat5" alt="image (48)"><figcaption><p>LLaMA 2 はテキスト生成タグを持つモデルです</p></figcaption></figure>

<figure><img src="/files/5H23sC3xKW9LOQIhyA3V" alt="image (49)"><figcaption><p>デプロイ時にコンテナタイプとしてテキスト生成推論を選択してください</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.skydeck.ai/ja/integrations/llms-and-databases/huggingface-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
