Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
vSphere環境でLLMをServeする
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
masanara
December 20, 2023
Technology
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
vSphere環境でLLMをServeする
masanara
December 20, 2023
More Decks by masanara
See All by masanara
Cartographer入門
masanara
0
530
EKS Anywhere on vSphere
masanara
0
60
kpackによるコンテナイメージのビルド
masanara
0
140
Harbor RegistryのReplication機能
masanara
0
450
Kubernetes Operator for vSphere VM
masanara
0
70
Other Decks in Technology
See All in Technology
Goodbye ShellScript, Hello File-based App
shunsock
0
920
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
32
21k
AI時代、データエンジニアが一番おもろい
genshun9
0
690
CI/CDではもう遅い - 人とAIが迂回しないDevSecOps Verify基盤の再設計 -
kintotechdev
0
130
AI感のないAWS構成図をAIエージェントに描かせたい!
sagochiko
1
270
人間はどの意思決定を手放せるのか
kawasima
15
8.1k
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
540
SREの視点で考えるSIEM活用術 〜AWS環境でのセキュリティ強化〜
cscengineer
PRO
0
320
[Kiro Meetup #7] Kiro Crew Dive Deep
konippi
0
290
2026-09-18 gotanda.sre Terraformで複数環境作ったり、複数Stateに分割したりそれとTerragrunt / Terraform multi envs and multi states
masasuzu
4
720
「ピッケル本」日本語版は4.0(第6版)が出版されるべき / pickaxe4-nagoyark05
kakutani
2
290
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
16
120k
Featured
See All Featured
Optimizing for Happiness
mojombo
378
71k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Tell your own story through comics
letsgokoyo
1
1.1k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
710
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
520
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
420
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
600
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
250
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
430
Transcript
vSphere 環境で日本語対応 LLM を利用する Japan VMUG vExpert が語る #32 2023/12/20
本日の内容 VMware Private AI Reference Architecture for Open Sourceを参考に、vSphere環境 で日本語に対応したLLMを利用してみました。
• VMware Private AI Reference Architecture for Open Source https://github.com/vmware-ai-labs/VMware-generative-ai-reference-architecture • Ray Serveを利用した日本語LLM ELYZAの利用 - VMware Private AI https://www.netone.co.jp/media/detail/20231201-1/
VMware Private AI データのプライバシーと管理を可能にし、オープンソースや商用の様々な AIソリューションを環境に合わせて柔 軟に組み合わせて利用し、企業における AIの導入を促進するアーキテクチャ。 • VMware Private
AI Reference Architecture for Open Source • VMware Private AI Foundation with NVIDIA (2024年 提供予定)
ELYZA 株式会社ELYZA社が開発。Metaの「Llama2」をベースに、日本語による追加事前学習 を行なった日本語言語モデル。ELYZA独自の事後学習、日本語の語彙追加により高速 化。Hugging Face上でモデルが公開されている。 https://huggingface.co/elyza/ https://elyza.ai
vSphere環境でLLMを使うステップ 1. vSphereクラスターの作成 2. Supervisor Clusterの有効化 3. Tanzu Kubernetes Clusterの作成
4. GPU Operatorの有効化 5. Ray Operatorの有効化 6. Ray Serveリソースの作成 7. Web UIの作成 (オプション) 今日話す内容
GPU Operator Kubernetesクラスターを構成するノードにGPUのドライバーをインストールする仕組み。 NFD(Node Feature Discovery) Podにより、GPUが搭載されたノードを認識。GPU搭載ノードにだけPodとして ドライバーがインストールされる。 ESXiのGPUをvGPUとしてVMに接続し、Kubernetesノードとして 利用可能。
Kubernetes vSphere Node (VM) vGPU Physical Server GPU Node (VM) vGPU Node (VM) GPU Driver nvidia.com/gpu: 1 NFD GPU Driver NFD NFD
Ray PythonやJavaにおける分散並列処理を高速に実行するためのフレームワークや処理 基盤を提供するオープンソースソフトウェア。Ray ServeはPythonを利用してMLモデル を簡単・スケーラブルにデプロイすることができるモデルサービング機能を提供。 https://www.ray.io/
KubeRay Operator RayをKubernetes上で利用するためのOperator。RayのHead NodeとWorker Nodeを Kubernetes上でPodとして起動。 • Cluster : クラスタの作成/削除、オートスケールなど、
RayClusterのライフサイクルを管理。 • Job : RayClusterを作成してJobを送信。Jobが終了すると自動的に RayClusterを削除可能。 • Service : RayClusterとRay Serveの2つのパートで構成される。 RayClusterのダウンタイムなしのアップ グレードと高可用性を提供。 $ helm repo add kuberay https://ray-project.github.io/kuberay-helm/ $ helm install kuberay-operator kuberay/kuberay-operator --version 0.6.0 $ kubectl get crd | grep ray.io rayclusters.ray.io 2023-12-09T11:33:47Z rayjobs.ray.io 2023-12-09T11:33:47Z rayservices.ray.io 2023-12-09T11:33:47Z
Ray Serveリソース apiVersion: ray.io/v1alpha1 kind: RayService metadata: name: vllm spec:
serveConfigV2: | applications: - name: vllm import_path: Examples.LLM-serving-wt-vLLM-and-RayServe-example.vllm_falcon_7b:deployment runtime_env: working_dir: "https://github.com/vmware-ai-labs/VMware-generative-ai-reference-architecture/archive/refs/heads/main.zip" pip: ["vllm==0.1.3"] workerGroupSpecs: - replicas: 1 minReplicas: 1 maxReplicas: 4 groupName: gpu-group template: spec: containers: - name: ray-worker image: rayproject/ray:2.6.2-py310-cu118 resources: limits: cpu: 32 memory: "64G" nvidia.com/gpu: 1 requests: cpu: 16 memory: "32G" nvidia.com/gpu: 1 rayClusterConfig: rayVersion: '2.6.2' headGroupSpec: serviceType: LoadBalancer rayStartParams: dashboard-host: '0.0.0.0' template: spec: containers: - name: ray-head image: rayproject/ray:2.6.2-py310-cu118 resources: limits: cpu: 32 memory: "64G" requests: cpu: 16 memory: "32G" https://github.com/vmware-ai-labs/VMware-generative-ai-reference-architecture/blob/main/Examples/LLM-serving-wt-vLLM-and-RayServe-example/ray-service.vllm.yaml Ray Cluster上で実行する Pythonアプリケーションを指定する
vLLM vLLM はHugging Face Transformersに対応したさまざまなTransformerモデルをサ ポート。PythonでRay Serveにデプロイするモデルを指定することで、Hugging Face上 のモデルを利用可能。 https://vllm.ai/
リファレンスアーキテクチャではTechnology Innovation Instituteが開発したFalcon-7B (tiiuae/falcon-7b-instruct)が利用されてい るため、ELYZA-japanese-Llama-2-7b (elyza/ELYZA-japanese-Llama-2-7b-fast-instruct)を利用するよう変更。 https://github.com/vmware-ai-labs/VMware-generative-ai-reference-architecture/blob/main/Examples/LLM-serving-wt-vLLM-and-RayServe-example/vllm_falcon_7b.py deployment = VLLMPredictDeployment.bind(model="tiiuae/falcon-7b-instruct", dtype="bfloat16", trust_remote_code=True, ) deployment = VLLMPredictDeployment.bind(model="elyza/ELYZA-japanese-Llama-2-7b-fast-instruct", dtype="bfloat16", trust_remote_code=True, )
Gradio 機械学習モデルを操作するWeb UIを作成するためのPythonライブラリ。シンプルにUI を実装可能。 https://www.gradio.app/ def build_demo(): with gr.Blocks() as
demo: gr.Markdown("# vLLM on Ray Serve: Prompt Completion Demo\n") inputbox = gr.Textbox(label="Input", placeholder="Enter your prompt and press ENTER") outputbox = gr.Textbox(label="Output", placeholder="Prompt completion from the model") inputbox.submit(http_bot, [inputbox], [outputbox]) return demo https://github.com/vmware-ai-labs/VMware-generative-ai-reference-architecture/blob/main/Examples/LLM-serving-wt-vLLM-and-RayServe-example/gradio_webserver.py
システムプロンプトの利用 システムプロンプトを利用して期待通りの回答を得る。 def http_bot(prompt, system_prompt): headers = {"User-Agent": "vLLM Client"}
system_prompt = "あなたは誠実で優秀な日本人のアシスタントです。 " prompt = "<s>[INST]<<SYS>>\n"+system_prompt+"\n<</SYS>>\n\n"+prompt+"[/INST]\n" pload = { "prompt": prompt, "stream": False, "max_tokens": 200, "temperature": 0, "n": 1, "stop": ">", # Stop generation character } response = requests.post(model_url, headers=headers, json=pload, stream=True) for chunk in response.iter_lines(chunk_size=8192, decode_unicode=False, delimiter=b"\0"): if chunk: data = json.loads(chunk.decode("utf-8")) output = data["text"][0] #yield output o = re.sub("<s>\[INST\]<<SYS\>>.*?\[/INST\]\n",'',output, flags=re.DOTALL) #print(o) yield o https://huggingface.co/elyza/ELYZA-japanese-Llama-2-7b-fast-instruct
ありがとうございました