BrokenSource / DepthFlow

🌊 Images to → 2.5D Parallax Effect Video. A Free and Open Source ImmersityAI alternative
https://brokensrc.dev
MIT License
484 stars 32 forks source link

how to open after the installation? #11

Closed onlysharma0852 closed 8 months ago

onlysharma0852 commented 8 months ago

how do i open it after installing it in my system? shaderflow is also needed or not?

onlysharma0852 commented 8 months ago

it saying that

AttributeError: module 'signal' has no attribute 'SIGKILL'

what to do?

Tremeschin commented 8 months ago

Hi, sorry for taking a few hours I was with family

I think I know what is causing this, related issue on yaspin/43, I went blind first and didn't test on Windows beforehand

This is non ideal but for now you can replace all occurences of -

from yaspin import kbi_safe_yaspin as yaspin

-in all the code base with just from yaspin import yaspin, until I find a better solution

I'll probably write my own basic spinner class, it's not that hard, halo starts too slow, and I'm having this threading/sticky or stuck spinner with yaspin (+ issues like yours)


shaderflow is also needed or not?

Yup, it should come along cloning the main repository and its submodules as seen in the Windows .ps1 script and Linux/Mac one, depthflow is just a "rebranded" specific scene of shaderflow that requires some extra stuff

onlysharma0852 commented 8 months ago

some says that Replacing SIGKILL with SIGTERM might work. so where is the file location?

 return out

  def _register_signal_handlers(self) -> None:
      # SIGKILL cannot be caught or ignored, and the receiving
      # process cannot perform any clean-up upon receiving this
      # signal.
>     if signal.SIGKILL in self._sigmap:
          raise ValueError(
              "Trying to set handler for SIGKILL signal. "
              "SIGKILL cannot be caught or ignored in POSIX systems."
          )
      for sig, sig_handler in self._sigmap.items():
          # A handler for a particular signal, once set, remains
          # installed until it is explicitly reset. Store default
          # signal handlers for subsequent reset at cleanup phase.
          dfl_handler = signal.getsignal(sig)
          self._dfl_sigmap[sig] = dfl_handler

AttributeError:
module 'signal' has no attribute 'SIGKILL'``

this is the error

Tremeschin commented 8 months ago

It'll be located on Python's virtual environment on yaspin package core.py file

On Windows IIRC that would be %localappdata%\pypoetry\cache\virtualenvs\(all)\Lib\site-packages\yaspin\core.py


Probably will require changing on both shaderflow's and broken-source venvs there, imo changing the import to the regular yaspin than kbi_safe_yaspin will be easier

I'm multitasking a bit right now but will mock up a simple spinner class soon to deprecate yaspin

onlysharma0852 commented 8 months ago

Ok done. Its working now. Just replaced SIGKILL with SIGTERM.

Tremeschin commented 8 months ago

just commited the new spinner class!

they're just for like, knowing the code is doing something on some long import or blocking sequences

there's changes involved in the main repository and Projects/ShaderFlow submodule, you can cd into those and git checkout Master and git pull or just reclone everything

I'll test on Windows eventually but there's a low chance of errors, I'd be happy if you can feedback!

onlysharma0852 commented 8 months ago

Broken starts working after changing SIGKILL to SIGTERM. But now depthflow is not working.

Tremeschin commented 8 months ago

This sigkill to sigterm shouldn't affect current code anymore as it's not using yaspin package

There weren't any changes to detphflow codebase for the new spinner, just on shaderflow and the main repository. Can you provide further information of what is going wrong?

