{"cells":[{"cell_type":"markdown","metadata":{"id":"hgVreYca3LcQ"},"source":["FaceFusion 2.1.3"]},{"cell_type":"markdown","metadata":{"id":"28qKtK7F3bzl"},"source":["Install"]},{"cell_type":"code","execution_count":1,"metadata":{"id":"ZlrnUA3i3gMB","executionInfo":{"status":"ok","timestamp":1705140624340,"user_tz":-330,"elapsed":359996,"user":{"displayName":"","userId":""}},"outputId":"ee900c2a-5b4c-40f5-f1bc-d804db7aa6f4","colab":{"base_uri":"https://localhost:8080/"}},"outputs":[{"output_type":"stream","name":"stdout","text":["Cloning into 'face_fusion-unlocked'...\n","remote: Enumerating objects: 111, done.\u001b[K\n","remote: Counting objects: 100% (20/20), done.\u001b[K\n","remote: Compressing objects: 100% (19/19), done.\u001b[K\n","remote: Total 111 (delta 1), reused 20 (delta 1), pack-reused 91\u001b[K\n","Receiving objects: 100% (111/111), 74.24 KiB | 6.75 MiB/s, done.\n","Resolving deltas: 100% (13/13), done.\n","/content/face_fusion-unlocked\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.4/58.4 kB\u001b[0m \u001b[31m1.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hLooking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu121\n","Collecting basicsr==1.4.2 (from -r requirements.txt (line 1))\n"," Downloading basicsr-1.4.2.tar.gz (172 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m172.5/172.5 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n","Collecting filetype==1.2.0 (from -r requirements.txt (line 2))\n"," Downloading filetype-1.2.0-py2.py3-none-any.whl (19 kB)\n","Collecting gradio==3.50.2 (from -r requirements.txt (line 3))\n"," Downloading gradio-3.50.2-py3-none-any.whl (20.3 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m20.3/20.3 MB\u001b[0m \u001b[31m16.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting numpy==1.26.2 (from -r requirements.txt (line 4))\n"," Downloading numpy-1.26.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m18.2/18.2 MB\u001b[0m \u001b[31m80.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting onnx==1.15.0 (from -r requirements.txt (line 5))\n"," Downloading onnx-1.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.7 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m15.7/15.7 MB\u001b[0m \u001b[31m86.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting onnxruntime==1.16.3 (from -r requirements.txt (line 6))\n"," Downloading onnxruntime-1.16.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.4 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.4/6.4 MB\u001b[0m \u001b[31m108.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting opencv-python==4.8.1.78 (from -r requirements.txt (line 7))\n"," Downloading opencv_python-4.8.1.78-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (61.7 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m61.7/61.7 MB\u001b[0m \u001b[31m10.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting psutil==5.9.6 (from -r requirements.txt (line 8))\n"," Downloading psutil-5.9.6-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (283 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m283.6/283.6 kB\u001b[0m \u001b[31m32.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting realesrgan==0.3.0 (from -r requirements.txt (line 9))\n"," Downloading realesrgan-0.3.0-py3-none-any.whl (26 kB)\n","Collecting torch==2.1.1 (from -r requirements.txt (line 10))\n"," Downloading https://download.pytorch.org/whl/cu121/torch-2.1.1%2Bcu121-cp310-cp310-linux_x86_64.whl (2200.7 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.2/2.2 GB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: tqdm==4.66.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 11)) (4.66.1)\n","Collecting addict (from basicsr==1.4.2->-r requirements.txt (line 1))\n"," Downloading addict-2.4.0-py3-none-any.whl (3.8 kB)\n","Requirement already satisfied: future in /usr/local/lib/python3.10/dist-packages (from basicsr==1.4.2->-r requirements.txt (line 1)) (0.18.3)\n","Collecting lmdb (from basicsr==1.4.2->-r requirements.txt (line 1))\n"," Downloading lmdb-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (299 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m299.2/299.2 kB\u001b[0m \u001b[31m32.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: Pillow in /usr/local/lib/python3.10/dist-packages (from basicsr==1.4.2->-r requirements.txt (line 1)) (9.4.0)\n","Requirement already satisfied: pyyaml in /usr/local/lib/python3.10/dist-packages (from basicsr==1.4.2->-r requirements.txt (line 1)) (6.0.1)\n","Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from basicsr==1.4.2->-r requirements.txt (line 1)) (2.31.0)\n","Requirement already satisfied: scikit-image in /usr/local/lib/python3.10/dist-packages (from basicsr==1.4.2->-r requirements.txt (line 1)) (0.19.3)\n","Requirement already satisfied: scipy in /usr/local/lib/python3.10/dist-packages (from basicsr==1.4.2->-r requirements.txt (line 1)) (1.11.4)\n","Collecting tb-nightly (from basicsr==1.4.2->-r requirements.txt (line 1))\n"," Downloading tb_nightly-2.16.0a20240112-py3-none-any.whl (5.5 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.5/5.5 MB\u001b[0m \u001b[31m67.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: torchvision in /usr/local/lib/python3.10/dist-packages (from basicsr==1.4.2->-r requirements.txt (line 1)) (0.16.0+cu121)\n","Collecting yapf (from basicsr==1.4.2->-r requirements.txt (line 1))\n"," Downloading yapf-0.40.2-py3-none-any.whl (254 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m254.7/254.7 kB\u001b[0m \u001b[31m26.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting aiofiles<24.0,>=22.0 (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading aiofiles-23.2.1-py3-none-any.whl (15 kB)\n","Requirement already satisfied: altair<6.0,>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (4.2.2)\n","Collecting fastapi (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading fastapi-0.109.0-py3-none-any.whl (92 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m92.0/92.0 kB\u001b[0m \u001b[31m12.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting ffmpy (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading ffmpy-0.3.1.tar.gz (5.5 kB)\n"," Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n","Collecting gradio-client==0.6.1 (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading gradio_client-0.6.1-py3-none-any.whl (299 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m299.2/299.2 kB\u001b[0m \u001b[31m34.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting httpx (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading httpx-0.26.0-py3-none-any.whl (75 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.9/75.9 kB\u001b[0m \u001b[31m10.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: huggingface-hub>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (0.20.2)\n","Requirement already satisfied: importlib-resources<7.0,>=1.3 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (6.1.1)\n","Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (3.1.2)\n","Requirement already satisfied: markupsafe~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (2.1.3)\n","Requirement already satisfied: matplotlib~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (3.7.1)\n","Collecting orjson~=3.0 (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading orjson-3.9.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (138 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m138.7/138.7 kB\u001b[0m \u001b[31m18.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (23.2)\n","Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (1.5.3)\n","Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (1.10.13)\n","Collecting pydub (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n","Collecting python-multipart (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading python_multipart-0.0.6-py3-none-any.whl (45 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.7/45.7 kB\u001b[0m \u001b[31m6.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting semantic-version~=2.0 (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)\n","Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.50.2->-r requirements.txt (line 3)) (4.5.0)\n","Collecting uvicorn>=0.14.0 (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading uvicorn-0.25.0-py3-none-any.whl (60 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.3/60.3 kB\u001b[0m \u001b[31m8.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting websockets<12.0,>=10.0 (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading websockets-11.0.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m129.9/129.9 kB\u001b[0m \u001b[31m17.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: protobuf>=3.20.2 in /usr/local/lib/python3.10/dist-packages (from onnx==1.15.0->-r requirements.txt (line 5)) (3.20.3)\n","Collecting coloredlogs (from onnxruntime==1.16.3->-r requirements.txt (line 6))\n"," Downloading coloredlogs-15.0.1-py2.py3-none-any.whl (46 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m46.0/46.0 kB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: flatbuffers in /usr/local/lib/python3.10/dist-packages (from onnxruntime==1.16.3->-r requirements.txt (line 6)) (23.5.26)\n","Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from onnxruntime==1.16.3->-r requirements.txt (line 6)) (1.12)\n","Collecting facexlib>=0.2.5 (from realesrgan==0.3.0->-r requirements.txt (line 9))\n"," Downloading facexlib-0.3.0-py3-none-any.whl (59 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m59.6/59.6 kB\u001b[0m \u001b[31m8.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting gfpgan>=1.3.5 (from realesrgan==0.3.0->-r requirements.txt (line 9))\n"," Downloading gfpgan-1.3.8-py3-none-any.whl (52 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m52.2/52.2 kB\u001b[0m \u001b[31m7.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from torch==2.1.1->-r requirements.txt (line 10)) (3.13.1)\n","Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch==2.1.1->-r requirements.txt (line 10)) (3.2.1)\n","Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from torch==2.1.1->-r requirements.txt (line 10)) (2023.6.0)\n","Requirement already satisfied: triton==2.1.0 in /usr/local/lib/python3.10/dist-packages (from torch==2.1.1->-r requirements.txt (line 10)) (2.1.0)\n","Requirement already satisfied: entrypoints in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50.2->-r requirements.txt (line 3)) (0.4)\n","Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50.2->-r requirements.txt (line 3)) (4.19.2)\n","Requirement already satisfied: toolz in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.50.2->-r requirements.txt (line 3)) (0.12.0)\n","Collecting filterpy (from facexlib>=0.2.5->realesrgan==0.3.0->-r requirements.txt (line 9))\n"," Downloading filterpy-1.4.5.zip (177 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m178.0/178.0 kB\u001b[0m \u001b[31m22.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n","Requirement already satisfied: numba in /usr/local/lib/python3.10/dist-packages (from facexlib>=0.2.5->realesrgan==0.3.0->-r requirements.txt (line 9)) (0.58.1)\n","Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50.2->-r requirements.txt (line 3)) (1.2.0)\n","Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50.2->-r requirements.txt (line 3)) (0.12.1)\n","Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50.2->-r requirements.txt (line 3)) (4.47.0)\n","Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50.2->-r requirements.txt (line 3)) (1.4.5)\n","Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50.2->-r requirements.txt (line 3)) (3.1.1)\n","Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.50.2->-r requirements.txt (line 3)) (2.8.2)\n","Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio==3.50.2->-r requirements.txt (line 3)) (2023.3.post1)\n","Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->basicsr==1.4.2->-r requirements.txt (line 1)) (3.3.2)\n","Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->basicsr==1.4.2->-r requirements.txt (line 1)) (3.6)\n","Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->basicsr==1.4.2->-r requirements.txt (line 1)) (2.0.7)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->basicsr==1.4.2->-r requirements.txt (line 1)) (2023.11.17)\n","Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio==3.50.2->-r requirements.txt (line 3)) (8.1.7)\n","Collecting h11>=0.8 (from uvicorn>=0.14.0->gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m8.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting humanfriendly>=9.1 (from coloredlogs->onnxruntime==1.16.3->-r requirements.txt (line 6))\n"," Downloading humanfriendly-10.0-py2.py3-none-any.whl (86 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m86.8/86.8 kB\u001b[0m \u001b[31m10.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting starlette<0.36.0,>=0.35.0 (from fastapi->gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading starlette-0.35.1-py3-none-any.whl (71 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.1/71.1 kB\u001b[0m \u001b[31m9.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting typing-extensions~=4.0 (from gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading typing_extensions-4.9.0-py3-none-any.whl (32 kB)\n","Requirement already satisfied: anyio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50.2->-r requirements.txt (line 3)) (3.7.1)\n","Collecting httpcore==1.* (from httpx->gradio==3.50.2->-r requirements.txt (line 3))\n"," Downloading httpcore-1.0.2-py3-none-any.whl (76 kB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m76.9/76.9 kB\u001b[0m \u001b[31m11.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.50.2->-r requirements.txt (line 3)) (1.3.0)\n","Requirement already satisfied: imageio>=2.4.1 in /usr/local/lib/python3.10/dist-packages (from scikit-image->basicsr==1.4.2->-r requirements.txt (line 1)) (2.31.6)\n","Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.10/dist-packages (from scikit-image->basicsr==1.4.2->-r requirements.txt (line 1)) (2023.12.9)\n","Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from scikit-image->basicsr==1.4.2->-r requirements.txt (line 1)) (1.5.0)\n","Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->onnxruntime==1.16.3->-r requirements.txt (line 6)) (1.3.0)\n","Requirement already satisfied: absl-py>=0.4 in /usr/local/lib/python3.10/dist-packages (from tb-nightly->basicsr==1.4.2->-r requirements.txt (line 1)) (1.4.0)\n","Requirement already satisfied: grpcio>=1.48.2 in /usr/local/lib/python3.10/dist-packages (from tb-nightly->basicsr==1.4.2->-r requirements.txt (line 1)) (1.60.0)\n","Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.10/dist-packages (from tb-nightly->basicsr==1.4.2->-r requirements.txt (line 1)) (3.5.1)\n","Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.10/dist-packages (from tb-nightly->basicsr==1.4.2->-r requirements.txt (line 1)) (67.7.2)\n","Requirement already satisfied: six>1.9 in /usr/local/lib/python3.10/dist-packages (from tb-nightly->basicsr==1.4.2->-r requirements.txt (line 1)) (1.16.0)\n","Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in /usr/local/lib/python3.10/dist-packages (from tb-nightly->basicsr==1.4.2->-r requirements.txt (line 1)) (0.7.2)\n","Collecting tf-keras-nightly (from tb-nightly->basicsr==1.4.2->-r requirements.txt (line 1))\n"," Downloading tf_keras_nightly-2.16.0.dev2024011210-py3-none-any.whl (1.7 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.7/1.7 MB\u001b[0m \u001b[31m87.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: werkzeug>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from tb-nightly->basicsr==1.4.2->-r requirements.txt (line 1)) (3.0.1)\n","INFO: pip is looking at multiple versions of torchvision to determine which version is compatible with other requirements. This could take a while.\n","Collecting torchvision (from basicsr==1.4.2->-r requirements.txt (line 1))\n"," Downloading https://download.pytorch.org/whl/cu121/torchvision-0.16.2%2Bcu121-cp310-cp310-linux_x86_64.whl (6.8 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.8/6.8 MB\u001b[0m \u001b[31m71.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h Downloading torchvision-0.16.2-cp310-cp310-manylinux1_x86_64.whl (6.8 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.8/6.8 MB\u001b[0m \u001b[31m79.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h Downloading https://download.pytorch.org/whl/cu121/torchvision-0.16.1%2Bcu121-cp310-cp310-linux_x86_64.whl (6.8 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.8/6.8 MB\u001b[0m \u001b[31m80.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: importlib-metadata>=6.6.0 in /usr/local/lib/python3.10/dist-packages (from yapf->basicsr==1.4.2->-r requirements.txt (line 1)) (7.0.1)\n","Requirement already satisfied: platformdirs>=3.5.1 in /usr/local/lib/python3.10/dist-packages (from yapf->basicsr==1.4.2->-r requirements.txt (line 1)) (4.1.0)\n","Requirement already satisfied: tomli>=2.0.1 in /usr/local/lib/python3.10/dist-packages (from yapf->basicsr==1.4.2->-r requirements.txt (line 1)) (2.0.1)\n","Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.10/dist-packages (from importlib-metadata>=6.6.0->yapf->basicsr==1.4.2->-r requirements.txt (line 1)) (3.17.0)\n","Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50.2->-r requirements.txt (line 3)) (23.2.0)\n","Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50.2->-r requirements.txt (line 3)) (2023.12.1)\n","Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50.2->-r requirements.txt (line 3)) (0.32.1)\n","Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.50.2->-r requirements.txt (line 3)) (0.16.2)\n","Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio->httpx->gradio==3.50.2->-r requirements.txt (line 3)) (1.2.0)\n","Requirement already satisfied: llvmlite<0.42,>=0.41.0dev0 in /usr/local/lib/python3.10/dist-packages (from numba->facexlib>=0.2.5->realesrgan==0.3.0->-r requirements.txt (line 9)) (0.41.1)\n","Building wheels for collected packages: basicsr, ffmpy, filterpy\n"," Building wheel for basicsr (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Created wheel for basicsr: filename=basicsr-1.4.2-py3-none-any.whl size=214817 sha256=15d5980fe1ec455325b835d2034d8190b5b7fdd8588804c26e1e633031f984b4\n"," Stored in directory: /root/.cache/pip/wheels/38/83/99/2d8437cc652a01af27df5ff037a4075e95b52d67705c5f30ca\n"," Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Created wheel for ffmpy: filename=ffmpy-0.3.1-py3-none-any.whl size=5579 sha256=7cbb03178f8a1428b4aa57a5c99bbc956c2ca3ec2014189414eca0578d389ea5\n"," Stored in directory: /root/.cache/pip/wheels/01/a6/d1/1c0828c304a4283b2c1639a09ad86f83d7c487ef34c6b4a1bf\n"," Building wheel for filterpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Created wheel for filterpy: filename=filterpy-1.4.5-py3-none-any.whl size=110458 sha256=5a95e31be99475d4be4a1308d83ccf7f1c15b278b9c2dac623747e7a61bb9602\n"," Stored in directory: /root/.cache/pip/wheels/0f/0c/ea/218f266af4ad626897562199fbbcba521b8497303200186102\n","Successfully built basicsr ffmpy filterpy\n","Installing collected packages: pydub, lmdb, filetype, ffmpy, addict, websockets, typing-extensions, tf-keras-nightly, semantic-version, python-multipart, psutil, orjson, numpy, humanfriendly, h11, aiofiles, yapf, uvicorn, torch, tb-nightly, starlette, opencv-python, onnx, httpcore, coloredlogs, torchvision, onnxruntime, httpx, fastapi, gradio-client, filterpy, basicsr, gradio, facexlib, gfpgan, realesrgan\n"," Attempting uninstall: typing-extensions\n"," Found existing installation: typing_extensions 4.5.0\n"," Uninstalling typing_extensions-4.5.0:\n"," Successfully uninstalled typing_extensions-4.5.0\n"," Attempting uninstall: psutil\n"," Found existing installation: psutil 5.9.5\n"," Uninstalling psutil-5.9.5:\n"," Successfully uninstalled psutil-5.9.5\n"," Attempting uninstall: numpy\n"," Found existing installation: numpy 1.23.5\n"," Uninstalling numpy-1.23.5:\n"," Successfully uninstalled numpy-1.23.5\n"," Attempting uninstall: opencv-python\n"," Found existing installation: opencv-python 4.8.0.76\n"," Uninstalling opencv-python-4.8.0.76:\n"," Successfully uninstalled opencv-python-4.8.0.76\n"," Attempting uninstall: torchvision\n"," Found existing installation: torchvision 0.16.0+cu121\n"," Uninstalling torchvision-0.16.0+cu121:\n"," Successfully uninstalled torchvision-0.16.0+cu121\n","\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n","lida 0.0.10 requires kaleido, which is not installed.\n","tensorflow-probability 0.22.0 requires typing-extensions<4.6.0, but you have typing-extensions 4.9.0 which is incompatible.\n","torchaudio 2.1.0+cu121 requires torch==2.1.0, but you have torch 2.1.1+cu121 which is incompatible.\n","torchdata 0.7.0 requires torch==2.1.0, but you have torch 2.1.1+cu121 which is incompatible.\n","torchtext 0.16.0 requires torch==2.1.0, but you have torch 2.1.1+cu121 which is incompatible.\u001b[0m\u001b[31m\n","\u001b[0mSuccessfully installed addict-2.4.0 aiofiles-23.2.1 basicsr-1.4.2 coloredlogs-15.0.1 facexlib-0.3.0 fastapi-0.109.0 ffmpy-0.3.1 filetype-1.2.0 filterpy-1.4.5 gfpgan-1.3.8 gradio-3.50.2 gradio-client-0.6.1 h11-0.14.0 httpcore-1.0.2 httpx-0.26.0 humanfriendly-10.0 lmdb-1.4.1 numpy-1.26.2 onnx-1.15.0 onnxruntime-1.16.3 opencv-python-4.8.1.78 orjson-3.9.10 psutil-5.9.6 pydub-0.25.1 python-multipart-0.0.6 realesrgan-0.3.0 semantic-version-2.10.0 starlette-0.35.1 tb-nightly-2.16.0a20240112 tf-keras-nightly-2.16.0.dev2024011210 torch-2.1.1+cu121 torchvision-0.16.1+cu121 typing-extensions-4.9.0 uvicorn-0.25.0 websockets-11.0.3 yapf-0.40.2\n","\u001b[33mWARNING: Skipping ort-nightly-gpu as it is not installed.\u001b[0m\u001b[33m\n","\u001b[0mLooking in indexes: https://pypi.org/simple, https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ort-cuda-12-nightly/pypi/simple\n","Collecting ort-nightly-gpu==1.17.0.dev20231205004\n"," Downloading https://aiinfra.pkgs.visualstudio.com/2692857e-05ef-43b4-ba9c-ccf1c22c437c/_packaging/d3daa2b0-aa56-45ac-8145-2c3dc0661c87/pypi/download/ort-nightly-gpu/1.17.dev20231205004/ort_nightly_gpu-1.17.0.dev20231205004-cp310-cp310-manylinux_2_28_x86_64.whl (168.1 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m168.1/168.1 MB\u001b[0m \u001b[31m2.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: coloredlogs in /usr/local/lib/python3.10/dist-packages (from ort-nightly-gpu==1.17.0.dev20231205004) (15.0.1)\n","Requirement already satisfied: flatbuffers in /usr/local/lib/python3.10/dist-packages (from ort-nightly-gpu==1.17.0.dev20231205004) (23.5.26)\n","Requirement already satisfied: numpy>=1.21.6 in /usr/local/lib/python3.10/dist-packages (from ort-nightly-gpu==1.17.0.dev20231205004) (1.26.2)\n","Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from ort-nightly-gpu==1.17.0.dev20231205004) (23.2)\n","Requirement already satisfied: protobuf in /usr/local/lib/python3.10/dist-packages (from ort-nightly-gpu==1.17.0.dev20231205004) (3.20.3)\n","Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from ort-nightly-gpu==1.17.0.dev20231205004) (1.12)\n","Requirement already satisfied: humanfriendly>=9.1 in /usr/local/lib/python3.10/dist-packages (from coloredlogs->ort-nightly-gpu==1.17.0.dev20231205004) (10.0)\n","Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->ort-nightly-gpu==1.17.0.dev20231205004) (1.3.0)\n","Installing collected packages: ort-nightly-gpu\n","Successfully installed ort-nightly-gpu-1.17.0.dev20231205004\n"]}],"source":["!git clone https://github.com/revolverocelot1/face_fusion-unlocked\n","%cd '/content/face_fusion-unlocked'\n","!python install.py --torch cuda-nightly --onnxruntime cuda-nightly --skip-venv"]},{"cell_type":"markdown","metadata":{"id":"J6HT5NpVcZOC"},"source":["Setup"]},{"cell_type":"code","execution_count":2,"metadata":{"id":"YVHiNI-bb6IB","executionInfo":{"status":"ok","timestamp":1705140626589,"user_tz":-330,"elapsed":2262,"user":{"displayName":"","userId":""}},"outputId":"103e92c4-8be2-4b29-9be3-5fbc409edb50","colab":{"base_uri":"https://localhost:8080/"}},"outputs":[{"output_type":"stream","name":"stdout","text":["# remote.moe:22 SSH-2.0-Go\n"]}],"source":["!ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<> ~/.ssh/known_hosts"]},{"cell_type":"markdown","metadata":{"id":"vsfWtUCSGrrl"},"source":["Run"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"YVHiNI-bb6IA","outputId":"e08f355a-6ad4-49ae-d6d4-54750a5b853d","colab":{"base_uri":"https://localhost:8080/"}},"outputs":[{"output_type":"stream","name":"stdout","text":["/content/face_fusion-unlocked\n","\u001b[1mhttp\u001b[0m (80)\n","http://u63wrnupb33bvcdxfhtwzikq67plajwhhrkrpl3jvb6r4dl67tzq.remote.moe/\n","\n","$\n"," \n","Downloading: 100% 22.5M/22.5M [00:00<00:00, 25.2MB/s]\n","Downloading: 100% 16.1M/16.1M [00:00<00:00, 29.0MB/s]\n","Downloading: 100% 227k/227k [00:00<00:00, 505kB/s]\n","Downloading: 100% 166M/166M [00:01<00:00, 140MB/s]\n","Downloading: 100% 200M/200M [00:01<00:00, 140MB/s]\n","Downloading: 100% 1.26M/1.26M [00:00<00:00, 2.67MB/s]\n","Downloading: 100% 67.1M/67.1M [00:00<00:00, 96.4MB/s]\n","Downloading: 100% 50.7M/50.7M [00:00<00:00, 67.9MB/s]\n","Downloading: 100% 529M/529M [00:02<00:00, 191MB/s]\n","Running on local URL: http://127.0.0.1:7860\n","\n","To create a public link, set `share=True` in `launch()`.\n","[FACEFUSION.PROCESSORS.FRAME.MODULES.FACE_SWAPPER] Select an image for source path!\n","Analysing: 100% 1135/1135 [00:09<00:00, 119.34frame/s, rate=0]\n","[FACEFUSION.CORE] Creating temporary resources\n","[FACEFUSION.CORE] Extracting frames with 25.0 FPS\n","[FACEFUSION.PROCESSORS.FRAME.MODULES.FACE_SWAPPER] Processing\n","Processing: 100% 1135/1135 [01:29<00:00, 12.73frame/s, execution_providers=['cuda', 'cpu'], execution_thread_count=4, execution_queue_count=1]\n","[FACEFUSION.PROCESSORS.FRAME.MODULES.FACE_DEBUGGER] Processing\n","Processing: 100% 1135/1135 [00:43<00:00, 26.04frame/s, execution_providers=['cuda', 'cpu'], execution_thread_count=4, execution_queue_count=1]\n","[FACEFUSION.CORE] Merging video with 25.0 FPS\n","[FACEFUSION.CORE] Restoring audio\n","[FACEFUSION.CORE] Clearing temporary resources\n","[FACEFUSION.CORE] Processing to video succeed\n","[FACEFUSION.CORE] Creating temporary resources\n","[FACEFUSION.CORE] Extracting frames with 25.0 FPS\n","[FACEFUSION.PROCESSORS.FRAME.MODULES.FACE_SWAPPER] Processing\n","Processing: 33% 371/1135 [00:29<01:12, 10.56frame/s, execution_providers=['cuda', 'cpu'], execution_thread_count=4, execution_queue_count=1]"]}],"source":["%cd '/content/face_fusion-unlocked'\n","!python run.py --execution-providers cuda & ssh -R 80:localhost:7860 remote.moe"]}],"metadata":{"accelerator":"GPU","colab":{"provenance":[{"file_id":"https://github.com/facefusion/facefusion-colab/blob/master/facefusion.ipynb","timestamp":1705141499581},{"file_id":"17FwlS26zvLhXtiEGvdC7EiC2lUToBJ5v","timestamp":1694089316266}]},"kernelspec":{"display_name":"Python","name":"python3"},"language_info":{"name":"python"}},"nbformat":4,"nbformat_minor":0}