ladaapp / lada

Remove and restore videos with pixelated/mosaic regions
GNU Affero General Public License v3.0
1 stars 0 forks source link

Recommendation to get started #1

Open leoRubberduck opened 2 days ago

leoRubberduck commented 2 days ago

Hi , it's says Linux. Does that mean I need to use Ubuntu on my windows PC on subshell. I currently have

Windows 11, gtx 3060 12GB, I 5 10th gen , 16GB ram

And a MacBook Pro.

ladaapp commented 2 days ago

Hi. Yes, probably, but cannot give much advise as I only use Linux. You probably have a better chance to run it on your Nvidia PC.

Installing the system dependencies python/gstreamer/ffmpeg shouldn't be too hard on Ubuntu as all of it should be available in their package repository.

After installing the python package/dependencies you can check first if your GPU is detected properly. In python:

import torch
torch.cuda.is_available()

That should print true

On MacOS you may be able to install the system dependencies via homebrew. But there are probably some changes necessary to make it run on ARM / Apple Silicon.

Good luck!

ladaapp commented 2 days ago

I've updated the installation instruction a little bit and gave a bit more pointers. Didn't notice any Linux-only dependencies so if you prefer you could also try to run it directly on Windows as an alternative to WSL

leoRubberduck commented 2 days ago

What do you mean run it directly on Windows without WSL? Do you mean use PowerShell or something to install it?

ladaapp commented 2 days ago

Yes but if you're able to install ubuntu via WSL then that would probably be easiest route as you can get those system dependencies all from the repository.

leoRubberduck commented 2 days ago

Yeah there seems to be a problem. I followed these steps below:

I get stuck when it tries to build dependencies :

python -m pip install -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.4/index.html -e ".[basicvsrpp,gui]"

gives me this error:

Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [24 lines of output]

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details. (.venv) kl18@DESKTOP-JR92L95:~/lada$

The steps I follow are :

To install and run Lada on Ubuntu, follow these steps:

Prerequisites

  1. NVIDIA GPU and CUDA: You’ll need an NVIDIA GPU and CUDA installed for processing. To set up CUDA, follow the CUDA installation guide for Ubuntu.
  2. Python 3.12: The instructions specify Python 3.12, so ensure you have it installed. Ubuntu 22.04 or later may not come with this version by default, so you might need to install it manually.

Step-by-Step Installation on Ubuntu

  1. Update and Install Dependencies:

    • Update your system and install essential tools:
      sudo apt update
      sudo apt install -y git wget python3.12 python3.12-venv python3.12-dev
  2. Install FFmpeg and GStreamer:

    • These are necessary for video processing:
      sudo apt install -y ffmpeg
      sudo apt install -y gstreamer1.0-plugins-{base,bad,good} gstreamer1.0-libav
  3. Download the Repository:

    • Clone the repository and navigate into it:
      git clone https://github.com/ladaapp/lada.git
      cd lada
  4. Set Up a Virtual Environment:

    • Create and activate a virtual environment:
      python3.12 -m venv .venv
      source .venv/bin/activate
  5. Install Dependencies from PyPI:

    • Use the specified link to install dependencies with the command below:
      python -m pip install -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.4/index.html -e ".[basicvsrpp,gui]"
  6. Apply Required Patches:

    • Apply patches to fix any issues within dependencies:
      patch -u ./.venv/lib/python3.12/site-packages/mmagic/__init__.py  -i patches/bump_mmagic_mmcv_dependency_bound.patch
      patch -u ./.venv/lib/python3.12/site-packages/mmagic/models/editors/vico/vico_utils.py -i patches/fix_diffusers_import.patch
      patch -u ./.venv/lib/python3.12/site-packages/mmengine/runner/loops.py -i patches/adjust_mmengine_resume_dataloader.patch
      patch -u ./.venv/lib/python3.12/site-packages/mmagic/models/losses/perceptual_loss.py -i patches/enable_loading_vgg19_from_local_file.patch
  7. Download Model Files:

    • Download the pretrained model files needed for the program to work:
      mkdir -p model_weights/3rd_party
      wget -P model_weights/ 'https://github.com/ladaapp/lada/releases/download/v0.1.0/lada_mosaic_detection_model.pt'
      wget -P model_weights/ 'https://github.com/ladaapp/lada/releases/download/v0.1.0/lada_mosaic_restoration_model_generic.pth'
      wget -P model_weights/ 'https://github.com/ladaapp/lada/releases/download/v0.1.0/lada_mosaic_restoration_model_bj_pov.pth'
      wget -P model_weights/3rd_party/ 'https://download.openmmlab.com/mmediting/restorers/basicvsr/spynet_20210409-c6c1bd09.pth'
      wget -P model_weights/3rd_party/ 'https://download.pytorch.org/models/vgg19-dcbb9e9d.pth'
      wget -P model_weights/3rd_party/ 'https://github.com/QualityAssessment/DOVER/releases/download/v0.1.0/DOVER.pth'
      wget -P model_weights/ 'https://github.com/ladaapp/lada/releases/download/v0.1.0/lada_nsfw_detection_model.pt'
  8. Run the GUI or CLI:

    • GUI: Run the GUI application by entering:
      python lada.py
    • CLI: Use the command-line interface with:
      lada-cli --input "<input video path>" --output "<output video path>"