I have some ideas (expand this) I'd say it's likely that `git checkout Master` could have failed if you had any staging (uncommited) local changes before the checkout, just running git pull on a submodule won't update to the lastest commit if it's not targeting a branch For that I had moments ago just updated install scripts to checkout all submodules to the master branch with: `git submodule foreach --recursive 'git checkout Master || true'`
onlysharma0852 commented 8 months ago
(broken-source-py3.11) PS C:\AI\depthflow\BrokenSource> broken depthflow
│Broken    ├┤ 752ms├┤Error  │ ▸ Binary doesn't exist or was not found on PATH
(C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs\depthflow-mKviHXYi-py3.11\Scripts\main.cmd)
│Broken    ├┤ 754ms├┤Warning│ ▸ Partial Virtual Environment installation detected for the Project (DepthFlow)
│Broken    ├┤ 755ms├┤Warning│ ▸ • A full installation reset and retry is recommended {(r) option}
│Broken    ├┤ 756ms├┤Warning│ ▸ Detected bad Return Status (1) for the Project (DepthFlow) at
(C:\AI\depthflow\BrokenSource\Projects\DepthFlow)
│Broken    ├┤ 756ms├┤Warning│ ▸ • Python Virtual Environment:
(C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs\depthflow-mKviHXYi-py3.11)
• Action: Run {poetry (i)nstall}, {poetry (l)ock}, {(r)einstall venv}, {(e)xit} or {(enter) nothing}, then retry
[r/e/p/l/] (retry):

this is the error after runningbroken depthflow

Broken working fine after changing SIGKILL to SIGTERM. But looks like depthflow is missing something, I downloaded the depthflow zipfile and then extracted into the Brokensource\Project\Depthflow

I am sorry bro i am new in this field so i have very little knowledge😢. Last time i installed stable diffusion from github by watching youtube video. So i don't have proper knowledge.

Sorry for wasting your time i will wait for you to fix this in your next update

Tremeschin commented 8 months ago

Try the "r" option to reinstall the virtual environment and the entry script

This one sometimes happen when dependencies are updated, it kinda shouldn't, but I didn't investigate yet


Sorry for wasting your time i will wait for you to fix this in your next update

No worries! I'm nearly full time working on the code now :)

There will always be minor easily fixable issues, and the code gets progressively smarter for that, it's totally part of the process taking care of what others find ! I can only know and test so much of it

onlysharma0852 commented 8 months ago
[r/e/p/l/] (retry): r
│Broken    ├┤8621ms├┤Info   │ ▸ Removing Path
(C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs\depthflow-mKviHXYi-py3.11)
│Broken    ├┤8678ms├┤Info   │ ▸ Removing Path (C:\AI\depthflow\BrokenSource\Projects\DepthFlow\poetry.lock)
│Broken    ├┤9137ms├┤Info   │ ▸ Installing virtual environment for Project (DepthFlow)
│Broken    ├┤9138ms├┤Info   │ ▸ Running Command ('poetry', 'install') @
(C:\AI\depthflow\BrokenSource\Projects\DepthFlow)
Directory C:\AI\depthflow\BrokenSource\Meta\Fork\ModernGLW for moderngl-window does not seem to be a Python package
Creating virtualenv depthflow-mKviHXYi-py3.11 in C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs
Updating dependencies
Resolving dependencies... (0.0s)Directory C:\AI\depthflow\BrokenSource\Meta\Fork\ModernGLW for moderngl-window does not seem to be a Python package
Directory C:\AI\depthflow\BrokenSource\Meta\Fork\ModernGLW for moderngl-window does not seem to be a Python package

Directory C:\AI\depthflow\BrokenSource\Meta\Fork\ModernGLW for moderngl-window does not seem to be a Python package
│Broken    ├┤11419ms├┤Error  │ ▸ Binary doesn't exist or was not found on PATH
(C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs\depthflow-mKviHXYi-py3.11\Scripts\main.cmd)
│Broken    ├┤11420ms├┤Warning│ ▸ Partial Virtual Environment installation detected for the Project (DepthFlow)
│Broken    ├┤11420ms├┤Warning│ ▸ • A full installation reset and retry is recommended {(r) option}
│Broken    ├┤11420ms├┤Warning│ ▸ Detected bad Return Status (1) for the Project (DepthFlow) at
(C:\AI\depthflow\BrokenSource\Projects\DepthFlow)
│Broken    ├┤11421ms├┤Warning│ ▸ • Python Virtual Environment:
(C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs\depthflow-mKviHXYi-py3.11)
• Action: Run {poetry (i)nstall}, {poetry (l)ock}, {(r)einstall venv}, {(e)xit} or {(enter) nothing}, then retry
[r/e/p/l/] (retry):

