Problems with duplication

I purchased a private L40S server from your service, and it went to this space: https://huggingface.co/spaces/fffiloni/DiffuEraser-demo

I thought duplicating it on my private space would be easy and I’d be able to start using it in a few minutes, but that wasn’t the case.

I encountered numerous errors that I tried to resolve with the help of the AI, but after hours I still can’t get this space working on my private server.

I thought it would be much easier since, before paying, Huggingface seemed like the best option of all those available.

After hours and countless errors.

Can someone help me?

THANK YOU

This space is called “Zero GPU Spaces,” and it operates in an environment that’s slightly different from a standard GPU space. So, while it’s not difficult for developers, porting work may be required in some cases.

If you download the guide I created below, attach it to the generative AI, and ask for help, you’ll probably be able to fix it… maybe.

Subscribers to plans like the Enterprise plan may have access to special HF support.

Hi friend:

Thanks for your response. I appreciate your guide, but it’s very complex, and I don’t really know what steps I should follow to transfer Diffueraser from a Zero environment to my private L40S environment. Today I kept trying with the help of the AI, and it’s stuck on “STARTING ON L40S”.

I emailed Hugging, and they told me to try in a Zero environment, but I rented an L40S precisely to change Diffueraser parameters that require more VRAM, and the Zero environment won’t work for me.

I asked Hugging if someone with the necessary knowledge could access my profile and get Diffueraser working. Someone who knows what they’re doing could get it working in 5 minutes. But they haven’t responded since.

The truth is, right now I feel like I’ve wasted my money.

Hmm, I tried porting the code for that space just to see. Maybe it’ll work if you duplicate this? I’m not sure if the L40S has enough performance, though.

While some spaces require a lot of changes, there aren’t actually that many changes this time (in logic part):

--- a/README.md
+++ b/README.md
@@ -5,7 +5,10 @@
 colorTo: gray
 sdk: gradio
 sdk_version: 6.14.0
+python_version: 3.10.13
 app_file: gradio_app.py
+suggested_hardware: l40sx1
+startup_duration_timeout: 1h
 pinned: false
 disable_embedding: true
 short_description: A Diffusion Model for Video Inpainting
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,4 @@
+--extra-index-url https://download.pytorch.org/whl/cu128
 accelerate==0.25.0
 av==14.0.1
 datasets==2.19.1
--- a/gradio_app.py
+++ b/gradio_app.py
@@ -1,4 +1,13 @@
-import spaces
+try:
+    import spaces
+except ImportError:
+    class _SpacesFallback:
+        @staticmethod
+        def GPU(*args, **kwargs):
+            def decorator(fn):
+                return fn
+            return decorator
+    spaces = _SpacesFallback()
 import torch
 import os
 import time

Hi John:

Thank you again for your help. The problem with Diffueraser is that it needs a lot of VRAM. The L40S is perfect because it has 48GB of VRAM. I rented it because I need to change a couple of things in the code. For example, I need to make it display more than 5 seconds of video and adjust another parameter that improves watermark removal. This requires VRAM, which is why I rented the L40S private server.

You sent me some code, but I don’t know where to put it. Using AI, I made changes in the README, REQUIREMENTS, etc., but the last thing I managed to do is get it stuck on “STARTING ON L40S” and never finishes booting.

If you could send me clearer instructions, I could try again.

Thanks, John

but the last thing I managed to do is get it stuck on “STARTING ON L40S” and never finishes booting.

Hmm… So, also try download and upload gradio_app.py . I’ve made some changes to reduce the load on the disk.

Hi John

Thanks again for your help. I don’t know how to do these things. I don’t know how to download and install anything. I did some research before paying for Hugging, and I thought duplicating everything would work. I thought all the software would work on all machines, like Windows, which runs faster on newer machines and slower on older ones, BUT IT WORKS.

I duplicated Filloli’s DiffuerAsser on my L40S space, and it turned out it wasn’t so easy, hahaha. I only know how to edit files within the Hugging environment. I don’t know how to install anything or anything else. I’m learning. I know you want to help me, so if you could explain it a little more clearly for a newbie like me, I would really appreciate it.

