File size: 22,244 Bytes
96134ee
 
 
 
 
 
 
 
 
1787c7d
96134ee
 
 
 
 
1787c7d
 
 
 
 
 
 
96134ee
 
 
 
 
 
 
 
1787c7d
 
 
 
 
 
 
96134ee
 
 
 
 
 
 
 
 
 
 
1787c7d
96134ee
1787c7d
96134ee
1787c7d
96134ee
1787c7d
 
 
 
 
96134ee
 
 
1787c7d
96134ee
 
1787c7d
 
 
 
 
96134ee
1787c7d
 
 
 
 
 
 
 
 
96134ee
1787c7d
 
 
96134ee
 
 
 
 
 
 
 
1787c7d
 
 
 
 
96134ee
 
 
1787c7d
96134ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1787c7d
96134ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1787c7d
 
 
 
 
 
 
96134ee
 
 
 
 
 
 
 
 
 
 
 
1787c7d
 
 
96134ee
 
 
 
 
1787c7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96134ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/TheNeodev/Notebook/blob/main/RVC-MAKER.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# <h1 align=\"center\"><b> Ultimate RVC Maker 🎡 </b></h1>\n",
        "<div align=\"center\">\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "an high-quality voice conversion tool focused on experimenting and performance, based on Vietnamese-RVC (which is an RVC Fork)."
      ],
      "metadata": {
        "id": "vOlZ8mQ0XMpC"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "<div align=\"center\">\n",
        "\n",
        "_____________________________________________________________\n",
        "[support](https://discord.gg/aihub) | [github](https://github.com/unchCrew/RVC-MAKER.git) | [Terms of Use](https://github.com/unchCrew/RVC-MAKER/blob/main/TERMS_OF_USE.md)\n",
        "_____________________________________________________________\n",
        "\n",
        "\n",
        "**This project was created by [TheNeoDev](https://github.com/TheNeodev)** base on [PhamHuynhAnh16/Vietnamese-RVC](https://github.com/PhamHuynhAnh16/Vietnamese-RVC)\n",
        "\n",
        "---"
      ],
      "metadata": {
        "id": "nwKyFp0aaJsS"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "**Acknowledgments**\n",
        "\n",
        "To all external collaborators for their special help in the following areas: Original RVC / Mainline (for making RVC), Vietnamese-RVC (for their up to date Fork used as a Base),\n",
        "\n",
        "**Disclaimer**\n",
        "\n",
        "By using Ultimate RVC Maker, you agree to comply with ethical and legal standards, respect intellectual property and privacy rights, avoid harmful or prohibited uses, and accept full responsibility for any outcomes, while Ultimate RVC Maker  disclaims liability and reserves the right to amend these terms."
      ],
      "metadata": {
        "id": "4-h9Eo-IwDBG"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "cellView": "form",
        "id": "BJeRif5jjL5s",
        "outputId": "341804d9-18e0-4e88-e59c-a86e69ecedb3",
        "colab": {
          "base_uri": "https://localhost:8080/"
        }
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "βœ… Finished installing requirements!\n"
          ]
        }
      ],
      "source": [
        "\n",
        "\n",
        " #@title **INSTALL ULTIMATE RVC MAKER!**\n",
        "\n",
        "import os\n",
        "from ipywidgets import Button\n",
        "from IPython.display import clear_output\n",
        "print(\"πŸ‘©πŸ»β€πŸ’» INSTALLING...\")\n",
        "\n",
        "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n",
        "\n",
        "!git clone https://github.com/unchCrew/RVC-MAKER.git /content/program > /dev/null 2>&1\n",
        "!pip install -r /content/program/requirements.txt  > /dev/null 2>&1\n",
        "!pip install pyngrok > /dev/null 2>&1\n",
        "!uv pip install --index-url https://download.pytorch.org/whl/cu128 > /dev/null 2>&1\n",
        "\n",
        "\n",
        "#@markdown **πŸ’» Installation will take about 2 minutes to complete!**\n",
        "clear_output()\n",
        "print(\"βœ… Finished installing requirements!\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "cIsBEvHaQWMJ",
        "cellView": "form"
      },
      "outputs": [],
      "source": [
        "#@title **Run webui**\n",
        "import os\n",
        "import shutil\n",
        "\n",
        "%cd /content/program\n",
        "#@markdown **To experience all the features, use the interface :)**\n",
        "\n",
        "#@markdown **If you know you can use the tensorboard to check for overtraining πŸ‘**\n",
        "tensorboard = False #@param {type:\"boolean\"}\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "\n",
        "# @markdown  ### Choose a sharing method:\n",
        "\n",
        "import codecs\n",
        "import threading\n",
        "import urllib.request\n",
        "import time\n",
        "import ipywidgets as widgets\n",
        "from IPython.display import display\n",
        "import os\n",
        "from pyngrok import ngrok\n",
        "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n",
        "\n",
        "method = \"gradio\"  # @param [\"gradio\", \"localtunnel\", \"ngrok\"]\n",
        "\n",
        "\n",
        "#@markdown If you selected the 'ngrok' method, obtain your auth token here: https://dashboard.ngrok.com/get-started/your-authtoken\n",
        "ngrok_token = \"\" # @param {type:\"string\"}\n",
        "\n",
        "def start_gradio():\n",
        "    !python main/app/app.py --share\n",
        "\n",
        "def start_localtunnel():\n",
        "    !npm install -g localtunnel &>/dev/null\n",
        "    with open('url.txt', 'w') as file:\n",
        "        file.write('')\n",
        "    get_ipython().system_raw('lt --port 7860 >> url.txt 2>&1 &')\n",
        "    time.sleep(2)\n",
        "    endpoint_ip = urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\")\n",
        "\n",
        "    with open('url.txt', 'r') as file:\n",
        "        tunnel_url = file.read()\n",
        "        tunnel_url = tunnel_url.replace(\"your url is: \", \"\")\n",
        "\n",
        "    print(f\"Share Link: \\033[0m\\033[93m{tunnel_url}\\033[0m\", end=\"\\033[0m\\n\")\n",
        "\n",
        "    password_endpoint_widget = widgets.Text(\n",
        "    value=endpoint_ip,\n",
        "    description='Password IP:',\n",
        "    disabled=True\n",
        "    )\n",
        "    display(password_endpoint_widget)\n",
        "    !python main/app/app.py\n",
        "\n",
        "\n",
        "def start_ngrok():\n",
        "    try:\n",
        "        ngrok.set_auth_token(ngrok_token)\n",
        "        ngrok.kill()\n",
        "        tunnel = ngrok.connect(7860)\n",
        "        print(f\"Ngrok URL: \\033[0m\\033[93m{tunnel.public_url}\\033[0m\", end=\"\\033[0m\\n\")\n",
        "        !python app.py --listen\n",
        "    except Exception as e:\n",
        "        print(f\"Error starting ngrok: {e}\")\n",
        "\n",
        "def start_app():\n",
        "    if method == 'gradio':\n",
        "        start_gradio()\n",
        "    elif method == 'localtunnel':\n",
        "        start_localtunnel()\n",
        "    elif method == 'ngrok':\n",
        "        start_ngrok()\n",
        "\n",
        "if tensorboard:\n",
        "  %load_ext tensorboard\n",
        "  %tensorboard --logdir ./assets/logs --port=6870\n",
        "\n",
        "if \"autobackups\" not in globals():\n",
        "    autobackups = False\n",
        "\n",
        "if autobackups:\n",
        "    thread = threading.Thread(target=backup_files)\n",
        "    thread.start()\n",
        "\n",
        "\n",
        "thread_app = threading.Thread(target=start_app)\n",
        "thread_app.start()\n",
        "\n",
        "\n",
        "while True:\n",
        "    time.sleep(5)"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "# Extra\n",
        "\n",
        "Enjoy extra options that can make it easier for you to use Ultimate RVC Maker"
      ],
      "metadata": {
        "id": "OVg-SqBKXIFL"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# @title Mount Drive\n",
        "# @markdown Mount the files from Google Drive to the Colab.\n",
        "from google.colab import drive\n",
        "\n",
        "drive.mount(\"/content/drive\")"
      ],
      "metadata": {
        "cellView": "form",
        "id": "iVmOpUn2xhe_"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# @title Auto Backup\n",
        "# @markdown When running it, it will be activated or deactivated previously to start up together with RVC Maker.\n",
        "import os\n",
        "import shutil\n",
        "import time\n",
        "\n",
        "LOGS_FOLDER = \"/content/program/assets/logs/\"\n",
        "GOOGLE_DRIVE_PATH = \"/content/drive/MyDrive/RVCBackup\"\n",
        "\n",
        "if \"autobackups\" not in globals():\n",
        "    autobackups = False\n",
        "\n",
        "cooldown = 15  # @param {type:\"slider\", min:0, max:100, step:0}\n",
        "def backup_files():\n",
        "    print(\"\\nStarting backup loop...\")\n",
        "    last_backup_timestamps_path = os.path.join(\n",
        "        LOGS_FOLDER, \"last_backup_timestamps.txt\"\n",
        "    )\n",
        "    fully_updated = False\n",
        "\n",
        "    while True:\n",
        "        try:\n",
        "            updated_files = 0\n",
        "            deleted_files = 0\n",
        "            new_files = 0\n",
        "            last_backup_timestamps = {}\n",
        "\n",
        "            try:\n",
        "                with open(last_backup_timestamps_path, \"r\") as f:\n",
        "                    last_backup_timestamps = dict(line.strip().split(\":\") for line in f)\n",
        "            except FileNotFoundError:\n",
        "                pass\n",
        "\n",
        "            for root, dirs, files in os.walk(LOGS_FOLDER):\n",
        "                # Excluding \"zips\" and \"mute\" directories\n",
        "                if \"zips\" in dirs:\n",
        "                    dirs.remove(\"zips\")\n",
        "                if \"mute\" in dirs:\n",
        "                    dirs.remove(\"mute\")\n",
        "\n",
        "                for filename in files:\n",
        "                    if filename != \"last_backup_timestamps.txt\":\n",
        "                        filepath = os.path.join(root, filename)\n",
        "                        if os.path.isfile(filepath):\n",
        "                            backup_filepath = os.path.join(\n",
        "                                GOOGLE_DRIVE_PATH,\n",
        "                                os.path.relpath(filepath, LOGS_FOLDER),\n",
        "                            )\n",
        "                            backup_folderpath = os.path.dirname(backup_filepath)\n",
        "                            if not os.path.exists(backup_folderpath):\n",
        "                                os.makedirs(backup_folderpath)\n",
        "                            last_backup_timestamp = last_backup_timestamps.get(filepath)\n",
        "                            current_timestamp = os.path.getmtime(filepath)\n",
        "                            if (\n",
        "                                last_backup_timestamp is None\n",
        "                                or float(last_backup_timestamp) < current_timestamp\n",
        "                            ):\n",
        "                                shutil.copy2(filepath, backup_filepath)\n",
        "                                last_backup_timestamps[filepath] = str(current_timestamp)\n",
        "                                if last_backup_timestamp is None:\n",
        "                                    new_files += 1\n",
        "                                else:\n",
        "                                    updated_files += 1\n",
        "\n",
        "\n",
        "            for filepath in list(last_backup_timestamps.keys()):\n",
        "                if not os.path.exists(filepath):\n",
        "                    backup_filepath = os.path.join(\n",
        "                        GOOGLE_DRIVE_PATH, os.path.relpath(filepath, LOGS_FOLDER)\n",
        "                    )\n",
        "                    if os.path.exists(backup_filepath):\n",
        "                        os.remove(backup_filepath)\n",
        "                        deleted_files += 1\n",
        "                    del last_backup_timestamps[filepath]\n",
        "\n",
        "\n",
        "            if updated_files > 0 or deleted_files > 0 or new_files > 0:\n",
        "                print(f\"Backup Complete: {new_files} new, {updated_files} updated, {deleted_files} deleted.\")\n",
        "                fully_updated = False\n",
        "            elif not fully_updated:\n",
        "                print(\"Files are up to date.\")\n",
        "                fully_updated = True\n",
        "\n",
        "            with open(last_backup_timestamps_path, \"w\") as f:\n",
        "                for filepath, timestamp in last_backup_timestamps.items():\n",
        "                    f.write(f\"{filepath}:{timestamp}\\n\")\n",
        "\n",
        "            time.sleep(cooldown if fully_updated else 0.1)\n",
        "\n",
        "\n",
        "        except Exception as error:\n",
        "            print(f\"An error occurred during backup: {error}\")\n",
        "\n",
        "\n",
        "if autobackups:\n",
        "    autobackups = False\n",
        "    print(\"Autobackup Disabled\")\n",
        "else:\n",
        "    autobackups = True\n",
        "    print(\"Autobackup Enabled\")"
      ],
      "metadata": {
        "cellView": "form",
        "id": "7PoT_1qCxlLZ"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# @title Auto Backup\n",
        "# @markdown When running it, it will be activated or deactivated previously to start up together with Applio.\n",
        "import os\n",
        "import shutil\n",
        "import time\n",
        "\n",
        "LOGS_FOLDER = \"/content/program/assets/logs/\"\n",
        "GOOGLE_DRIVE_PATH = \"/content/drive/MyDrive/RVCBackup\"\n",
        "if \"autobackups\" not in globals():\n",
        "    autobackups = False\n",
        "\n",
        "cooldown = 15  # @param {type:\"slider\", min:0, max:100, step:0}\n",
        "def backup_files():\n",
        "    print(\"\\nStarting backup loop...\")\n",
        "    last_backup_timestamps_path = os.path.join(\n",
        "        LOGS_FOLDER, \"last_backup_timestamps.txt\"\n",
        "    )\n",
        "    fully_updated = False\n",
        "\n",
        "    while True:\n",
        "        try:\n",
        "            updated_files = 0\n",
        "            deleted_files = 0\n",
        "            new_files = 0\n",
        "            last_backup_timestamps = {}\n",
        "\n",
        "            try:\n",
        "                with open(last_backup_timestamps_path, \"r\") as f:\n",
        "                    last_backup_timestamps = dict(line.strip().split(\":\") for line in f)\n",
        "            except FileNotFoundError:\n",
        "                pass\n",
        "\n",
        "            for root, dirs, files in os.walk(LOGS_FOLDER):\n",
        "                # Excluding \"zips\" and \"mute\" directories\n",
        "                if \"zips\" in dirs:\n",
        "                    dirs.remove(\"zips\")\n",
        "                if \"mute\" in dirs:\n",
        "                    dirs.remove(\"mute\")\n",
        "\n",
        "                for filename in files:\n",
        "                    if filename != \"last_backup_timestamps.txt\":\n",
        "                        filepath = os.path.join(root, filename)\n",
        "                        if os.path.isfile(filepath):\n",
        "                            backup_filepath = os.path.join(\n",
        "                                GOOGLE_DRIVE_PATH,\n",
        "                                os.path.relpath(filepath, LOGS_FOLDER),\n",
        "                            )\n",
        "                            backup_folderpath = os.path.dirname(backup_filepath)\n",
        "                            if not os.path.exists(backup_folderpath):\n",
        "                                os.makedirs(backup_folderpath)\n",
        "                            last_backup_timestamp = last_backup_timestamps.get(filepath)\n",
        "                            current_timestamp = os.path.getmtime(filepath)\n",
        "                            if (\n",
        "                                last_backup_timestamp is None\n",
        "                                or float(last_backup_timestamp) < current_timestamp\n",
        "                            ):\n",
        "                                shutil.copy2(filepath, backup_filepath)\n",
        "                                last_backup_timestamps[filepath] = str(current_timestamp)\n",
        "                                if last_backup_timestamp is None:\n",
        "                                    new_files += 1\n",
        "                                else:\n",
        "                                    updated_files += 1\n",
        "\n",
        "\n",
        "            for filepath in list(last_backup_timestamps.keys()):\n",
        "                if not os.path.exists(filepath):\n",
        "                    backup_filepath = os.path.join(\n",
        "                        GOOGLE_DRIVE_PATH, os.path.relpath(filepath, LOGS_FOLDER)\n",
        "                    )\n",
        "                    if os.path.exists(backup_filepath):\n",
        "                        os.remove(backup_filepath)\n",
        "                        deleted_files += 1\n",
        "                    del last_backup_timestamps[filepath]\n",
        "\n",
        "\n",
        "            if updated_files > 0 or deleted_files > 0 or new_files > 0:\n",
        "                print(f\"Backup Complete: {new_files} new, {updated_files} updated, {deleted_files} deleted.\")\n",
        "                fully_updated = False\n",
        "            elif not fully_updated:\n",
        "                print(\"Files are up to date.\")\n",
        "                fully_updated = True\n",
        "\n",
        "            with open(last_backup_timestamps_path, \"w\") as f:\n",
        "                for filepath, timestamp in last_backup_timestamps.items():\n",
        "                    f.write(f\"{filepath}:{timestamp}\\n\")\n",
        "\n",
        "            time.sleep(cooldown if fully_updated else 0.1)\n",
        "\n",
        "\n",
        "        except Exception as error:\n",
        "            print(f\"An error occurred during backup: {error}\")\n",
        "\n",
        "\n",
        "if autobackups:\n",
        "    autobackups = False\n",
        "    print(\"Autobackup Disabled\")\n",
        "else:\n",
        "    autobackups = True\n",
        "    print(\"Autobackup Enabled\")"
      ],
      "metadata": {
        "cellView": "form",
        "id": "f1_HldSGyelO"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "\n",
        "#@title upload model to HF model\n",
        "repo_hf = \"NeoPy/TTS-G\" # @param {type:\"string\"}\n",
        "pth = \"/content/RVC-MAKER/assets/weights/TTS_100e_500s.pth\" # @param {type:\"string\"}\n",
        "index = \"/content/RVC-MAKER/assets/logs/TTS/added_IVF59_Flat_nprobe_1_TTS_v2.index\" # @param {type:\"string\"}\n",
        "\n",
        "#@markdown get token on https://huggingface.co/settings/tokens\n",
        "\n",
        "token = \"hf_\" # @param {type:\"string\"}\n",
        "\n",
        "\n",
        "import huggingface_hub\n",
        "import zipfile\n",
        "import os\n",
        "def upload_model(repo, pth, index, token):\n",
        "    \"\"\"\n",
        "    Upload a model to the Hugging Face Hub\n",
        "\n",
        "    Args:\n",
        "        repo: str, the name of the repository (including user/org, e.g., \"username/repo_name\")\n",
        "        pth: str, path to the model file\n",
        "        index: str, the index of the model in the repository\n",
        "        token: str, the API token\n",
        "\n",
        "    Returns:\n",
        "        str, message indicating the success of the operation\n",
        "    \"\"\"\n",
        "    readme = f\"\"\"\n",
        "    # {repo}\n",
        "    This is a model uploaded by RVC Maker, using [NeoDev](https://github.com/TheNeodev)'s script.\n",
        "    \"\"\"\n",
        "    repo_name = repo.split('/')[1]\n",
        "    with zipfile.ZipFile(f'{repo_name}.zip', 'w') as zipf:\n",
        "        zipf.write(pth, os.path.basename(pth))\n",
        "        zipf.write(index, os.path.basename(index))\n",
        "        zipf.writestr('README.md', readme)\n",
        "\n",
        "    # Corrected: Pass the repo_id directly as the first argument\n",
        "    huggingface_hub.HfApi().create_repo(repo_id=repo, token=token, exist_ok=True)\n",
        "    # Change 'path' to 'path_or_fileobj' as per the error and common usage in newer versions\n",
        "    huggingface_hub.HfApi().upload_file(token=token, path_or_fileobj=f'{repo.split(\"/\")[1]}.zip', repo_id=repo, path_in_repo=f'{repo.split(\"/\")[1]}.zip')\n",
        "    os.remove(f'{repo.split(\"/\")[1]}.zip')\n",
        "    return \"Model uploaded successfully\"\n",
        "\n",
        "\n",
        "upload_model(repo_hf, pth, index, token)"
      ],
      "metadata": {
        "cellView": "form",
        "id": "Y1Jke8epTHFj"
      },
      "execution_count": null,
      "outputs": []
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "collapsed_sections": [
        "tkqks7bO2Cye",
        "XP4ifZaG_yd5",
        "ekfkFFNqppfM",
        "ers351v_CMGN"
      ],
      "gpuType": "T4",
      "provenance": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}