Skip to content

Commit

Permalink
CI: cache transformers in Azure (#1424)
Browse files Browse the repository at this point in the history
* Apply suggestions from code review

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Borda and pre-commit-ci[bot] authored Jan 4, 2023
1 parent dfa4b37 commit 87b58f9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .azure/gpu-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:

variables:
DEVICES: $( python -c 'name = "$(Agent.Name)" ; gpus = name.split("_")[-1] if "_" in name else "0,1"; print(gpus)' )
HF_CACHE_DIR: "$(Pipeline.Workspace)/ci-cache_huggingface"

container:
image: "$(docker-image)"
Expand Down Expand Up @@ -95,6 +96,19 @@ jobs:
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'GPU: {mgpu}'"
displayName: 'Sanity check'
- task: Cache@2
inputs:
key: transformers | "$(Agent.OS)"
restoreKeys: mykey
path: $(HF_CACHE_DIR)
cacheHitVar: HF_CACHE_RESTORED
- bash: |
printf "cache location: $(HF_CACHE_DIR)\n"
printf "hit the HF cache: $(variables.HF_CACHE_RESTORED)\n"
mkdir -p $(HF_CACHE_DIR) # in case cache was void
ls -lh $(HF_CACHE_DIR) # show what was restored...
displayName: 'Show HF cache'
- bash: python -m pytest torchmetrics --cov=torchmetrics --timeout=120 --durations=50
workingDirectory: src
displayName: 'DocTesting'
Expand All @@ -120,6 +134,8 @@ jobs:
python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,unittest --name="GPU-coverage" --env=linux,azure
ls -l
workingDirectory: tests
env:
TRANSFORMERS_CACHE: $(HF_CACHE_DIR)
displayName: 'Statistics'
- task: PublishTestResults@2
Expand Down

0 comments on commit 87b58f9

Please sign in to comment.