# Help with Duplicating a SadTalker Space on Hugging Face

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%3E%5C
**Category:** Beginners\
**Created:** [August 28, 2024, 4:41am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304 "2024-08-28T04:41:05Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 28, 2024, 4:41am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F1 "2024-08-28T04:41:05Z")

</div>

Subject: Help with Duplicating a SadTalker Space on Hugging Face

Hey there,

I’m working on a SadTalker project and using the basic CPU plan (2 vCPU, 16 GB RAM) on Hugging Face Spaces. I’ve run into a few issues when trying to clone or duplicate a space. The cloning process just doesn’t finish, and I can’t continue setting things up.

I also tried cloning the space to my local machine, but that didn’t work out either. I’m hoping to create or duplicate a space that runs smoothly within the basic plan’s limits without causing any issues.

Any advice or tips on how I can get this working would be awesome!

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 28, 2024, 6:08am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F2 "2024-08-28T06:08:33Z")

</div>

I looked at it and it is due to Gradio having many incompatibilities between 3.x and 4.x.  
I removed the incompatibility parameter and fixed it to the point where it starts up for now.  
It’s kind of a rite of passage in HF to suffer Gradio version upgrades.

But I wonder if this will work in CPU space in terms of performance…

> **[SadTalker - a Hugging Face Space by John6666](https://huggingface.co/spaces/John6666/SadTalker)**
>
> Discover amazing ML apps made by the community

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 29, 2024, 2:18am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F3 "2024-08-29T02:18:20Z")

</div>

i have cloned the original sadtalker repo from github into my local machine and then uploading it’s files and making a space out of it and i faced this issue:

runtime error  
Exit code: 1. Reason: Traceback (most recent call last):  
File “/home/user/app/app.py”, line 3, in   
from src.gradio\_demo import SadTalker  
File “/home/user/app/src/gradio\_demo.py”, line 5, in   
from src.facerender.animate import AnimateFromCoeff  
File “/home/user/app/src/facerender/animate.py”, line 23, in   
from src.utils.face\_enhancer import enhancer\_generator\_with\_len, enhancer\_list  
File “/home/user/app/src/utils/face\_enhancer.py”, line 4, in   
from gfpgan import GFPGANer  
File “/usr/local/lib/python3.10/site-packages/gfpgan/ **init**.py”, line 2, in   
from .archs import \*  
File “/usr/local/lib/python3.10/site-packages/gfpgan/archs/ **init**.py”, line 2, in   
from basicsr.utils import scandir  
File “/usr/local/lib/python3.10/site-packages/basicsr/ **init**.py”, line 4, in   
from .data import \*  
File “/usr/local/lib/python3.10/site-packages/basicsr/data/ **init**.py”, line 22, in   
\_dataset\_modules = [importlib.import\_module(f’basicsr.data.{file\_name}‘) for file\_name in dataset\_filenames]  
File “/usr/local/lib/python3.10/site-packages/basicsr/data/ **init**.py”, line 22, in   
\_dataset\_modules = [importlib.import\_module(f’basicsr.data.{file\_name}’) for file\_name in dataset\_filenames]  
File “/usr/local/lib/python3.10/importlib/ **init**.py”, line 126, in import\_module  
return \_bootstrap.\_gcd\_import(name[level:], package, level)  
File “/usr/local/lib/python3.10/site-packages/basicsr/data/realesrgan\_dataset.py”, line 11, in   
from basicsr.data.degradations import circular\_lowpass\_kernel, random\_mixed\_kernels  
File “/usr/local/lib/python3.10/site-packages/basicsr/data/degradations.py”, line 8, in   
from torchvision.transforms.functional\_tensor import rgb\_to\_grayscale  
ModuleNotFoundError: No module named ‘torchvision.transforms.functional\_tensor’

here is my space:

> **[SadTalker - a Hugging Face Space by Hebatullah](https://huggingface.co/spaces/Hebatullah/SadTalker)**
>
> Discover amazing ML apps made by the community

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 29, 2024, 4:14am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F4 "2024-08-29T04:14:50Z")

</div>

Overall, the dependencies (requirement.txt) are broken. The author seems to assume Gradio version 3.x as well.  
This is partly unavoidable since Gradio is like a different language with versions 3.x and 4.x…  
I wonder if this is not code for running on HF’s space, but for local PCs, like StableDiffusion’s WebUI, for example?

At least I was able to get it to boot up…

> **[SadTalker - a Hugging Face Space by John6666](https://huggingface.co/spaces/John6666/SadTalkerGitHub)**
>
> Discover amazing ML apps made by the community

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 29, 2024, 5:00am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F5 "2024-08-29T05:00:24Z")

</div>

Thank you so much

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 29, 2024, 6:45am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F6 "2024-08-29T06:45:20Z")

</div>

If it works, it’s OK.😀

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 29, 2024, 9:42pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F7 "2024-08-29T21:42:46Z")

</div>

John6666/SadTalkerGitHub doesn’t work it gives me “Error” in the generated video section

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 29, 2024, 9:46pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F8 "2024-08-29T21:46:02Z")

