Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SingleImageVideo caching #1330

Merged
merged 9 commits into from
May 31, 2023
Merged

Fix SingleImageVideo caching #1330

merged 9 commits into from
May 31, 2023

Conversation

roomrys
Copy link
Collaborator

@roomrys roomrys commented May 27, 2023

Description

The typehinting of the caching attribute (#1243) caused it to be used by cattrs to determine which type of dataclass to use. However, the older datasets containing SingleImageVideos were now being read in as
NumpyVideos.

This PR

  1. Renames caching to CACHING and
  2. removes the typehinting from CACHING so that cattrs does not use this in (un)structuring. This means that
  3. CACHING is now a (depreciated) class attribute.

Related attempts to fix this problem:

Types of changes

  • Bugfix
  • New feature
  • Refactor / Code style update (no logical changes)
  • Build / CI changes
  • Documentation Update
  • Other (explain)

Does this address any currently open issues?

Outside contributors checklist

  • Review the guidelines for contributing to this repository
  • Read and sign the CLA and add yourself to the authors list
  • Make sure you are making a pull request against the develop branch (not main). Also you should start your branch off develop
  • Add tests that prove your fix is effective or that your feature works
  • Add necessary documentation (if appropriate)

Thank you for contributing to SLEAP!

❤️

@codecov
Copy link

codecov bot commented May 27, 2023

Codecov Report

Merging #1330 (f9bc733) into develop (4525462) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #1330      +/-   ##
===========================================
- Coverage    72.66%   72.66%   -0.01%     
===========================================
  Files          133      133              
  Lines        23675    23695      +20     
===========================================
+ Hits         17204    17217      +13     
- Misses        6471     6478       +7     
Impacted Files Coverage Δ
sleap/gui/app.py 74.80% <ø> (ø)
sleap/io/video.py 91.89% <100.00%> (ø)

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@roomrys roomrys requested a review from talmo May 27, 2023 00:54
@roomrys roomrys marked this pull request as ready for review May 27, 2023 00:55
Copy link
Collaborator

@talmo talmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, let's talk about this one. I don't know how I feel about this being a class-level property instead of instance-level. If the only reason is to get around cattrs, we can add a special case in the structuring blocks...

@roomrys roomrys requested a review from talmo May 31, 2023 20:26
Copy link
Collaborator

@talmo talmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Nit: deprecated not depreciated ;)

