iT邦幫忙

2023 iThome 鐵人賽

DAY 20
0
AI & Data

MLOps/LLMOps - 從零開始系列 第 20

Day20 - Ray Cluster 安裝之二: Ray Cluster 安裝 (single-node) 與測試

  • 分享至 

  • xImage
  •  

安裝 Ray 與相關套件

  1. 安裝 Python & pip

    • sudo apt install python3 python3-pip
    • sudo apt install python-is-python3
  2. 安裝 Ray

    • pip install ray[default]

      $ pip show ray
      
      Name: ray
      Version: 2.7.0
      Summary: Ray provides a simple, universal API for building distributed applications.
      Home-page: https://github.com/ray-project/ray
      Author: Ray Team
      Author-email: ray-dev@googlegroups.com
      License: Apache 2.0
      Location: /home/jimmyliao/.local/lib/python3.10/site-packages
      Requires: aiosignal, click, filelock, frozenlist, jsonschema, msgpack, numpy, packaging, protobuf, pyyaml, requests
      Required-by:     
      

測試 Ray

  1. 建立 Ray head node

    • ray start --head

      $ ray start --head
      Enable usage stats collection? This prompt will auto-proceed in 10 seconds to avoid blocking cluster startup. Confirm [Y/n]: y
      Usage stats collection is enabled. To disable this, add `--disable-usage-stats` to the command that starts the cluster, or run the following command: `ray disable-usage-stats` before starting the cluster. See https://docs.ray.io/en/master/cluster/usage-stats.html for more details.
      
      Local node IP: 10.0.0.14
      
      --------------------
      Ray runtime started.
      --------------------
      
      Next steps
      To add another node to this Ray cluster, run
          ray start --address='10.0.0.14:6379'
      
      
  2. 建立測試程式

    • test.py
      import ray
      ray.init(address='auto')
      @ray.remote
      def f():
          return 1
      f.remote()
      
  3. 執行測試程式

    • python test.py
    2023-10-05 15:31:34,673	INFO worker.py:1458 -- Connecting to existing Ray cluster at address: 10.0.0.14:6379...
    2023-10-05 15:31:34,684	INFO worker.py:1633 -- Connected to Ray cluster. View the dashboard at 127.0.0.1:8265
    
  4. 查看結果

    • ray dashboard

      https://ithelp.ithome.com.tw/upload/images/20231005/20091643xVY9yvpj9m.png

      https://ithelp.ithome.com.tw/upload/images/20231005/20091643ZN9aUejqPh.png

  5. 停止 Ray head node

    • ray stop

Reference:


上一篇
Day19 - Ray Cluster 安裝之一: 基礎環境準備
下一篇
Day21 - Ray Dashboard
系列文
MLOps/LLMOps - 從零開始30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言