핍으로 설치
다음을 실행하여 TensorFlow Decision Forests를 설치합니다.
# Install TensorFlow Decision Forests.
pip3 install tensorflow_decision_forests --upgrade
그런 다음 다음을 실행하여 설치를 확인합니다.
# Check the version of TensorFlow Decision Forests.
python3 -c "import tensorflow_decision_forests as tfdf; print('Found TF-DF v' + tfdf.__version__)"
소스에서 빌드
리눅스
설정
요구 사항
- 바젤 >= 3.7.2
- 파이썬 >= 3
- 힘내
- Python 패키지: numpy tensorflow pandas
의존성을 손으로 설치하는 대신 TensorFlow Build docker 를 사용할 수 있습니다. 이 옵션을 선택하는 경우 Docker를 설치합니다.
- 도커 .
편집
다음과 같이 TensorFlow Decision Forests를 다운로드합니다.
# Download the source code of TF-DF.
git clone https://github.com/tensorflow/decision-forests.git
cd decision-forests
선택 사항: TensorFlow Decision Forests는 Yggdrasil Decision Forests에 따라 다릅니다. Yggdrasil 코드를 편집하려면 Yggdrasil github를 복제하고 이에 따라 third_party/yggdrasil_decision_forests/workspace.bzl
에서 경로를 변경할 수 있습니다.
옵션: 도커 옵션을 사용하려면 start_compile_docker.sh
스크립트를 실행하고 다음 단계를 계속하십시오. 도커 옵션을 사용하지 않으려면 다음 단계를 직접 계속하세요.
# Optional: Install and start the build docker.
./tools/start_compile_docker.sh
다음 명령을 사용하여 TF-DF의 단위 테스트를 컴파일하고 실행합니다. test_bazel.sh
는 python3.8
및 컴퓨터의 기본 컴파일러에 대해 구성되어 있습니다. 이 구성을 변경하려면 파일을 직접 편집하십시오.
# Build and test TF-DF.
./tools/test_bazel.sh
다음 명령을 사용하여 pip 패키지를 만들고 테스트합니다. python3.8을 사용하려는 Python 버전으로 바꾸십시오. test_bazel.sh
스크립트에서와 동일한 버전의 Python을 사용할 필요는 없습니다.
구성이 manylinux2014 와 호환되는 경우 manylinux2014
호환 pip 패키지가 생성됩니다.
구성이 manylinux2014와 호환되지 않으면 non manylinux2014
와 호환되지 않는 pip 패키지가 생성되고 최종 검사는 실패합니다. 자신의 컴퓨터에서 TF-DF를 사용하고 싶은지 여부는 중요하지 않습니다. 빌드 manylinux2014와 호환되도록 만드는 쉬운 방법은 위에서 언급한 도커를 사용하는 것입니다.
# Build and test a Pip package.
./tools/build_pip_package.sh python3.8
이 명령은 TF-DF pip 패키지를 설치하고 examples/minimal.py
의 예제를 실행합니다. Pip 패키지는 dist/
디렉토리에 있습니다.
호환되는 다른 Python 버전에 대한 Pip 패키지를 만들려면 다음을 실행하세요.
# Install the other versions of python (assume only python3.8 is installed; this is the case in the build docker).
sudo apt-get update && sudo apt-get install python3.7 python3.9 python3-pip
# Create the Pip package for the other version of python
./tools/build_pip_package.sh python3.7
./tools/build_pip_package.sh python3.9
또는 다음 명령을 실행하여 pyenv를 사용하여 호환되는 모든 Python 버전에 대한 pip 패키지를 만들 수 있습니다. 자세한 내용은 tools/build_pip_package.sh
헤더를 참조하세요.
# Build and test all the Pip package using Pyenv.
./tools/build_pip_package.sh ALL_VERSIONS
맥 OS
설정
요구 사항
- Coreutils(
brew install coreutils
로 테스트) - 바젤 >= 3.7.2
- Python >= 3(
brew install python
으로 테스트됨) - 힘내
- JDK 11
- Python 패키지: numpy tensorflow pandas
편집
Docker가 없는 Linux 컴파일과 동일한 단계를 따르십시오.
최종 메모
TF-DF 컴파일은 (2021년 12월 17일부터) TensorFlow Pip 패키지와 TensorFlow Bazel 종속성에 의존합니다. TensorFlow의 작은 부분이 컴파일됩니다. 강력한 단일 워크스테이션에서 TF-DF를 컴파일하는 데 10분 정도 걸립니다.