Lightning-Universe / Pose-app

A Lightning app for animal pose estimation.
https://pose-app.readthedocs.io
Apache License 2.0
18 stars 1 forks source link

Pose-app[cpu] for everything except training/inference #112

Open hummuscience opened 2 weeks ago

hummuscience commented 2 weeks ago

If I understand things correctly (and correct me if I am wrong), Pose-app will simply not work or install on a machine that does not have CUDA on it.

In my case (and probably in the case of many others), the training/inference is done on different machines (slurm cluster for example) than the frame extraction/labelling/refinement/image diagnostics/video diagnostics.

I think it makes sense to add an option that installs a slimmed-down versionof the pose-app (and lightning pose) that works on CPU machines. Or greys out all the inference/training options because no GPU is detected (without the need to implement inference/training on the GPU).

I am currently using DLC to do everything that doesn't involve training/inference, then convert the project to LP (or copy over the frames and CSV files) and then use LP for training...

I tried to install Pose-app while removing the dali requirement from the requirements file in Pose-app and installing LP with the --no-deps flag. Then installing whatever package is missing (omegaconf and prolog) until I ran into a tensortyping-related issue, and stopped trying.

lightning_app run app app.py
A newer version of lightning is available (2.4.0). Would you like to upgrade? [Y/n]: n
Your Lightning App is starting. This won't take long.
2024-11-01 12:55:48.987 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
2024-11-01 12:55:49.090 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
2024-11-01 12:55:49.091 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
ERROR: Found an exception when loading your application from app.py. Please, resolve it to run your app.

Traceback (most recent call last):
  File "app.py", line 33, in <module>
    from lightning_pose_app.ui.train_infer import TrainUI
  File "/Users/abdelhaym/repos/Pose-app/lightning_pose_app/ui/train_infer.py", line 37, in <module>
    from lightning_pose_app.backend.train_infer import (
  File "/Users/abdelhaym/repos/Pose-app/lightning_pose_app/backend/train_infer.py", line 23, in <module>
    from lightning_pose.utils.predictions import predict_dataset, predict_single_video
  File "/Users/abdelhaym/repos/Pose-app/lightning-pose/lightning_pose/utils/predictions.py", line 17, in <module>
    from torchtyping import TensorType
  File "/Users/abdelhaym/.conda/envs/lai/lib/python3.10/site-packages/torchtyping/__init__.py", line 10, in <module>
    from .tensor_type import TensorType
  File "/Users/abdelhaym/.conda/envs/lai/lib/python3.10/site-packages/torchtyping/tensor_type.py", line 37, in <module>
    class TensorTypeMixin(metaclass=_TensorTypeMeta):
RuntimeError: Cannot subclass _TensorBase directly
themattinthehatt commented 2 weeks ago

@hummuscience yes this would be a good feature to have; we need to figure out if there is an easy way to do a cpu-only installation of lightning pose as a first step. will give this some thought. @ksikka let's discuss this next time we meet