Additional Notes

note: This is an issue with the package mentioned above, not pip. hint: See above for details. (.venv) kl18@DESKTOP-JR92L95:~/lada$

ladaapp commented 1 day ago

Please check-out latest master / https://github.com/ladaapp/lada/commit/3d752f46e0459099d67e6338ee51b13d7492aa35 I've missed to mention GTK dependency earlier. You can find instructions on their page to install it on Ubuntu This should fix this error you've posted:

  ../meson.build:31:9: ERROR: Dependency 'gobject-introspection-1.0' is required but not found.
leoRubberduck commented 1 day ago

I downloaded successfully all the build dependencies and did the latest master pull with your changes but when i tried to run the programme I am getting this error:

(.venv) kl18@DESKTOP-JR92L95:~/lada$ python lada/gui/main.py

MESA: error: ZINK: failed to choose pdev libEGL warning: egl: failed to create dri2 screen MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen Creating new Ultralytics Settings v0.0.6 file ✅ View Ultralytics Settings with 'yolo settings' or at '/home/kl18/.config/Ultralytics/settings.json' Update Settings with 'yolo settings key=value', i.e. 'yolo settings runs_dir=path/to/dir'. For help see https://docs.ultralytics.com/quickstart/#ultralytics-settings.

(python:3765): Gtk-CRITICAL **: 16:14:25.798: Error building template class 'VideoPreview' for an instance of type 'VideoPreview': .:0:0 Invalid object type 'AdwSpinner' Traceback (most recent call last): File "/home/kl18/lada/.venv/lib/python3.12/site-packages/gi/_gtktemplate.py", line 170, in lambda s: init_template(s, cls, base_init_template) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kl18/lada/.venv/lib/python3.12/site-packages/gi/_gtktemplate.py", line 193, in init_template raise RuntimeError( RuntimeError: Handler 'button_play_pause_callback' was declared with @Gtk.Template.Callback but was not present in template Traceback (most recent call last): File "/home/kl18/lada/lada/gui/video_preview.py", line 57, in init self.widget_timeline.connect('seek_requested', lambda widget, seek_position: self.seek_video(seek_position)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'connect'

(python:3765): Gtk-CRITICAL **: 16:14:25.798: Error building template class 'MainWindow' for an instance of type 'MainWindow': .:0:0 Invalid object type 'AdwSpinner' Traceback (most recent call last): File "/home/kl18/lada/.venv/lib/python3.12/site-packages/gi/_gtktemplate.py", line 170, in lambda s: init_template(s, cls, base_init_template) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kl18/lada/.venv/lib/python3.12/site-packages/gi/_gtktemplate.py", line 193, in init_template raise RuntimeError( RuntimeError: Handler 'button_open_file_callback' was declared with @Gtk.Template.Callback but was not present in template Traceback (most recent call last): File "/home/kl18/lada/lada/gui/main.py", line 36, in do_activate win = MainWindow(application=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/kl18/lada/lada/gui/window.py", line 50, in init self.stack.add_controller(drop_target) ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'add_controller'

I am working on it to fix it

leoRubberduck commented 1 day ago

The latest GTK Dependencies was installed successfully too

(.venv) kl18@DESKTOP-JR92L95:~/lada$ # Implementation (.venv) kl18@DESKTOP-JR92L95:~/lada$ sudo apt install libadwaita-1-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done libadwaita-1-dev is already the newest version (1.5.0-1ubuntu2). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

It is suggesting problem is with the call back function

ladaapp commented 9 hours ago

MESA: error: ZINK: failed to choose pdev libEGL warning: egl: failed to create dri2 screen MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen

These logs indicate that there is an issue with MESA / OpenGL driver. You're running this on WSL, right? Maybe you need additional steps to run a GUI on WSL. I found this when googling for OpenGL on WSL, maybe it helps.

leoRubberduck commented 8 hours ago

No worries I have replaced the OS now to linix mint as I need Linux for my studies