</div>

I want to ask another question, how can I make a notebook on Kaggle and Colab for Sad Talker and use Gradio’s Webui or link it to Ngrok? I can’t use Sad Talker on Colab and I tried so hard but I couldn’t reach a solution.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 29, 2024, 11:02pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F9 "2024-08-29T23:02:22Z")

</div>

> FileNotFoundError: [Errno 2] No such file or directory: ‘checkpoints/auido2pose\_00140-model.pth’

It looks like I need to put this (maybe other files too) in the Spaces folder or download and relocate it myself in the program. (I can do that, but it’s a pain **P.S.** I uploaded the previous space’s for now.).  
This is still for local PCs bacically.

Sorry, I’ve never used Kaggle or Colab. I mean, I’m not familiar with cloud services in general, I’m just a guy who recently got back into programming and is in rehab.

> \_pickle.UnpicklingError: unpickling stack underflow

Something seems to be an old version of the model and I get a loading error, where is the new one?

## P.S.

I found the model. Now if we are going to get this to work, someone should first maintain it so that it is up-to-date.  
It seems to me that it would work with the new pytorch, especially if you fix the use of functions that are not in the current version of torchvision.  
Maintenance stopped in 2023…

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 30, 2024, 1:33am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F10 "2024-08-30T01:33:58Z")

</div>

Can you run these 2 spaces on ZeroGPU?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 30, 2024, 1:58am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F11 "2024-08-30T01:58:33Z")

</div>

Sorry, but the slots are full, including space for private development and conversion. (That’s a limit of 10 per person…the organization has 30. Multiple accounts should be possible, but it’s a pain in the ass.)

If you’re talking about processing to work on Zero GPU space, I can do that.  
Just put **import spaces at the top of app.py** and **top of each function’s .py** and pinpoint the **@spaces.GPU** decorators to the functions you want to use GPU.

P.S.  
I did.

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 30, 2024, 3:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F12 "2024-08-30T03:16:01Z")

</div>

do you mean @spaces.GPU(duration=120)

i didn’t find [add duration] section

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 30, 2024, 3:23am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F13 "2024-08-30T03:23:13Z")

</div>

> do you mean @spaces.GPU(duration=120)

Actually, **duration= and ()** are optional.  
If I don’t specify it, it will be treated as 60 seconds.  
You can set them as needed. The longer it is, the longer it can be used for processing, but the longer the requested seconds, the more likely it is to be **caught by quotas**.  
I often set it to 30 seconds for light processing and 60 to 70 seconds for text-to-image inference.

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 30, 2024, 5:28am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F14 "2024-08-30T05:28:23Z")

</div>

How to apply these changes?

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 30, 2024, 6:35am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F15 "2024-08-30T06:35:03Z")

</div>

i committed the changes on your space and caused this issue, i think i made it wrong:

# runtime error

## Exit code: 1. Reason: File “/home/user/app/app.py”, line 112 @spaces.GPU SyntaxError: invalid syntax

Container logs:

```auto
===== Application Startup at 2024-08-30 06:11:38 =====

  File "/home/user/app/app.py", line 112
    @spaces.GPU
SyntaxError: invalid syntax
  File "/home/user/app/app.py", line 112
    @spaces.GPU
SyntaxError: invalid syntax

```

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 30, 2024, 7:27am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F16 "2024-08-30T07:27:56Z")

</div>

I fixed it. I also added “spaces” to the non-GitHub version.

---

<div class="post-metadata">

**Author:** ![Hebatullah](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hebatullah/32/30915_2.png) [@Hebatullah](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHebatullah)%5C
**Post date:** [August 30, 2024, 7:30am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F17 "2024-08-30T07:30:22Z")

</div>

> [@John6666](#):
>
> Just put **import spaces at the top of app.py** and **top of each function’s .py** and pinpoint the **@spaces.GPU** decorators to the functions you want to use GPU.
> 
> P.S.  
> I did.

where can i find this? and commit **@spaces.GPU** to the space:

Just put **import spaces at the top of app.py** and **top of each function’s .py** and pinpoint the **@spaces.GPU** decorators to the functions you want to use GPU.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 30, 2024, 7:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F18 "2024-08-30T07:39:19Z")

</div>

> where can i find this?

The only way to find and specify the function that is responsible for the most important part of the process, which is faster when using a GPU.  
If you read app.py from the top and follow all the imports and from’s, you will find it someday.

An easier way is to find the function called in Gradio’s events.

In SadTalker’ app.py, the clue is here.

```py
            submit.click(
                        fn=sad_talker.test, 
                        inputs=[source_image,

```

The function that is called when a button is pressed is usually the main body of the inference function.  
Because that’s how they are usually made.

If you follow this, you will reach **gradio\_demo.py** in the **src** folder, find the **test** method from there, add a decorator, and you are done.  
(I did it this time).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [August 30, 2024, 7:39pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-duplicating-a-sadtalker-space-on-hugging-face%2F104304%2F19 "2024-08-30T19:39:32Z")

</div>

Closed on August 30, 2024, 7:39pm UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
