# Offline Mode

{% hint style="info" %}
Roboflow Enterpriseのお客様向けのOffline Modeでは、当社のDockerコンテナの使用が必要です。
{% endhint %}

Roboflow Enterpriseのお客様は、オンデバイス推論サーバーであるRoboflow Inferenceを設定して、重みを最大30日間キャッシュできます。

これにより、モデルを完全にエアギャップ環境で実行したり、インターネット接続がすぐに利用できない場所で実行したりできます。

モデルをオフラインで実行するには、次の手順が必要です:

1. Docker volumeを作成して `/tmp/cache` をInference Server上にアタッチします。
2. Dockerを使ってRoboflow Inference serverを起動します。
3. server経由でモデルにリクエストを送信すると、モデルの重みのダウンロードとキャッシュの処理が開始されます。この手順にはインターネット接続が必要です。

重みがキャッシュされたら、ローカルで使用できます。

以下では、CPUからGPUまで、さまざまなデバイスタイプでモデルをオフライン実行する方法を説明します。

## CPU

画像: [roboflow / roboflow-inference-server-cpu](https://hub.docker.com/r/roboflow/roboflow-inference-server-cpu)

```bash
sudo docker volume create roboflow
sudo docker run --net=host --env LICENSE_SERVER=10.0.1.1 --mount source=roboflow,target=/tmp/cache roboflow/roboflow-inference-server-cpu
```

## GPU

GPUコンテナを使用するには、まず [nvidia-container-runtime](https://github.com/NVIDIA/nvidia-container-runtime).

画像:[ roboflow / roboflow-inference-server-gpu](https://hub.docker.com/r/roboflow/roboflow-inference-server-gpu)

```bash
sudo docker volume create roboflow
docker run -it --rm -p 9001:9001 --gpus all --mount source=roboflow,target=/tmp/cache roboflow/roboflow-inference-server-gpu
```

## Jetson 4.5

お使いのJetson Jetpack 4.5には、すでに <https://github.com/NVIDIA/nvidia-container-runtime> がインストールされていること。

画像:[ roboflow/roboflow-inference-server-jetson-4.5.0](https://hub.docker.com/r/roboflow/roboflow-inference-server-jetson-4.5.0)

<pre class="language-bash"><code class="lang-bash">sudo docker volume create roboflow
<strong>docker run -it --rm -p 9001:9001 --runtime=nvidia --mount source=roboflow,target=/tmp/cache roboflow/roboflow-inference-server-jetson-4.5.0
</strong></code></pre>

## Jetson 4.6

お使いのJetson Jetpack 4.6には、すでに <https://github.com/NVIDIA/nvidia-container-runtime> がインストールされていること。

画像:[ roboflow/roboflow-inference-server-jetson-4.6.1](https://hub.docker.com/r/roboflow/roboflow-inference-server-jetson-4.6.1/tags)

<pre class="language-bash"><code class="lang-bash">sudo docker volume create roboflow
<strong>docker run -it --rm -p 9001:9001 --runtime=nvidia --mount source=roboflow,target=/tmp/cache roboflow/roboflow-inference-server-jetson-4.6.1
</strong></code></pre>

## Jetson 5.1

お使いのJetson Jetpack 5.1には、すでに <https://github.com/NVIDIA/nvidia-container-runtime> がインストールされていること。

画像: [roboflow/roboflow-inference-server-jetson-5.1.1](https://hub.docker.com/r/roboflow/roboflow-inference-server-jetson-5.1.1)

```bash
sudo docker volume create roboflow
docker run -it --rm -p 9001:9001 --runtime=nvidia --mount source=roboflow,target=/tmp/cache roboflow/roboflow-inference-server-jetson-5.1.1
```

## Inferenceの実行

Inference serverをローカルキャッシュで設定しておくと、インターネット接続がなくても画像や動画フレームでモデルを実行できます。

"[Predict on an Image Over HTTP](https://inference.roboflow.com/quickstart/run_model_on_image/)" のInferenceドキュメントを参照し、モデルの実行方法をご確認ください。

## Inference結果

重みは、SSL暗号化を使ってインターネット経由であなたのRoboflowアカウントから読み込まれ（設定している場合はLicense Server経由）、Docker volumeに安全に最大30日間保存されます。

推論結果には新しい `expiration` キーが含まれ、インターネットまたはLicense Server接続を通じて重みの使用許可を更新するまで、Inference Serverがどれだけ予測を提供し続けられるかを判断できます。重みの有効期限が7日未満になると、Inference ServerはRoboflow APIへの接続が成功するまで、1時間に1回、重みの使用許可の更新を試行し始めます。

使用許可が更新されると、カウンターは30日にリセットされます。

```json
{
    "predictions": [
        {
            "x": 340.9,
            "y": 263.6,
            "width": 284,
            "height": 360,
            "class": "example",
            "confidence": 0.867
        }
    ],
    "expiration": {
        "value": 29.91251408564815,
        "unit": "days"
    }
}
```

{% hint style="info" %}
モデルのオフラインデプロイについてご質問がある場合は、Roboflow担当者にご相談ください。
{% endhint %}


---

# 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.roboflow.com/roboflow/roboflow-jp/deploy/enterprise-deployment/offline-mode.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.
