How to restore faces with CodeFormer on a cloud GPU
Rent a GPU on Deploy, then open a terminal in JupyterLab or over SSH. Install CodeFormer from the sczhou/CodeFormer README, run the download script that file prints, run inference_codeformer.py for a face, a whole image, or a video, and copy the results folder off the instance before you destroy it. Destroying the instance deletes its disk.
Another upscaler on the same kind of instance: How to upscale images with SUPIR on a cloud GPU. The Real-ESRGAN flag this README names is How to upscale images and video with Real-ESRGAN on a cloud GPU. A portrait-animation install: How to run LivePortrait on a cloud GPU. If the process runs out of memory: How to fix CUDA out of memory on a cloud GPU.
The README dependencies list says Pytorch >= 1.7.1 and CUDA >= 10.1. The README does not link an official ComfyUI install. Its ecosystem table lists a ComfyUI row whose link is a third-party article, and the section above that table says integrations listed there are third-party and are not affiliated with the authors. The ComfyUI examples top-level directory list on 2026-11-13 had no directory named for this project. Examples HEAD was f9431bb000ce792094ff345446e22cac1ea6cef3, committed 2025-11-26T20:33:58Z. This page does not add a ComfyUI install.
The GitHub license field on 2026-11-13 was NOASSERTION. The LICENSE file is titled S-Lab License 1.0, and its copyright line is Copyright 2022 S-Lab. The README says redistribution and use should follow that license. Read the file before you redistribute the program.
The commands below are copied from the upstream files named in each step. They were not run on a CloudGPU instance for this page. Anything this page adds around them is marked.
What the README says about memory
The README prints no GB figure. A request for the Hugging Face model API id sczhou/CodeFormer on 2026-11-13 returned HTTP 401, so this page did not read a model card there. The weights the README names are the GitHub release v0.1.0 files in the download script.
GET /v1/public/compute-capabilities does not list GPUs. It returns feature flags. The memory column is vram_gb from gpu-prices.json, updated_at 2026-11-13T02:59:34.866Z. GET /v1/public/gpu-catalog the same day (generated_at 2026-11-13T02:59:35.996Z) listed the same names and the same vram_gb values, plus Ascend 910B at 64, which is not in gpu-prices.json and is not listed here. The catalog response also includes an availability field. This page does not copy it. Every prices row has gpu_count 1. There is no upstream GB cutoff to match these values against. This page did not run CodeFormer and does not mark a row as enough. Which listing you can start is on Deploy.
The catalog template named CodeFormer has id codeformer, recommended_gpu RTX 4090 48G, and min_vram_gb 16. Those are template fields. The README install on this page is not that template.
| Catalog name | vram_gb |
|---|---|
| RTX 2080 | 8 |
| RTX 3080 | 10 |
| RTX 2080 Ti | 11 |
| RTX 3080 Ti | 12 |
| V100 16G | 16 |
| A30 | 24 |
| RTX 3090 | 24 |
| RTX 4090 | 24 |
| RTX 4090D | 24 |
| RTX 4080 SUPER 32G | 32 |
| RTX 5090 | 32 |
| RTX 5090D | 32 |
| V100 32G | 32 |
| A100 40G | 40 |
| A800 40G | 40 |
| A40 | 48 |
| RTX 4090 48G | 48 |
| RTX 4090D 48G | 48 |
| RTX A6000 | 48 |
| NVIDIA RTX PRO 5000 72G | 72 |
| RTX PRO 5000 72G | 72 |
| A100 80G | 80 |
| A800 80G | 80 |
| H800 | 80 |
| RTX 6000D | 83 |
| H20 96G | 96 |
| RTX PRO 6000 96G | 96 |
| RTX PRO 6000 Max-Q | 96 |
| H20-3e 141G | 141 |
Install
On Deploy, choose Raw GPU. The deploy page says “SSH access and root within a dedicated container”. The README install block is:
# git clone this repository
git clone https://github.com/sczhou/CodeFormer
cd CodeFormer
# create new anaconda env
conda create -n codeformer python=3.8 -y
conda activate codeformer
# install python dependencies
pip3 install -r requirements.txt
python basicsr/setup.py develop
# README note, moved to a comment on this page. Not a shell argument.
# only for face detection or cropping with dlib
conda install -c conda-forge dlib
The README puts (only for face detection or cropping with dlib) on the same line as conda install. That parenthesis is not valid Bash. This page moves it into the comments above the command. This page did not run the command. requirements.txt sets torch>=1.7.1 and does not pin triton or gradio. The commits API for the default branch master listed b33cc7d639d6545bfcccc7e0bc6ae51f24e79c2b, committed 2025-11-18T12:03:26Z. The commits API for README.md listed that same commit. This page did not install the environment.
Download the pretrained weights
The README download commands are:
python scripts/download_pretrained_models.py facelib
# README note, moved to a comment on this page. Not a shell argument.
# only for the dlib face detector
python scripts/download_pretrained_models.py dlib
python scripts/download_pretrained_models.py CodeFormer
The README puts (only for dlib face detector) on the same line as the dlib download. That parenthesis is not valid Bash. This page moves it into the comment above the command. This page did not run the command. scripts/download_pretrained_models.py writes under ./weights/{method}. The facelib map names detection_Resnet50_Final.pth and parsing_parsenet.pth. The dlib map names mmod_human_face_detector-4cb19393.dat and shape_predictor_5_face_landmarks-c4b1e980.dat. The CodeFormer map names codeformer.pth. Each URL in that file is under https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/. This page did not download the files. The commits API for that script listed 68fdbb11e9a4957255af4acf14ea8eb6df2a06d6, committed 2024-10-08T20:17:34Z.
The documented inference commands
The README says fidelity weight w lays in [0, 1], that smaller w tends to produce a higher-quality result, and that larger w yields a higher-fidelity result. It says the results will be saved in the results folder. The commands it prints are:
# For cropped and aligned faces (512x512)
python inference_codeformer.py -w 0.5 --has_aligned --input_path [image folder]|[image path]
# For whole image
# Add '--bg_upsampler realesrgan' to enhance the background regions with Real-ESRGAN
# Add '--face_upsample' to further upsample restorated face with Real-ESRGAN
python inference_codeformer.py -w 0.7 --input_path [image folder]|[image path]
# For Windows/Mac users, please install ffmpeg first
conda install -c conda-forge ffmpeg
# For video clips
# Video path should end with '.mp4'|'.mov'|'.avi'
python inference_codeformer.py --bg_upsampler realesrgan --face_upsample -w 1.0 --input_path [video path]
The README also prints python inference_colorization.py and python inference_inpainting.py for cropped and aligned faces. inference_codeformer.py defaults -w to 0.5, --upscale to 2, and --detection_model to retinaface_resnet50. --bg_upsampler defaults to the string None. --save_video_fps defaults to None, and the video branch then uses the source frame rate. The video command above does not pass --save_video_fps. The commits API for inference_codeformer.py listed 50489a6736ef6ac75f00582a646782049898fe43, committed 2023-02-10T09:41:33Z. This page did not run the script.
Where the files are saved
inference_codeformer.py sets result_root to results/test_img_{w} for a single image path, results/{video_name}_{w} for a video path, and results/{basename}_{w} for a folder. --output_path replaces result_root when it is set. The README commands do not pass --output_path. Restored faces are written under {result_root}/restored_faces/. When --has_aligned is not set, the pasted image is written to {result_root}/final_results/{basename}.png, and cropped faces go under {result_root}/cropped_faces/. A video is written to {result_root}/{video_name}.mp4. The script prints All results are saved in {result_root}. This page did not run it.
The Gradio file the repository ships
The README’s official demo links are the Hugging Face Space, the Replicate page, and the OpenXLab app. It does not print a command that launches web-demos/hugging_face/app.py. That file calls demo.queue(concurrency_count=2) and then demo.launch() with no server_name and no server_port. requirements.txt does not pin gradio. This page did not launch the file, so it did not observe a port. How to use SSH port forwarding on a cloud GPU is the tunnel for a port you do observe. The commits API for that app file listed 07c8cc6f6d9b5aee87046177a8d429ec041da54a, committed 2023-01-21T06:50:12Z.
When it fails
CUDA out of memory. The README prints no GB figure and no low-memory flag. If the process raises that error, use how to fix CUDA out of memory on a cloud GPU.
“CUDA error: no kernel image is available for execution on the device” on an RTX 5090. requirements.txt sets torch>=1.7.1. It does not name compute capability 12.0. The RTX 5090 guide says that card is compute capability 12.0 (sm_120) and that PyTorch 2.7 and later, on a build for CUDA 12.8 or newer, is the line that announced support. This page did not install a torch wheel and did not re-test this package on an RTX 5090. Catalog RTX 5090 and RTX 5090D are 32. That is the catalog number only.
Save the images, then destroy
Copy the results directory the script printed, before you destroy the instance. Save your work before you destroy a cloud GPU is the checklist. The terms say data on local instance storage is permanently deleted when the instance is destroyed.
The pricing page FAQ states the billing rule in these words:
Per-minute options have a 1-minute minimum; unused prepaid minutes are refunded when you destroy the instance. Some configurations use whole-hour billing with a 1-hour minimum; unused time within a charged hour is not refunded on voluntary stop. The billing period, minimum charge and initial prepayment are shown before confirmation. No subscription.
Prices are not copied here.
Frequently asked questions
How much VRAM does the CodeFormer README print?
The README prints no GB figure. A request for the Hugging Face model API id sczhou/CodeFormer on 2026-11-13 returned HTTP 401, so this page did not read a model card there. The catalog template named CodeFormer has min_vram_gb 16 and recommended_gpu RTX 4090 48G. Those are template fields, not a sentence in the README. This page does not mark a catalog row as enough. Which listing you can start is on https://cloudgpu.app/deploy.
Which commands does the README print for faces, whole images, and video?
The cropped-face command is python inference_codeformer.py -w 0.5 --has_aligned --input_path with an image folder or path. The whole-image command uses -w 0.7 and does not pass --bg_upsampler in the printed line. The video command passes --bg_upsampler realesrgan, --face_upsample, and -w 1.0. The README says the video path should end with .mp4, .mov, or .avi. This page did not run the commands.
Where does inference_codeformer.py save files?
The script writes under results/, using results/test_img_{w} for a single image, results/{video_name}_{w} for a video, and results/{basename}_{w} for a folder, unless --output_path is set. Restored faces go in restored_faces. A whole-image result also writes final_results/{basename}.png. A video writes {video_name}.mp4 in that result folder. The README says the results will be saved in the results folder. This page did not run the script.
What usage terms does the repository print?
LICENSE is S-Lab License 1.0, Copyright 2022 S-Lab. It permits redistribution and use for a non-commercial purpose when its three conditions are met. It says that if redistribution or use for a commercial purpose is required, contact the contributor(s) of the work. That contact sentence is license text, not a CloudGPU price and not a storage allowance. The file prints no dollar amount.
Sources (read 2026-11-13, Asia/Shanghai)
- sczhou/CodeFormer README (install, download commands, fidelity weight, face / whole-image / video commands,
resultsfolder, S-Lab License 1.0 sentence, third-party ComfyUI row): https://github.com/sczhou/CodeFormer/blob/master/README.md commitb33cc7d639d6545bfcccc7e0bc6ae51f24e79c2b. Repository HEAD the same commit.pushed_atwas 2025-11-18T12:03:30Z scripts/download_pretrained_models.py(weights directory and v0.1.0 file names): commit68fdbb11e9a4957255af4acf14ea8eb6df2a06d6inference_codeformer.py(result paths, defaults, video mp4): commit50489a6736ef6ac75f00582a646782049898fe43web-demos/hugging_face/app.py(demo.launch()with no port): commit07c8cc6f6d9b5aee87046177a8d429ec041da54arequirements.txt(torch>=1.7.1, nogradiopin): commit7a584fda31398ed22ad5e1f1fdff3a9168a85ab2LICENSE(S-Lab License 1.0, Copyright 2022 S-Lab): commit0fb6cf1693f8405c510efc13d16df6de5d4e8e08. GitHub license field NOASSERTION- ComfyUI examples top-level directories (no CodeFormer directory): https://github.com/comfyanonymous/ComfyUI_examples commit
f9431bb000ce792094ff345446e22cac1ea6cef3 - Hugging Face model API
sczhou/CodeFormer: HTTP 401 on 2026-11-13. No model-card GB figure was read - Public GPU memory: https://cloudgpu.app/gpu-prices.json (
updated_at2026-11-13T02:59:34.866Z) and https://cloudgpu.app/v1/public/gpu-catalog (generated_at2026-11-13T02:59:35.996Z).GET /v1/public/compute-capabilitiesreturned feature flags and no GPU list. The catalog templatecodeformeris named CodeFormer
Cards you can start are on the Deploy page. Prices are on https://cloudgpu.app/pricing and are not repeated here.
Last updated: 2026-11-13 (Asia/Shanghai).