Hmm, in that case, the easiest thing to do might be to clone my space (the modified one, that is).

Hi

That would be fantastic! Did you create a space using Diffueraser that works on an L40S?

Do I just have to tap the three dots and select “clone” and it works?

What’s the link to Diffueraser for your space?

Thanks

HI again:

Is this one? DiffuEraser Demo - a Hugging Face Space by John6666

Does it only work by cloning it, or also by duplicating it?

Does it work on the L40S on the first try, or do I need to make further modifications?

Yeah. That one. With just duplication, it would work. (hopefully)

Hahaha, okay, I’ll let you know in 10 minutes.

Oh my god, it’s working!

THANK YOU SO MUCH, JOHN!

Can I change certain parameters I need in the run_diffueraser.py file and will it still work?

How long, what, and where do I have to study to learn what you know, or at least something?

I know I bothered you a lot, John, but you were the only one who helped me.

Great.

Hmm, I’ve been coding as a hobby on and off for decades, so strictly speaking, it might take that long to master. That said, I’m only at an intermediate level.:roll_eyes:

Still, the fix you’re talking about shouldn’t be too difficult. These days, if you feed the URL of either your or my HF space, along with the URL of this thread, to a generative AI (like ChatGPT or Gemini) and ask it a question, I think it’ll write the code for you. If you tell the AI to “give it to me as a zip file,” it’ll give it to you as a zip. If an error pops up, just copy and paste the error message into the AI and ask it to fix it… If you keep repeating that process, you’ll probably need almost no knowledge at all.

If we have the knowledge, we can anticipate those kinds of issues, instruct the AI accordingly, and avoid them, which makes it easier (that’s what I did this time actually). But what’s essential is the request itself, not our knowledge. Well, for HF users, using the free CPU space for testing saves money. You only use the GPU space for actual execution. You can practice programming for free.

Edit:
e.g.

/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fproblems-with-duplication%2F176137

First, please read this thread carefully as background context.

I’d like to modify this HF Space of mine:
https://huggingface.co/spaces/John6666/DiffuEraser-demo-mini

Could you help me with the coding?

Ideally, I’d like to keep the original line endings and code as much as possible so that the changes are easy to understand, and make only small modifications where possible.

Please provide the modified result as a ZIP file, excluding files such as `__pycache__`.

For information about the current Hugging Face Spaces runtime, please also refer to the `.md` file linked in the thread.

Specifically, I’d first like to make it possible to specify several generation parameters from the GUI.

Great info. Thank you so much for your help. I know you are there for any question.

Thank you

Hi John:

I’m bothering you again because I made a change and it’s not working.

The problem is this: I go to run_diffueraser.py and change the parameter parser.add_argument(‘–video_length’, type=int, default=15, help=‘The maximum length of output video’) to 15 so it creates a 15-second video, but it always outputs a 5-second video.

What’s the problem?

Thank you very much.

Do I also need to edit the gradio_app.py file and match the changes I made in run_diffueraser.py?

Inside gradio_app.py is this:

Helper function to trim videos

def trim_video(input_path, output_path, max_duration=5):
clip = VideoFileClip(input_path)
trimmed_clip = clip.subclip(0, min(max_duration, clip.duration))
trimmed_clip.write_videofile(output_path, codec=“libx264”, audio_codec=“aac”)
clip.close()
trimmed_clip.close()

There you can see the value 5, which seems to me to be the duration of the output video.

And below you can see this:

@spaces.GPU(duration=100)
def infer(input_video, input_mask):

Setup paths and parameters

save_path = “results”
mask_dilation_iter = 8
max_img_size = 960
ref_stride = 10
neighbor_length = 10

subvideo_length = 50

These values ​​are also in run_diffueraser.py.

Perhaps both files need to be edited and set to the same.

I don’t know, it’s just something that occurred to me.

THANKS

Hi John:

I’m having problems again. I made some changes and it’s stuck on “STARTING ON L40S”.

I deleted the duplication from my private account, went to your account, accessed your Difueraser Demo Mini, and duplicated it again to start from scratch, but it never finishes. It’s stuck on “Starting on L40S”.

It’s strange because the duplication worked yesterday and now it doesn’t.

Sorry for the trouble.