Spaces:
Runtime error
Runtime error
File size: 9,086 Bytes
b6d5990 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/AlvinKimata/ml-projects/blob/main/DFDT%20TMC/Multimodal_deepfake_training_notebook.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "FK1MZWm7oFa6",
"outputId": "ec19e080-086b-4cd6-997f-14dce5c61540"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cloning into 'ml-projects'...\n",
"remote: Enumerating objects: 3730, done.\u001b[K\n",
"remote: Counting objects: 100% (719/719), done.\u001b[K\n",
"remote: Compressing objects: 100% (392/392), done.\u001b[K\n",
"remote: Total 3730 (delta 305), reused 710 (delta 298), pack-reused 3011\u001b[K\n",
"Receiving objects: 100% (3730/3730), 218.98 MiB | 9.61 MiB/s, done.\n",
"Resolving deltas: 100% (307/307), done.\n"
]
}
],
"source": [
"!git clone 'https://github.com/AlvinKimata/ml-projects.git'"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "IUb5rFqssg2j",
"outputId": "665d0e33-6d70-4873-d8ad-614dffdcf843"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\"username\":\"kaggle_username\",\"key\":\"kaggle_api_key\"}\n"
]
}
],
"source": [
"!mkdir ../root/.kaggle/\n",
"!echo '{\"username\":\"kaggle_username\",\"key\":\"kaggle_api_key\"}' >> /root/.kaggle/kaggle.json\n",
"!chmod 400 ../root/.kaggle/kaggle.json #Read-only\n",
"!cat ../root/.kaggle/kaggle.json"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "owPZaNL8qAW8",
"outputId": "60e95755-df58-4906-e7ca-c9bb950c95cb"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloading fakeavceleb-tfrecord.zip to /content\n",
" 98% 1.52G/1.55G [00:20<00:00, 116MB/s]\n",
"100% 1.55G/1.55G [00:21<00:00, 79.2MB/s]\n"
]
}
],
"source": [
"!kaggle datasets download -d kimatadebonair/fakeavceleb-tfrecord"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"id": "SG3kuPIJstaN"
},
"outputs": [],
"source": [
"!unzip -q '/content/fakeavceleb-tfrecord.zip' -d inputs/"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "CyAvPAhKgi9K"
},
"outputs": [],
"source": [
"!pip install -r 'DFDT TMC/requirements.txt'"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"id": "sbBCy3Nps3V-"
},
"outputs": [],
"source": [
"!cp -r '/content/ml-projects/DFDT TMC' ./"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "LYmBafKPuGOM",
"outputId": "cebc40c2-40c2-4425-f4e8-55e7656df4d3"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"cp: cannot stat '/content/inputs/fakeavceleb_1k-000010-of-00015': No such file or directory\n",
"cp: cannot stat '/content/inputs/fakeavceleb_1k-000011-of-00015': No such file or directory\n",
"cp: cannot stat '/content/inputs/fakeavceleb_1k-000012-of-00015': No such file or directory\n",
"cp: cannot stat '/content/inputs/fakeavceleb_1k-000013-of-00015': No such file or directory\n"
]
}
],
"source": [
"for i in range(14):\n",
" !cp '/content/inputs/fakeavceleb_1k-0000{i}-of-00015' '/content/DFDT TMC/datasets/train'"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"id": "O1mT677Uc0qu"
},
"outputs": [],
"source": [
"for i in range(10, 15):\n",
" !cp '/content/inputs/fakeavceleb_1k-000{i}-of-00015' '/content/DFDT TMC/datasets/train'"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "_-TCpjHVqT36",
"outputId": "88873108-392c-4830-f4e4-76b3a2cc8b3c"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--2023-07-14 09:10:01-- https://github.com/selimsef/dfdc_deepfake_challenge/releases/download/0.0.1/final_999_DeepFakeClassifier_tf_efficientnet_b7_ns_0_23\n",
"Resolving github.com (github.com)... 192.30.255.112\n",
"Connecting to github.com (github.com)|192.30.255.112|:443... connected.\n",
"HTTP request sent, awaiting response... 302 Found\n",
"Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/270020698/6e91bf80-a835-11ea-8950-51c980e899ce?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230714%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230714T091002Z&X-Amz-Expires=300&X-Amz-Signature=8623af355287f61ac5b0e7857ae8c21efdbeb265ccc3662b57cee5f04f31f572&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=270020698&response-content-disposition=attachment%3B%20filename%3Dfinal_999_DeepFakeClassifier_tf_efficientnet_b7_ns_0_23&response-content-type=application%2Foctet-stream [following]\n",
"--2023-07-14 09:10:02-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/270020698/6e91bf80-a835-11ea-8950-51c980e899ce?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230714%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230714T091002Z&X-Amz-Expires=300&X-Amz-Signature=8623af355287f61ac5b0e7857ae8c21efdbeb265ccc3662b57cee5f04f31f572&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=270020698&response-content-disposition=attachment%3B%20filename%3Dfinal_999_DeepFakeClassifier_tf_efficientnet_b7_ns_0_23&response-content-type=application%2Foctet-stream\n",
"Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.109.133, 185.199.110.133, ...\n",
"Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 266910615 (255M) [application/octet-stream]\n",
"Saving to: ‘final_999_DeepFakeClassifier_tf_efficientnet_b7_ns_0_23’\n",
"\n",
"final_999_DeepFakeC 100%[===================>] 254.54M 66.8MB/s in 3.8s \n",
"\n",
"2023-07-14 09:10:06 (66.4 MB/s) - ‘final_999_DeepFakeClassifier_tf_efficientnet_b7_ns_0_23’ saved [266910615/266910615]\n",
"\n"
]
}
],
"source": [
"!cd '/content/DFDT TMC/pretrained' && wget 'https://github.com/selimsef/dfdc_deepfake_challenge/releases/download/0.0.1/final_999_DeepFakeClassifier_tf_efficientnet_b7_ns_0_23'''"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "DvA-myf8s9-9",
"outputId": "477f4488-e1fb-44bb-b867-71c325c85dcb"
},
"outputs": [],
"source": [
"!python '/content/DFDT TMC/train_dfdc_tf.py' --device='cuda' \\\n",
" --data_dir=\"/content/DFDT TMC/datasets/train/fakeavceleb_1k*\" \\\n",
" --pretrained_image_encoder=True --pretrained_audio_encoder=True"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "kGfym7pEn4aP"
},
"outputs": [],
"source": []
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"authorship_tag": "ABX9TyNzEVTklkrYn6Mgz+yxoZaI",
"gpuType": "T4",
"include_colab_link": true,
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|