@roomrys roomrys merged commit 75822f9 into develop May 31, 2023
@roomrys roomrys deleted the liezl/fix-siv-caching branch May 31, 2023 21:37
roomrys added a commit that referenced this pull request Jun 30, 2023
* Disable data caching by default for SingleImageVideos (#1243)

* Disable data caching by default for SingleImageVideos

* Remove a couple things that shouldn't be in this PR :)

* Centralize video extensions (#1244)

* Add video extension support lists to io.video module

* Use centralized extension definitions

* Remove some unused code

* Add some coverage for indirect coverage reduction

* Fix single frame GUI increment (#1254)

* Fix frame increment for single frame videos

* Add test and lint

* Add video search to "robustify" (excessively) fragile test (#1262)

Add video search to fix fragile test

* Organize docks (#1265)

* Add `DockWidget` class and subclasses

* Create docks in `MainWindow` using `DockWidget` classes

* Remove unused imports

* Fix references in existing tests

* Fix intermittent bug (file-corruption) that has snuck into the tests (#1267)

* Remove corrupted test file

* Add non-corrupted copy of test file

* Rename the file so tests run

* Layout docks in a tab configuration (instead of stacked) (#1289)

* Add tab with to docks (and use `self.model` in table)

* Use `self.model_type` in `create_models`

* Increase GUI crop size range from 512 to 832 (#1295)

* Fix conversion to numpy array when last frame(s) do not have labels (#1307)

* Ensure frames to predict list is unique (#1293)

* Ensure frames to predict list is unique

* Ensure frames to predict on are ordered correctly

* Better frame sorting

* Fix GUI resume training (#1314)

* Do not choose `top_k` instances if `max_instances` < num centroids (#1313)

* Use max_instances as a max without any minimum requirement

* Create test (that fails)

* Fix test by re-init inference model each call

* Do not compute top k if max is greater

* Add `--max_instances` to `sleap-track` and GUI (#1305)

* Expose --max_instances to sleap-track and in GUI

* Lint

* Change shorthand to `-n` for both `sleap-export` and `sleap-track`

* Add test for creating predictor from cli

* Add max instances support to bottom up model (#1306)

* Add max instances support to bottom up model

* Remove unnecessary attribute setter in CLI parser

* Edge case

* Expose max_instances for BU to train/infer GUI

---------

Co-authored-by: roomrys <[email protected]>

* Update docs for `--max_instances` command

* Add test for BU `--max_instances`

---------

Co-authored-by: Talmo Pereira <[email protected]>

* Remove `--labels` and redundant `data_path` (#1326)

* Create copy of config info to modify (gui) (#1325)

* Fixes GPU memory polling using environment variable filtering (#1272)

* add cuda visible gpus to nvidia smi CLI

* tests masked none, single and multiple GPUs

* deal with comma separated lists and test 2 gpus

* clean up system script and better test that actually works

* add a case for cuda_visible_devices = []

* add test for gpu order and length in nvidia and tf

* test nvidia smi indices and checking gpu memory

* fix spaces

* fix linting with Black

* put skips in tests for git not having nvidia-smi

* add doc strings to get_gpu_memory

* set CUDA device order to PCI BUS ID

* test with no nvidia smi + invalid visible devices

* fixed linting again

* remove pci env variable, move to other issue

---------

Co-authored-by: Eric Leonardis <[email protected]>

* Set `split_by_inds`, `test_labels`, and `validation_labels` to default (GUI) (#1331)

* Allow returning PAF graph during low level inference (#1329)

* allow returning the paf graph during low level inference

* reformatted with black

* Fix `SingleImageVideo` caching (#1330)

* Set `SingleImageVideo.caching` as a class attribute

* Modify tests for `SingleImageVideo.caching`

* Add caching as a preference and menu checkbox

* Test `SingleImageVideo.toggle_caching`

* Remove GUI elements for `SingleImageVideo.CACHING`

* Remove remaining prefs for `SingleImageVideo.CACHING`

* Add depreciated comment

* Clean-up

* Update comments

* Bump to 1.3.1 (#1335)

* Bump to 1.3.1

* Test build to dev label

* Update environment creation (#1366)

* First 'working' env for 1.3.1, no GPU...

* First working 1.3.1 w/gpu

* Sorry, this is the first gpu working env

* Fix `imgstore` version-dependent bug

* Build and entry points work, but pip packages not installed

* Add default channels in condarc.yaml

* Rename environment.yaml to .yml

* Working build no gpu (documented)

* Env working w/gpu using tensorflow from pypi

* Working build with GPU! And pip dep

* Attempt to fix cannot find wheel ~= 0.35 issue

* Run constrain everything

* Use minimal conda req for install_requires, inc build number to get it working

* Ubuntu build and environments working

* Env creation working on M2

* Build and env working on windows (again)

* Apple silicon (M2) build working

* Pip package working (M2)

* Exclude tests and docs from pypi wheel

* Add comments to requirements

* Get ready for manual build

* Update os images, trigger dev build

* Retry manual build win and mac

* Retry mac manual build (to upload)

* Require latest pynwb, remove setuptools

* Remove old mac environment

* Add twine as a build dependency

* Add comments to manual build

* Update build.yml

* Rename "apple_silicon" to "mac"

* Update installation docs (#1365)

* Update installation docs

* Trigger website build

* Update quick install and build docs

* Add Mambaforge links

* Remove comment about experimental apple silicon support

Co-authored-by: Talmo Pereira <[email protected]>

* Fix minor typo

* Change installation docs to reference universal mac env

---------

Co-authored-by: Talmo Pereira <[email protected]>

* More flexible with python version ~=3.7

* Pin py3.7.12 for host and run (good on win)

* Add comments for why python ~=3.7

* Update ci workflow (#1371)

* Update CI workflow to include mac

* Trigger CI workflow

* Remove verbose? python version

* Migrate to micromamba

* Explicitly state environment name

* Remove environment chaching (for now)

* Use different environment file for mac

* Use correct syntax

* Add `env_hash` and `bash -l {0}`

* Remove env_file

* Try different nested variable call via format

* Use correct syntax

* Update env file reference AS -> mac

* Different path to environment file

* Checkout repo

* Use default shells

* Remove unused comments

* Fix caching attempt by changing caching key

* Remove environment caching

* Increase python in no_cuda to 3.7.17

* Less restrictive with python ~3.7 version

* More direct installation docs 🤞

* Increase build numbers for develop branch build

---------

Co-authored-by: Talmo Pereira <[email protected]>

---------

Co-authored-by: Talmo Pereira <[email protected]>
Co-authored-by: Eric Leonardis <[email protected]>
Co-authored-by: Eric Leonardis <[email protected]>
Co-authored-by: Caleb Weinreb <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants