CPU demo for ToonOut
Hi
@joelseytre
, thanks for sharing ToonOut!
Could you please provide a simple CPU demo (for example a Hugging Face Space that runs only on CPU)? I tried running the model on CPU but couldn’t get it working. A minimal example or instructions would be very helpful.
Thanks a lot!
Hi! Thanks for your question :)
I'm not sure if you saw but on our GitHub repo we added a jupyter notebook that you can run also on CPU. You can find it here
You have to first download the weights to your local computer, I simply did:
cd ~/Downloads
git clone https://huggingface.co/joelseytre/toonout
and then adjusted the path in the notebook.
I just tried it on my Macbook and it ran in ~15s (it's faster on GPU obviously).
Hi @joelseytre ,
Thanks for your reply! I also tried running the model on Hugging Face, but I couldn’t get it to work at all. My system isn’t powerful enough to run it locally either.
Would it be possible for you to create a simple CPU demo on Hugging Face Spaces? That would make it much easier to try out the model.
Thanks a lot!
this error give me
==== Application Startup at 2025-09-27 08:16:55 =====
Using device: cpu
Loading ToonOut...
config.json: 0%| | 0.00/405 [00:00<?, ?B/s]
config.json: 100%|██████████| 405/405 [00:00<00:00, 2.82MB/s]
Traceback (most recent call last):
File "/home/user/app/app.py", line 23, in
model = AutoModelForImageSegmentation.from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 549, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1302, in from_pretrained
config_class = get_class_from_dynamic_module(
File "/usr/local/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 569, in get_class_from_dynamic_module
final_module = get_cached_module_file(
File "/usr/local/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 371, in get_cached_module_file
resolved_module_file = cached_file(
File "/usr/local/lib/python3.10/site-packages/transformers/utils/hub.py", line 321, in cached_file
file = cached_files(path_or_repo_id=path_or_repo_id, filenames=[filename], **kwargs)
File "/usr/local/lib/python3.10/site-packages/transformers/utils/hub.py", line 582, in cached_files
raise OSError(
OSError: joelseytre/toonout does not appear to have a file named BiRefNet_config.py. Checkout 'https://huggingface.co/joelseytre/toonout/tree/main' for available files.
Using device: cpu
Loading ToonOut...
config.json: 0%| | 0.00/405 [00:00<?, ?B/s]
config.json: 100%|██████████| 405/405 [00:00<00:00, 2.96MB/s]
Traceback (most recent call last):
File "/home/user/app/app.py", line 23, in
model = AutoModelForImageSegmentation.from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 549, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
File "/usr/local/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 1302, in from_pretrained
config_class = get_class_from_dynamic_module(
File "/usr/local/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 569, in get_class_from_dynamic_module
final_module = get_cached_module_file(
File "/usr/local/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 371, in get_cached_module_file
resolved_module_file = cached_file(
File "/usr/local/lib/python3.10/site-packages/transformers/utils/hub.py", line 321, in cached_file
file = cached_files(path_or_repo_id=path_or_repo_id, filenames=[filename], **kwargs)
File "/usr/local/lib/python3.10/site-packages/transformers/utils/hub.py", line 582, in cached_files
raise OSError(
OSError: joelseytre/toonout does not appear to have a file named BiRefNet_config.py. Checkout 'https://huggingface.co/joelseytre/toonout/tree/main' for available files.
Hi! Sorry for the issues you're facing
about the CPU demo on HuggingFace Spaces, I'll see if / when I have time to set it up
about your error, it's not due to your hardware but your setup seems wrong
You need to:
- clone the GitHub repo: https://github.com/MatteoKartoon/BiRefNet (and install an environment that has the right dependencies)
- separately, clone the HuggingFace repo that includes the weights (as mentioned above, using
git clone https://huggingface.co/joelseytre/toonout) - update only the line that specifies the
local_path_to_weights(as shown on the screenshot)
and it should work
