config.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # Use 2.1 for orbs
  2. version: 2.1
  3. # -------------------------------------------------------------------------------------
  4. # Environments to run the jobs in
  5. # -------------------------------------------------------------------------------------
  6. gpu: &gpu
  7. environment:
  8. CUDA_VERSION: "11.2"
  9. machine:
  10. image: ubuntu-2004-cuda-11.2:202103-01
  11. resource_class: gpu.nvidia.medium.multi
  12. # -------------------------------------------------------------------------------------
  13. # Re-usable commands
  14. # -------------------------------------------------------------------------------------
  15. cache_key: &cache_key cache-key-{{ .Environment.CIRCLE_JOB }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "setup.py"}}
  16. install_dep_pt1_10: &install_dep_pt1_10
  17. - run:
  18. name: Install Pytorch Dependencies
  19. command: |
  20. source activate fairseq
  21. pip install --upgrade setuptools
  22. pip install torch==1.10.1+cu111 torchaudio==0.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html
  23. python -c 'import torch; print("Torch version:", torch.__version__)'
  24. install_dep_pt1_12: &install_dep_pt1_12
  25. - run:
  26. name: Install Pytorch Dependencies
  27. command: |
  28. source activate fairseq
  29. pip install --upgrade setuptools
  30. pip install torch==1.12.1+cu116 torchaudio==0.12.1+cu116 -f https://download.pytorch.org/whl/torch_stable.html
  31. python -c 'import torch; print("Torch version:", torch.__version__)'
  32. install_repo: &install_repo
  33. - run:
  34. name: Install Repository
  35. command: |
  36. source activate fairseq
  37. python -m pip install fairscale
  38. python -m pip install -e '.[dev,docs]'
  39. python -c 'import torch; print("Torch version:", torch.__version__)'
  40. run_unittests: &run_unittests
  41. - run:
  42. name: Run Unit Tests
  43. command: |
  44. source activate fairseq
  45. pytest tests/gpu/test_binaries_gpu.py
  46. check_nvidia_driver: &check_nvidia_driver
  47. - run:
  48. name: Check NVIDIA Driver
  49. working_directory: ~/
  50. command: |
  51. pyenv versions
  52. nvidia-smi
  53. create_conda_env: &create_conda_env
  54. - run:
  55. name: Install and Create Conda Environment
  56. command: |
  57. curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
  58. chmod +x ~/miniconda.sh
  59. bash ~/miniconda.sh -b -p $HOME/miniconda
  60. rm ~/miniconda.sh
  61. echo 'export PATH=$HOME/miniconda/bin:$PATH' >> $BASH_ENV
  62. source $BASH_ENV
  63. if [ ! -d ~/miniconda/envs/fairseq ]
  64. then
  65. conda create -y -n fairseq python=3.8
  66. fi
  67. source activate fairseq
  68. python --version
  69. pip install --upgrade pip
  70. # -------------------------------------------------------------------------------------
  71. # Jobs to run
  72. # -------------------------------------------------------------------------------------
  73. jobs:
  74. gpu_tests_pt1_10:
  75. <<: *gpu
  76. working_directory: ~/fairseq-py
  77. steps:
  78. - checkout
  79. - <<: *check_nvidia_driver
  80. - <<: *create_conda_env
  81. - restore_cache:
  82. key: *cache_key
  83. - <<: *install_dep_pt1_10
  84. - save_cache:
  85. paths:
  86. - ~/miniconda/
  87. key: *cache_key
  88. - <<: *install_repo
  89. - <<: *run_unittests
  90. gpu_tests_pt1_12:
  91. <<: *gpu
  92. working_directory: ~/fairseq-py
  93. steps:
  94. - checkout
  95. - <<: *check_nvidia_driver
  96. - <<: *create_conda_env
  97. - restore_cache:
  98. key: *cache_key
  99. - <<: *install_dep_pt1_12
  100. - save_cache:
  101. paths:
  102. - ~/miniconda/
  103. key: *cache_key
  104. - <<: *install_repo
  105. - <<: *run_unittests
  106. workflows:
  107. version: 2
  108. build:
  109. jobs:
  110. - gpu_tests_pt1_12
  111. - gpu_tests_pt1_10