this comes after reinstalling

Tremeschin commented 8 months ago

Hmm, I wonder how you downloaded the whole code, is the folder BrokenSource/Meta/Fork/ModernGLW empty or does it contains files and a pyproject.toml file?

If you have discord or telegram there's links on the readme, might be easier to bounce ideas

onlysharma0852 commented 8 months ago

its empty did i miss the file? i downloaded the whole code by running the link in window powershell

Tremeschin commented 8 months ago

It's fixable, just run-

git submodule update --init --recursive

-on the main folder, or just delete and run the install command again

I made a small change to the script today but it's after running a git clone (url) --recurse-submodules, prob not related, I'll boot windows now see how's stuff there~

Tremeschin commented 8 months ago

Oh 🤦🏻 I forgot to update the github page branch name so there was no script on https://brakeit.github.io/get.ps1, what a bummer, it's there now

onlysharma0852 commented 8 months ago

that's what i was saying. By default there was no file present

Tremeschin commented 8 months ago

(Windows 11) I just uninstalled python, git, deleted %localappdata%\pypoetry folder, ran the install script from the readme irm https://brakeit.github.io/get.ps1 | iex, everything cloned ok, installed virtual environment and activated it automatically,

Then I broken depthflow and it downloaded models, estimated depth on CPU and shader ran fine, can you delete the old folder and clone stuff again?

onlysharma0852 commented 8 months ago

wait i think its working now. I downloaded the fie by git submodule update --init --recursive after that the error cam again then i run ther command. It starts installing everything automatically. Depthflow logo came in the brakeit file. Now its downloading the model.safetensor file.

onlysharma0852 commented 8 months ago

Depthflow starts working even the model.safetensor file also downloaded. But now here is the new error.

(C:\Users\onlys\AppData\Local\BrokenSource\ShaderFlow\Cache\fe0a6b3435d86d8c295e1d95a76145ff.jpeg)
Exception in thread Thread-2 (_parallax):
Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "C:\Program Files\Python311\Lib\threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "C:\AI\depthflow\BrokenSource\Projects\DepthFlow\DepthFlow\DepthFlow.py", line 60, in _parallax
    self._load_depth = LoaderImage(depth) or self.mde(image, cache=cache)
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\AI\depthflow\BrokenSource\Projects\ShaderFlow\ShaderFlow\Optional\Monocular.py", line 35, in __call__
    return self.estimate(image, normalized, cache)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\AI\depthflow\BrokenSource\Projects\ShaderFlow\ShaderFlow\Optional\Monocular.py", line 81, in estimate
    with yaspin(text=f"Estimating Depth Map for the input image (CUDA: {torch.cuda.is_available()})"):
  File "C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs\depthflow-mKviHXYi-py3.11\Lib\site-packages\yaspin\core.py", line 153, in __enter__
    self.start()
  File "C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs\depthflow-mKviHXYi-py3.11\Lib\site-packages\yaspin\core.py", line 280, in start
    self._register_signal_handlers()
  File "C:\Users\onlys\AppData\Local\pypoetry\Cache\virtualenvs\depthflow-mKviHXYi-py3.11\Lib\site-packages\yaspin\core.py", line 464, in _register_signal_handlers
    if signal.SIGKILL in self._sigmap:
       ^^^^^^^^^^^^^^
AttributeError: module 'signal' has no attribute 'SIGKILL'. Did you mean: 'SIGILL'?
Tremeschin commented 8 months ago

Somehow, Projects/ShaderFlow is still on not the most recent commit that replaced yaspin

