Running ‘testthat.R’ [208s/167s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > library(testthat)
  > library(asleep)
  > 
  > asleep:::cleanup_uv_lock_files(
  +   c(".", tempdir(), dirname(tempdir()))
  + )
  > testthat::test_check("asleep")
  Downloading uv...Done!
  Downloading cpython-3.8.20-macos-aarch64-none (download) (16.6MiB)
   Downloaded cpython-3.8.20-macos-aarch64-none (download)
     Building antlr4-python3-runtime==4.9.3
     Building importlib==1.0.4
     Updating https://github.com/muschellij2/asleep.git (HEAD)
  Downloading networkx (2.0MiB)
  Downloading scipy (27.5MiB)
  Downloading llvmlite (27.4MiB)
  Downloading statsmodels (9.6MiB)
  Downloading pandas (10.2MiB)
  Downloading numba (2.5MiB)
  Downloading numpy (13.2MiB)
  Downloading torch (59.3MiB)
  Downloading fonttools (2.6MiB)
  Downloading scikit-learn (7.2MiB)
  Downloading matplotlib (7.0MiB)
  Downloading pillow (3.2MiB)
  Downloading transforms3d (1.3MiB)
  Downloading torchvision (1.6MiB)
  Downloading sympy (5.9MiB)
        Built importlib==1.0.4
        Built antlr4-python3-runtime==4.9.3
   Downloaded transforms3d
   Downloaded torchvision
   Downloaded fonttools
     Building pyyaml==6.0.3
   Downloaded pillow
   Downloaded networkx
   Downloaded numba
   Downloaded matplotlib
   Downloaded scikit-learn
   Downloaded sympy
   Downloaded pandas
   Downloaded statsmodels
   Downloaded numpy
   Downloaded llvmlite
   Downloaded scipy
      Updated https://github.com/muschellij2/asleep.git (4916a50c61dfe513a04ab340da3bfc4bd93dc96d)
     Building asleep @ git+https://github.com/muschellij2/asleep.git@4916a50c61dfe513a04ab340da3bfc4bd93dc96d
   Downloaded torch
        Built asleep @ git+https://github.com/muschellij2/asleep.git@4916a50c61dfe513a04ab340da3bfc4bd93dc96d
        Built pyyaml==6.0.3
  Installed 50 packages in 800ms
  Checking Data
  File is:/Volumes/Builds/packages/big-sur-arm64/results/4.5/asleep.Rcheck/asleep/extdata/example_sleep.csv.gz
  Downloading models if not already present
  Downloading https://github.com/OxWearables/asleep/releases/download/0.4.12/ssl.joblib.lzma...
  Saved to /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/ssl.joblib.lzma
  Caching ssl-wearables repository...
  Downloading: "https://github.com/OxWearables/ssl-wearables/zipball/v1.0.0" to /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/torch_hub_cache/v1.0.0.zip
  Caching SleepNet repository and weights...
  Downloading: "https://github.com/OxWearables/asleep/zipball/main" to /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/torch_hub_cache/main.zip
  Downloading: "https://github.com/OxWearables/asleep/releases/download/0.4.9/sleepnet_apr_16_2024.mdl" to /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/torch_hub_cache/checkpoints/sleepnet_apr_16_2024.mdl
  
    0%|          | 0.00/232M [00:00<?, ?B/s]
    3%|▎         | 7.00M/232M [00:00<00:03, 72.2MB/s]
    6%|▌         | 14.0M/232M [00:00<00:06, 36.4MB/s]
    9%|▊         | 20.1M/232M [00:00<00:07, 30.6MB/s]
   13%|█▎        | 30.1M/232M [00:00<00:06, 33.6MB/s]
   17%|█▋        | 38.5M/232M [00:01<00:04, 43.5MB/s]
   19%|█▉        | 43.8M/232M [00:01<00:05, 35.7MB/s]
   22%|██▏       | 50.1M/232M [00:01<00:05, 32.8MB/s]
   26%|██▌       | 60.1M/232M [00:01<00:05, 34.8MB/s]
   30%|███       | 70.1M/232M [00:02<00:04, 35.8MB/s]
   35%|███▍      | 80.1M/232M [00:02<00:04, 36.1MB/s]
   39%|███▊      | 89.5M/232M [00:02<00:03, 45.0MB/s]
   41%|████      | 94.9M/232M [00:02<00:04, 33.2MB/s]
   43%|████▎     | 100M/232M [00:03<00:04, 29.3MB/s] 
   47%|████▋     | 108M/232M [00:03<00:03, 37.0MB/s]
   49%|████▊     | 113M/232M [00:03<00:03, 32.0MB/s]
   52%|█████▏    | 120M/232M [00:03<00:03, 30.7MB/s]
   55%|█████▍    | 127M/232M [00:03<00:02, 37.8MB/s]
   57%|█████▋    | 132M/232M [00:03<00:03, 31.8MB/s]
   60%|██████    | 140M/232M [00:04<00:02, 40.3MB/s]
   62%|██████▏   | 145M/232M [00:04<00:04, 20.8MB/s]
   65%|██████▍   | 150M/232M [00:04<00:04, 21.4MB/s]
   69%|██████▊   | 159M/232M [00:05<00:02, 30.7MB/s]
   71%|███████   | 164M/232M [00:05<00:02, 28.2MB/s]
   73%|███████▎  | 170M/232M [00:05<00:02, 27.4MB/s]
   78%|███████▊  | 180M/232M [00:05<00:01, 30.9MB/s]
   81%|████████▏ | 189M/232M [00:05<00:01, 40.4MB/s]
   84%|████████▍ | 195M/232M [00:06<00:01, 34.6MB/s]
   86%|████████▌ | 200M/232M [00:06<00:01, 31.4MB/s]
   90%|█████████ | 210M/232M [00:06<00:00, 33.1MB/s]
   95%|█████████▍| 220M/232M [00:06<00:00, 34.5MB/s]
   99%|█████████▉| 230M/232M [00:07<00:00, 43.9MB/s]
  100%|██████████| 232M/232M [00:07<00:00, 33.4MB/s]Parsing raw data
  All models downloaded successfully.
  
  /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/utils.py:44: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
    data = pd.read_csv(
  Lowpass filter...
  Skipping lowpass filter: data sample rate 30 too low for cutoff rate 20
  Lowpass filter... Done! (0.00s)
  Gravity calibration...
  Gravity calibration... Done! (0.03s)
  Resampling...
  Resampling... Done! (0.10s)
  {'WearTime(days)': 0.1666662808564815, 'NonwearTime(days)': 0.0, 'NumNonwearEpisodes': 0}
  Time shift applied: 0 hours
  Raw data file saved to: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/raw.csv
  Info data file saved to: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/info.json
                             time         x         y         z  non_wear
  0 2000-01-04 20:00:00.000000000 -0.704000  0.413000 -0.540000     False
  1 2000-01-04 20:00:00.033333333 -0.720795  0.419000 -0.561667     False
  2 2000-01-04 20:00:00.066666666 -0.665154  0.428846 -0.578590     False
  3 2000-01-04 20:00:00.100000000 -0.698000  0.434000 -0.525000     False
  4 2000-01-04 20:00:00.133333333 -0.674051  0.417308 -0.575385     False
  Transforming data for model input
  Data shape for data2model: (480, 3, 900)
  Data shape for times: (480,)
  Data shape for nonwear: (480,)
  Detecting sleep windows
  args$outdir/Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62
  ssl_sleep_path: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/ssl_sleep.npy, exists:FALSE
  data2model
  array([[[-0.704     , -0.72079488, -0.66515385, ..., -0.69130774,
           -0.69115383, -0.6903333 ],
          [ 0.413     ,  0.419     ,  0.42884615, ...,  0.42430774,
            0.42807678,  0.44416667],
          [-0.54      , -0.56166666, -0.57858971, ..., -0.55976925,
           -0.59274354, -0.61691666]],
  
         [[-0.689     , -0.61469231, -0.58484615, ..., -0.62961541,
           -0.62735884, -0.62341669],
          [ 0.469     ,  0.42923077,  0.43343586, ...,  0.466     ,
            0.46      ,  0.45547223],
          [-0.648     , -0.55720514, -0.58207693, ..., -0.57223075,
           -0.57330765, -0.56950002]],
  
         [[-0.625     , -0.62246154, -0.63430771, ..., -0.73707666,
           -0.73812797, -0.74825001],
          [ 0.457     ,  0.45953846,  0.46923078, ...,  0.18476925,
            0.19420501,  0.20291666],
          [-0.56      , -0.548     , -0.56430771, ..., -0.64523075,
           -0.6363847 , -0.65150002]],
  
         ...,
  
         [[-0.032     , -0.032     , -0.032     , ..., -0.032     ,
           -0.032     , -0.032     ],
          [-0.123     , -0.123     , -0.123     , ..., -0.123     ,
           -0.123     , -0.123     ],
          [-0.988     , -0.988     , -0.988     , ..., -0.988     ,
           -0.988     , -0.988     ]],
  
         [[-0.032     , -0.032     , -0.032     , ..., -0.032     ,
           -0.032     , -0.032     ],
          [-0.123     , -0.123     , -0.123     , ..., -0.123     ,
           -0.123     , -0.123     ],
          [-0.988     , -0.988     , -0.988     , ..., -0.988     ,
           -0.988     , -0.988     ]],
  
         [[-0.032     , -0.032     , -0.032     , ..., -0.032     ,
           -0.032     , -0.032     ],
          [-0.123     , -0.123     , -0.123     , ..., -0.123     ,
           -0.123     , -0.123     ],
          [-0.988     , -0.988     , -0.988     , ..., -0.988     ,
           -0.988     , -0.988     ]]])
  non_wear
  array([False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False, False, False, False, False, False, False,
         False, False, False])
  Data2model file saved to: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/data2model.npy
  Times file saved to: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/times.npy
  Non-wear file saved to: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/non_wear.npy
  Downloading https://github.com/OxWearables/asleep/releases/download/0.4.12/ssl.joblib.lzma...
  prediction set sample count: 480
  Using local /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/torch_hub_cache/OxWearables_ssl-wearables_v1.0.0
  
    0%|          | 0/1 [00:00<?, ?it/s]
  100%|██████████| 1/1 [00:22<00:00, 22.84s/it]Running SleepNet
  SleepNet outdir: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62
  Upstream ssl model path: /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/ssl.joblib.lzma, exists: TRUE
  SleepNet weight URL: https://github.com/OxWearables/asleep/releases/download/0.4.9/sleepnet_apr_16_2024.mdl
  SleepNet artifact ssl_sleep: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/ssl_sleep.npy, exists: TRUE
  SleepNet artifact y_pred: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/y_pred.npy, exists: FALSE
  SleepNet artifact pred_prob: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/pred_prob.npy, exists: FALSE
  SleepNet artifact x_npy: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/X.npy, exists: TRUE
  SleepNet artifact x_npy_gz: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/X.npy.gz, exists: FALSE
  SleepNet artifact npid: /Volumes/Temp/tmp/Rtmp7Udom7/file2e72e501f62/npid.npy, exists: TRUE
  (480,)
  (array([0., 2., 3.]), array([ 79,  45, 356]))
  
  /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/sleepnet.py:207: Hydra14MigrationWarning: 
  The version_base parameter is not specified.
  Hydra will assume defaults for version 1.1.
  Hydra 1.4 will remove this compatibility behavior.
  Before upgrading to Hydra 1.4, set version_base="1.3" and test your application.
  See https://hydra.cc/docs/upgrades/1.3_to_1.4/prepare_for_1_4/ for preparation instructions.
    initialize(config_path="conf")
  pytorch device: mps
  setting up cnn
  access local repo
  Loading local weight from /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/torch_hub_cache/checkpoints/sleepnet_apr_16_2024.mdl
  /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/cache/archive-v0/Wq-o2EF5yp1-i9D7/lib/python3.8/site-packages/asleep/torch_hub_cache/OxWearables_asleep_main/hubconf.py:22: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
    state_dict = torch.load(local_weight_path,
  Saving _problems/test-asleep-20.R
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 67 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-asleep.R:20:5'): asleep model works ────────────────────────────
  <python.builtin.RuntimeError/python.builtin.Exception/python.builtin.BaseException/python.builtin.object/error/condition>
  Error in `py_call_impl(callable, call_args$unnamed, call_args$named)`: RuntimeError: MPS backend out of memory (MPS allocated: 8.00 MB, other allocations: 272.00 KB, max allowed: 1.70 GB). Tried to allocate 256 bytes on shared pool. Use PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0 to disable upper limit for memory allocations (may cause system failure).
  Run `reticulate::py_last_error()` for details.
  Backtrace:
      ▆
   1. └─asleep::asleep(file = file, verbose = 2L, force_download = TRUE) at test-asleep.R:20:5
   2.   └─reticulate (local) start_sleep_net(...)
   3.     └─reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
  
  [ FAIL 1 | WARN 0 | SKIP 0 | PASS 67 ]
  Error:
  ! Test failures.
  Execution halted
  /Users/rbuild/Library/Caches/org.R-project.R/R/reticulate/uv/python/cpython-3.8.20-macos-aarch64-none/lib/python3.8/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
    warnings.warn('resource_tracker: There appear to be %d '