0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GPU コンテナの高火力 DOK で gpt-oss(オープンウェイトのAIモデル)を試す

Last updated at Posted at 2025-08-07

高火力 DOKはコンテナー型の GPU サービスで、NVIDIA V100 や H100 を実行時間課金で利用できるサービスです。

今回はこの高火力 DOK を使って、NVIDIA が開発しているgpt-ossを試してみました。

gpt-ossについて

gpt-ossは、OpenAIがリリースしたオープンウェイトなAIモデルです。120bと20bの2つのモデルがあります。120bはo4-miniやo3に匹敵するそうです。

openai/gpt-oss: gpt-oss-120b and gpt-oss-20b are two open-weight language models by OpenAI

参考

今回はopenai/gpt-ossのリポジトリに書かれている内容を参考に進めています。

Notebook で試す

高火力 DOK は、Docker コンテナの実行の他、Jupyter Notebook をすぐに起動できる機能があります。今回はこちらを使っています。なお、GPU は H100 です。20bモデルであっても、V100ではメモリ不足で実行できませんでした。

FireShot Capture 891 - 高火力 DOK - ノートブック - secure.sakura.ad.jp.jpg

ボタンクリック一つでJupyter Notebookが立ち上がります。

FireShot Capture 892 - JupyterLab_ - ab9e6963-8ab6-431a-8cf9-2e67be9a8421.50f46c87-fb14-4a96-89a9-95a8989ae831.container.sakurausercontent.com.jpg

必要なライブラリのインストール

まず、必要なライブラリを pip でインストールします。

!pip install "transformers[torch]"

モデルの読み込み

次にモデルを読み込みます。モデルは openai/gpt-oss-20b を使います。なお、H100であっても 120b モデルは実行できませんでした。GitHubのREADMEには H100 であれば 120b モデルも実行できると書かれていますので、Notebook経由でなければ(高火力 VRTならば)実行できるかも知れません。

from transformers import pipeline
import torch

model_id = "openai/gpt-oss-20b"

pipe = pipeline(
    "text-generation",
    model=model_id,
    torch_dtype="auto",
    device_map="auto"
)

実行する

モデルが読み込めたら、実際に実行してみます。以下のようにプロンプトを与えると、モデルが応答を生成します。

messages = [
    {"role": "user", "content": "Can you speak Japanese?"},
]

outputs = pipe(
    messages,
    max_new_tokens=256,
)
print(outputs[0]["generated_text"][-1])

結果は以下のようになります。

{'role': 'assistant', 'content': 'analysisThe user asks: "Can you speak Japanese?" They want a response. I can respond in Japanese. I should answer affirmatively and perhaps mention that I can understand and respond in Japanese. I can mention that I can generate Japanese text and help with translations. So answer in Japanese: はい、日本語で話せます。 Provide a short explanation.assistantfinalはい、日本語で話すことができます。文章の作成や翻訳、質問への回答など、さまざまな日本語のサポートが可能です。何かご要望があれば遠慮なくお知らせください。'}

日本語はOKと言いつつも、日本語で質問しても英語で返ってきます。

messages = [
    {"role": "user", "content": "さくらインターネットについて、日本語で教えて"},
]

outputs = pipe(
    messages,
    max_new_tokens=256,
)
print(outputs[0]["generated_text"][-1])

結果は以下の通りです。

{'role': 'assistant', 'content': 'analysisWe need to explain Sakura Internet. Provide overview: Japanese hosting company, founded 2000, main services: VPS, dedicated servers, cloud, domain registration, etc. History, key features, infrastructure, data centers, network, security, support, market position. Also mention major clients, awards, and maybe future directions. Provide in Japanese. Let\'s do a comprehensive answer.\n\nWe should cover:\n\n- Company background\n- Core services (VPS, dedicated, cloud, CDN, domain, email, etc.)\n- Infrastructure: data centers, network, uptime\n- Market position and competitors\n- Notable achievements\n- Customer support and SLA\n- Future plans\n\nAlso mention that Sakura Internet is a subsidiary of Sakura Internet Inc. (Sakura), part of the Sakura group. Provide details about Sakura Cloud, Sakura VPS, etc. Provide quick facts like number of servers, etc. Provide Japanese language. Let\'s do it.\n\nAlso mention that Sakura Internet is known for "Sakura VPS" and "Sakura Cloud" which are popular in Japan. Provide details about the differences: VPS vs Cloud: VPS: fixed server resources, Cloud: auto-scaling. Provide details about pricing.\n\nWe can also mention that Sakura Internet is a major provider of "Sakura SSL'}

注意点

高火力 DOK はタスク実行時間(秒単位)の課金です。利用し終わったら、Jupyter Notebook を忘れずに終了してください。

まとめ

今回はgpt-ossを高火力 DOKのJupyter Notebook上で試してみました。H100を使うことで、20bモデルは問題なく実行可能です。Jupyter Notebook を使えば、ハードウェア環境を用意することなく、すぐに機械学習をはじめられます。また、Jupyter Notebook 上であれば、インタラクティブに結果を確認しながら進められるのが便利です。

Jupyter Notebook で開発し、終わったら Docker イメージにして高火力 DOK で実行できます。ぜひ試してみてください。

コンテナー型 GPU クラウドサービス 高火力 DOK(ドック) | さくらインターネット

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?