Either delete the BrokenSource folder and run the install command on the same directory again (dependencies are already downloaded and installed, it'll just skip them)

Or alternatively try setting all submodules to the Master branch with

git submodule foreach --recursive 'git checkout Master || true'

And then run the git submodules update --init --recursive again, might need to add --force if you have any local changes

onlysharma0852 commented 8 months ago

Ok i will reinstall everything from the start

Tremeschin commented 8 months ago

I just noticed a bug due a recent code I removed that crashes depthflow when drag and dropping image files or url to the real time window, I've fixed it so just do the update init recursive or git pull on projects/depthflow to get it !

Tremeschin commented 8 months ago

-and the main repo as well, the poe (cuda/rocm/cpu) commands for using GPU acceleration in pytorch for estimating the depth worked on my linux as I had it installed externally, they shouldn't be a module call but "whatever it finds"

Sorry for the inconvenience and these easily ironed out issues, lots of internal changes recently (<2 days)

onlysharma0852 commented 8 months ago

https://github.com/BrokenSource/DepthFlow/assets/127586036/9d2dd1ff-a6fd-4b07-9266-1674f2539e7e

ok its working now. Thanks. Finally its working. Now i am just rendering my image.

but its working fine for your demo image but mine is messed up image (14)

Soranokuni commented 8 months ago

Hello Devs! Firstly I'd love to give my thanks for this awesome project, it worked great on linux until I run into some weird python problems but that was probably me messing with rocM,

I have a simillar problem on WINDOWS 11 now, giving this command broken depthflow parallax -b -i "C:\Users\Sora\Pictures\250324 UPSCAYL\upscayl_png_realesrgan-x4plus-anime_4x\pic1.png" main -r -w 2048 -h 3072 -f 25 -s 2.5 -q 95 --open seems to resize the video output but not scale the image accordingly, it seems like it creates the parallax effect in a 1920x1080 window then outputs it to the desirable resolution, I remember using the same exact commands on fedora and it was working.

Thanks again people, you guys rock!

onlysharma0852 commented 8 months ago

Mine problem is that now its working great for a landscape picture but not for a portrait picture

Tremeschin commented 8 months ago

@onlysharma0852 Mine problem is that now its working great for a landscape picture but not for a portrait picture

Ah, that happens because the window doesn't auto resize for the input image's resolution yet. I know this isn't convenient, but I'll try to think of a way(*) to keep some custom resolution when running the scene's main command (it overrides and sets the resolution), what @Soranokuni did on the command is the current way to go: "-w 2048 -h 3072"

* The problem is like, what if one opens a 4k image on a 1080p screen? What if the window is maximized on portrait, should we always un-maximize then scale? Maybe a button to fit to the image's resolution in real time? Should we render black pixels outside the image's content?


~


@Soranokuni me messing with rocM

Oh, nice, how far did you go and how far it worked? I only have my old RX 570 that is currently in use but it can't run ROCm as it's Polaris architecture, I plan on getting an AMD GPU next, but it's a couple months or year(s) from now

@Soranokuni seems to resize the video output but not scale the image accordingly, it seems like it creates the parallax effect in a 1920x1080 window then outputs it to the desirable resolution, I remember using the same exact commands on fedora and it was working.

I didn't understand much what went wrong (1080p quality in 4k video? Your image is also near 4k quality, right?), but I'll check texture sizes when rendering in greater than or less than 1080p and using SSAA.

Btw, -w 2048 -h 3072 -f 25 -s 2.5 -q 95 is brutal man, poor GPU 😳 :)

Btw I see that you're using upscayl, maybe it's time to hook similar/the same upscalers they use here 😅

I have pretty much all the code ready for downloading them per platform and upscaling images only when needed

Soranokuni commented 8 months ago

@Soranokuni me messing with rocM

Oh, nice, how far did you go and how far it worked? I only have my old RX 570 that is currently in use but it can't run ROCm as it's Polaris architecture, I plan on getting an AMD GPU next, but it's a couple months or year(s) from now

It didn't work haha, I have polaris as well, RX580, there are ways to bypass the the driver's whitelist by using HSA_OVERRIDE_GFX_VERSION=10.3.0 to fool pytorch, didn't manage to get it working.

@Soranokuni seems to resize the video output but not scale the image accordingly, it seems like it creates the parallax effect in a 1920x1080 window then outputs it to the desirable resolution, I remember using the same exact commands on fedora and it was working.

I didn't understand much what went wrong (1080p quality in 4k video? Your image is also near 4k quality, right?), but I'll check texture sizes when rendering in greater than or less than 1080p and using SSAA.

