Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DeepSeek-R1をカスタムモデルとしてAmazon Bedrockにインポートし活用

DeepSeek-R1をカスタムモデルとしてAmazon Bedrockにインポートし活用

為藤アキラ

January 29, 2025

Transcript

29 slides
  1. 為藤 アキラ (Akira Tameto) 株式会社BLUEISH 代表取締役 CEO兼CTO ・AWS歴12年 ・直近のAIプロジェクト  

    ・画像を中心とした機械学習とLLM のハイブリッドのアーキテクト 自己紹介
  2. DeepSeekのダウンロード pip install huggingface_hub from import model_id = (repo_id=model_id, local_dir=f

    ) huggingface_hub snapshot_download snapshot_download # model_id = "deepseek-ai/DeepSeek-R1-Distill-Llama-8B" # snapshot_download(repo_id=model_id, local_dir=f"./DeepSeek-R1-Distill-Llama-8B") "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B" "./DeepSeek-R1-Distill-Qwen-1.5B" 1.Huggingfaceからダウンロードを行うのでライブラリーのインストール 2.Huggingfaceからモデルをライブラリーのインストール
  3. InvokeModel APIで実行 import import = . = = = \n


    = . = = = =2 = json
 boto3

 client boto3 ( )

 model_id prompt formatted_prompt prompt response client (
 modelId model_id,
 body json. (
 {
 :prompt,
 }
 ),
 )

 response_body json. (response[ ]. ())
 (json. (response_json, indent , ensure_ascii False)) client invoke_model dumps loads read print dumps "bedrock-runtime", region_name="us-east-1" "arn:aws:bedrock:us-west-1:{先ほどのモデル}"

 "東京都の歴史を説明してください"
 "prompt" "body" f"""<s>[INST] Human: { }[/INST]

 Assistant: """ 


More Decks by 為藤アキラ

Other Decks in Technology