api_key: IAM API키. 새 API 키를 생성하려면 IBM Cloud 웹사이트로 이동하여 관리 > 액세스(IAM) > API 키에서 IBM Cloud Pak for Data API 키 생성을 클릭합니다.
선택사항: 다른 프로젝트의 스크립트를 재사용하는 경우 설정 정보 창에서 업데이트된 project_id, aggregator_id 및 experiment_id 를 복사하여 스크립트에 복사할 수 있습니다.
아직 설치하지 않았다면 최신 연합 학습 패키지와 함께 watsonx.ai Runtime을 설치하세요:
Mac에서 M-series를 사용하는 경우 다음 스크립트를 사용하여 최신 패키지를 설치하십시오.
# -----------------------------------------------------------------------------------------# (C) Copyright IBM Corp. 2023.# https://opensource.org/licenses/BSD-3-Clause# -----------------------------------------------------------------------------------------### Script to create a conda environment and install ibm_watsonx_ai with# the dependencies required for Federated Learning on MacOS.# The name of the conda environment to be created is passed as the first argument.## Note: This script requires miniforge to be installed for conda.#
usage=". install_fl_rt23.1_macos.sh conda_env_name"
arch=$(uname -m)
os=$(uname -s)
if (($# < 1))
thenecho$usageexitfi
ENAME=$1
conda create -y -n ${ENAME} python=3.10
conda activate ${ENAME}
pip install ibm_watsonx_ai
if [ "$os" == "Darwin" -a "$arch" == "arm64" ]
then
conda install -y -c apple tensorflow-deps
fi
python - <<EOF
import pkg_resources
import platform
import subprocess
package = 'ibm_watsonx_ai'
extra = 'fl-rt23.1-py3.10'
extra_ = extra.replace('.','-')
extra_s = '; extra == "{}"'
remove = None
add = []
if platform.system() == "Darwin" and platform.processor() == "arm":
remove = 'tensorflow'
add = ['tensorflow-macos==2.9.2']
pkgs = pkg_resources.working_set.by_key[package].requires(extras=[extra])
pkgs = [ p.__str__().removesuffix(extra_s.format(extra)).removesuffix(extra_s.format(extra_)) for p in pkgs if ( extra in p.__str__() or extra_ in p.__str__() ) and ( not remove or remove not in p.__str__() )]
print( "Installing standard packages for {}[{}]:{}".format(package,extra,pkgs) )
print( "Installing additional packages:{}".format(add) )
cmd = [ 'pip', 'install'] + add + pkgs
subprocess.run( cmd )
EOF
Copy to clipboard클립보드에 복사됨Show more
그렇지 않으면 pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ 'ibm_watsonx_ai[fl-rt23.1-py3.10]' 명령을 사용하여 설치하십시오.
구성이 완료되고 당사자 커넥터 스크립트를 저장하면 명령행에 다음 명령을 입력하여 스크립트를 실행하십시오.