My output is in the desirable portrait aspect ratio but with a landscape resize, I can't explain so I'll post an image when I have access to my pc. Btw, -w 2048 -h 3072 -f 25 -s 2.5 -q 95 is brutal man, poor GPU 😳 :)

Surprisingly it doesn't even sweat on cpu mode, no idea why.

Btw I see that you're using upscayl, maybe it's time to hook similar/the same upscalers they use here 😅

Yeah, pretty good out of the box, for digital art though I use https://openmodeldb.info/models/4x-realesrgan-x4plus I have pretty much all the code ready for downloading them per platform and upscaling images only when needed

Great! looking forward the implementation!

Tremeschin commented 8 months ago

My output is in the desirable portrait aspect ratio but with a landscape resize, I can't explain so I'll post an image when I have access to my pc.

I think I understand it now, I'm in the middle of switching to rye in favor of poetry for python venvs and dependencies, the tooling I needed is there now, much simpler than nested venvs and wayy faster startup times !

Will take a look more in depth when I finish this local move, then test and commit everything

Yeah, pretty good out of the box, for digital art though I use https://openmodeldb.info/models/4x-realesrgan-x4plus

Exactly the upscaler and model I was thinking of, and that I'm using internally 😅

Tremeschin commented 8 months ago

@onlysharma0852 hmm, tested the command you had issues with depthflow parallax -i ~/pic1.png -b main -r -w 2048 -h 3072 -f 25 -s 2.5 -q 95, the video seems fine here

(Expand for the video) https://github.com/BrokenSource/DepthFlow/assets/29046864/dc5476b8-bde2-4c34-b39f-cf389b95793d

I'll boot Windows soon-ish to test the new tooling, stuff is working again, I doubt there will be any difference

Only adds to the mystery of why your video is at 1080p and -w 2048 -h 3072 wasn't respected

Btw, -w 2048 -h 3072 -f 25 -s 2.5 -q 95 is brutal man, poor GPU 😳 :)

Also, it rendered at 11.5 fps on my RTX 3060 heheh, makes me think all settings were default for you 🤔

Tremeschin commented 8 months ago

Just tested on Windows and commited new tooling, I did pretty much a clean install and it worked

There's no new features on the projects themselves but heavy speed ups on starting times, a single virtual environment for all projects (much less disk space usage and less error-prone), auto managed python version, installing PyTorch is a global optional now with just poe cpu/cuda/rocm so I've updated all readmes

It's a good idea to keep the old version for a bit, and optionally get the newest just to maybe help find some rough edges!

I'm doing a bit of a code review and readme review to check for any outdated info and will check depthflow on windows

Tremeschin commented 8 months ago

I understood what went wrong @onlysharma0852 and fixed on commit ShaderFlow/ba0ac11

The exporting resolution was higher than your screen and the GLFW window sized itself down to fit in 1080p, and it updated the Scene's instructions of width, height as it gave a resize signal

Maybe GLFW hidden window on Linux didn't care for that, but on Windows the target height of -h 3072 on the command got clamped down to 2160, which is exactly my main 4k monitor's vertical pixel count, and I immediately knew what was up!

Tremeschin commented 8 months ago

Just laughing to myself that- I've had racing conditions in the past cuz the CPU was too fast in some college C code, but virtually limiting the max resolution on a user monitor's base is new to me and so funny 😂

I wouldn't notice it myself for a bit as I rarely go above 4k (just SSAA which isn't part of the fixed problematic code)

Thanks for catching my attention on this !

Soranokuni commented 8 months ago

Oh, yeah, linux didn't care about the window resolution then. Tested yesterday and it worked great, contrary to windows.

So the issue now is resolved 👏

Tremeschin commented 8 months ago

Long comment section hehe but about earlier comments,

what @Soranokuni did on the command is the current way to go: "-w 2048 -h 3072"

This feature is now implemented on latest commits and its usage is explained the DepthFlow/Readme.md

Related commits:

If I understood correctly, we can git pull --recurse-submodules on the root to get all those commits on each submodule latest branches, though the install scripts sets the branch to the master one. Or just reclone :)

Tremeschin commented 8 months ago

I'm closing as the conversation diverged a bit, tooling changed, and there's docs on a website now