Repository: Lightning-Universe/lightning-flash

Issue:
NameError: name 'K' is not defined
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->
````sh
Uncaught exception
Traceback (most recent call last):
  File "main.py", line 11, in <module>
    datamodule = VideoClassificationData.from_folders(
  File "/home/nitin/github/video_classification/venv/lib/python3.8/site-packages/flash/core/data/data_module.py", line 540, in from_folders
    return cls.from_data_source(
  File "/home/nitin/github/video_classification/venv/lib/python3.8/site-packages/flash/core/data/data_module.py", line 448, in from_data_source
    preprocess = preprocess or cls.preprocess_cls(
  File "/home/nitin/github/video_classification/venv/lib/python3.8/site-packages/flash/video/classification/data.py", line 241, in __init__
    super().__init__(
  File "/home/nitin/github/video_classification/venv/lib/python3.8/site-packages/flash/core/data/process.py", line 196, in __init__
    train_transform = train_transform or self._resolve_transforms(RunningStage.TRAINING)
  File "/home/nitin/github/video_classification/venv/lib/python3.8/site-packages/flash/core/data/process.py", line 247, in _resolve_transforms
    transforms: Optional[Dict[str, Callable]] = resolved_function()
  File "/home/nitin/github/video_classification/venv/lib/python3.8/site-packages/flash/video/classification/data.py", line 307, in default_transforms
    transform=K.VideoSequential(
NameError: name 'K' is not defined
````


### To Reproduce

Steps to reproduce the behavior:

````python
import os
from torch.utils.data.sampler import RandomSampler
import flash
from flash.core.data.utils import download_data
from flash.video import VideoClassificationData, VideoClassifier

# 1. Download a video clip dataset. Find more datasets at https://pytorchvideo.readthedocs.io/en/latest/data.html
download_data("https://pl-flash-data.s3.amazonaws.com/kinetics.zip")

# 2. Load the Data
datamodule = VideoClassificationData.from_folders(
    train_folder=os.path.join(flash.PROJECT_ROOT, "data/kinetics/train"),
    val_folder=os.path.join(flash.PROJECT_ROOT, "data/kinetics/val"),
    predict_folder=os.path.join(flash.PROJECT_ROOT, "data/kinetics/predict"),
    batch_size=8,
    clip_sampler="uniform",
    clip_duration=1,
    video_sampler=RandomSampler,
    decode_audio=False,
    num_workers=8,
)

# 3. Build the model
model = VideoClassifier(backbone="x3d_xs", num_classes=datamodule.num_classes, pretrained=False)

# 4. Create the trainer
trainer = flash.Trainer(max_epochs=3)

# 5. Finetune the model
trainer.finetune(model, datamodule=datamodule)

# 6. Save it!
trainer.save_checkpoint("video_classification.pt")
````

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

### Environment

 - PyTorch Version (e.g., 1.0): 1.9.0
 - OS (e.g., Linux):  Linux (Ubuntu 18.04)
 - How you installed PyTorch: pip
 - Python version: 3.8
 - CUDA/cuDNN version: 11.3
 - GPU models and configuration: GTX 1650 

### Additional Note

<!-- Add any other context about the problem here. -->
Please update the package, `lightning-flash==0.4.0` is not compatible with `pytorchvideo==0.1.2`


Discussion:
Hi @imneonizer thanks for reporting this! We just released a pre-release (0.5.0rc0) that should fix compatibility with pytorchvideo 0.1.2. Could you try installing flash with:
```
pip install --upgrade --pre lightning-flash[video]
```
to see if that fixes the error?

Hope that helps :smiley:
I figured out from the source `flash/video/classification/data.py`
````
if _KORNIA_AVAILABLE:
    import kornia.augmentation as K
````
I didn't had kornia installed hence the above error

Resolving patch:
diff --git a/flash/core/utilities/imports.py b/flash/core/utilities/imports.py
--- a/flash/core/utilities/imports.py
+++ b/flash/core/utilities/imports.py
@@ -133,7 +133,7 @@ class Image(metaclass=MetaImage):
     ]
 )
 _TABULAR_AVAILABLE = _TABNET_AVAILABLE and _PANDAS_AVAILABLE
-_VIDEO_AVAILABLE = _PYTORCHVIDEO_AVAILABLE
+_VIDEO_AVAILABLE = _TORCHVISION_AVAILABLE and _PIL_AVAILABLE and _PYTORCHVIDEO_AVAILABLE and _KORNIA_AVAILABLE
 _IMAGE_AVAILABLE = all(
     [
         _TORCHVISION_AVAILABLE,


Test patch: