NagisaNao commited on
Commit
265fefa
·
verified ·
1 Parent(s): 2dbaba7

kaggle & colab download dep: faster; CNet download - fixed ;3

Browse files
files_cells/notebooks/en/auto-cleaner_en.ipynb CHANGED
@@ -266,10 +266,11 @@
266
  " deleted_files = 0\n",
267
  " for root, dirs, files in os.walk(directory):\n",
268
  " for file in files:\n",
269
- " if file.endswith((\".txt\", \".yaml\")):\n",
270
  " continue\n",
271
  " os.remove(os.path.join(root, file))\n",
272
- " deleted_files += 1\n",
 
273
  " return deleted_files\n",
274
  "\n",
275
  "\n",
 
266
  " deleted_files = 0\n",
267
  " for root, dirs, files in os.walk(directory):\n",
268
  " for file in files:\n",
269
+ " if file.endswith(\".txt\"):\n",
270
  " continue\n",
271
  " os.remove(os.path.join(root, file))\n",
272
+ " if not file.endswith(\".yaml\"):\n",
273
+ " deleted_files += 1\n",
274
  " return deleted_files\n",
275
  "\n",
276
  "\n",
files_cells/notebooks/en/downloading_en.ipynb CHANGED
@@ -89,9 +89,10 @@
89
  " !wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb\n",
90
  "\n",
91
  " if env == \"Google Colab\":\n",
92
- " !pip install -q {torch} -U\n",
93
  " else:\n",
94
- " !pip install -q {torch} -U\n",
 
95
  " !pip install -q {xformers} -U\n",
96
  "\n",
97
  " with open(flag_file, \"w\") as f:\n",
@@ -346,6 +347,7 @@
346
  "url = \"\"\n",
347
  "hf_token = optional_huggingface_token if optional_huggingface_token else \"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\"\n",
348
  "user_header = f\"\\\"Authorization: Bearer {hf_token}\\\"\"\n",
 
349
  "\n",
350
  "def handle_manual(url):\n",
351
  " original_url = url\n",
@@ -366,6 +368,7 @@
366
  "\n",
367
  "def manual_download(url, dst_dir, file_name):\n",
368
  " basename = url.split(\"/\")[-1] if file_name is None else file_name\n",
 
369
  "\n",
370
  " # I do it at my own risk..... Fucking CivitAi >:(\n",
371
  " civitai_token = \"62c0c5956b2f9defbd844d754000180b\"\n",
@@ -385,10 +388,10 @@
385
  " if '/blob/' in url:\n",
386
  " url = url.replace('/blob/', '/resolve/')\n",
387
  " if file_name:\n",
388
- " !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --header={user_header} -c -j5 -x16 -s16 -k1M -d {dst_dir} -o {basename} {url}\n",
389
  " else:\n",
390
- " parsed_link = '\\n{}\\n\\tout={}'.format(url, unquote(url.split('/')[-1]))\n",
391
- " !echo -e \"{parsed_link}\" | aria2c --header={user_header} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d \"{dst_dir}\" -o {basename}\n",
392
  " # -- Other --\n",
393
  " elif 'http' in url or 'magnet' in url:\n",
394
  " if file_name:\n",
 
89
  " !wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb\n",
90
  "\n",
91
  " if env == \"Google Colab\":\n",
92
+ " !pip install -q pip install xformers==0.0.26.dev769 -U\n",
93
  " else:\n",
94
+ " if env != \"Kaggle\":\n",
95
+ " !pip install -q {torch} -U\n",
96
  " !pip install -q {xformers} -U\n",
97
  "\n",
98
  " with open(flag_file, \"w\") as f:\n",
 
347
  "url = \"\"\n",
348
  "hf_token = optional_huggingface_token if optional_huggingface_token else \"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\"\n",
349
  "user_header = f\"\\\"Authorization: Bearer {hf_token}\\\"\"\n",
350
+ "# user_header = f\"\\\"Authorization: Bearer {optional_huggingface_token}\\\"\"\n",
351
  "\n",
352
  "def handle_manual(url):\n",
353
  " original_url = url\n",
 
368
  "\n",
369
  "def manual_download(url, dst_dir, file_name):\n",
370
  " basename = url.split(\"/\")[-1] if file_name is None else file_name\n",
371
+ " header_option = f\"--header={user_header}\" # if optional_huggingface_token else \"\"\n",
372
  "\n",
373
  " # I do it at my own risk..... Fucking CivitAi >:(\n",
374
  " civitai_token = \"62c0c5956b2f9defbd844d754000180b\"\n",
 
388
  " if '/blob/' in url:\n",
389
  " url = url.replace('/blob/', '/resolve/')\n",
390
  " if file_name:\n",
391
+ " !aria2c {header_option} --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -c -j5 -x16 -s16 -k1M -d {dst_dir} -o {basename} {url}\n",
392
  " else:\n",
393
+ " parsed_link = f'\\n{url}\\n\\tout={unquote(url.split(\"/\")[-1])}'\n",
394
+ " !echo -e \"{parsed_link}\" | aria2c {header_option} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d \"{dst_dir}\" -o {basename}\n",
395
  " # -- Other --\n",
396
  " elif 'http' in url or 'magnet' in url:\n",
397
  " if file_name:\n",
files_cells/notebooks/ru/auto-cleaner_ru.ipynb CHANGED
@@ -266,10 +266,11 @@
266
  " deleted_files = 0\n",
267
  " for root, dirs, files in os.walk(directory):\n",
268
  " for file in files:\n",
269
- " if file.endswith((\".txt\", \".yaml\")):\n",
270
  " continue\n",
271
  " os.remove(os.path.join(root, file))\n",
272
- " deleted_files += 1\n",
 
273
  " return deleted_files\n",
274
  "\n",
275
  "\n",
 
266
  " deleted_files = 0\n",
267
  " for root, dirs, files in os.walk(directory):\n",
268
  " for file in files:\n",
269
+ " if file.endswith(\".txt\"):\n",
270
  " continue\n",
271
  " os.remove(os.path.join(root, file))\n",
272
+ " if not file.endswith(\".yaml\"):\n",
273
+ " deleted_files += 1\n",
274
  " return deleted_files\n",
275
  "\n",
276
  "\n",
files_cells/notebooks/ru/downloading_ru.ipynb CHANGED
@@ -89,9 +89,10 @@
89
  " !wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb\n",
90
  "\n",
91
  " if env == \"Google Colab\":\n",
92
- " !pip install -q {torch} -U\n",
93
  " else:\n",
94
- " !pip install -q {torch} -U\n",
 
95
  " !pip install -q {xformers} -U\n",
96
  "\n",
97
  " with open(flag_file, \"w\") as f:\n",
@@ -346,6 +347,7 @@
346
  "url = \"\"\n",
347
  "hf_token = optional_huggingface_token if optional_huggingface_token else \"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\"\n",
348
  "user_header = f\"\\\"Authorization: Bearer {hf_token}\\\"\"\n",
 
349
  "\n",
350
  "def handle_manual(url):\n",
351
  " original_url = url\n",
@@ -366,6 +368,7 @@
366
  "\n",
367
  "def manual_download(url, dst_dir, file_name):\n",
368
  " basename = url.split(\"/\")[-1] if file_name is None else file_name\n",
 
369
  "\n",
370
  " # I do it at my own risk..... Fucking CivitAi >:(\n",
371
  " civitai_token = \"62c0c5956b2f9defbd844d754000180b\"\n",
@@ -385,10 +388,10 @@
385
  " if '/blob/' in url:\n",
386
  " url = url.replace('/blob/', '/resolve/')\n",
387
  " if file_name:\n",
388
- " !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --header={user_header} -c -j5 -x16 -s16 -k1M -d {dst_dir} -o {basename} {url}\n",
389
  " else:\n",
390
- " parsed_link = '\\n{}\\n\\tout={}'.format(url, unquote(url.split('/')[-1]))\n",
391
- " !echo -e \"{parsed_link}\" | aria2c --header={user_header} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d \"{dst_dir}\" -o {basename}\n",
392
  " # -- Other --\n",
393
  " elif 'http' in url or 'magnet' in url:\n",
394
  " if file_name:\n",
 
89
  " !wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb\n",
90
  "\n",
91
  " if env == \"Google Colab\":\n",
92
+ " !pip install -q pip install xformers==0.0.26.dev769 -U\n",
93
  " else:\n",
94
+ " if env != \"Kaggle\":\n",
95
+ " !pip install -q {torch} -U\n",
96
  " !pip install -q {xformers} -U\n",
97
  "\n",
98
  " with open(flag_file, \"w\") as f:\n",
 
347
  "url = \"\"\n",
348
  "hf_token = optional_huggingface_token if optional_huggingface_token else \"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\"\n",
349
  "user_header = f\"\\\"Authorization: Bearer {hf_token}\\\"\"\n",
350
+ "# user_header = f\"\\\"Authorization: Bearer {optional_huggingface_token}\\\"\"\n",
351
  "\n",
352
  "def handle_manual(url):\n",
353
  " original_url = url\n",
 
368
  "\n",
369
  "def manual_download(url, dst_dir, file_name):\n",
370
  " basename = url.split(\"/\")[-1] if file_name is None else file_name\n",
371
+ " header_option = f\"--header={user_header}\" # if optional_huggingface_token else \"\"\n",
372
  "\n",
373
  " # I do it at my own risk..... Fucking CivitAi >:(\n",
374
  " civitai_token = \"62c0c5956b2f9defbd844d754000180b\"\n",
 
388
  " if '/blob/' in url:\n",
389
  " url = url.replace('/blob/', '/resolve/')\n",
390
  " if file_name:\n",
391
+ " !aria2c {header_option} --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -c -j5 -x16 -s16 -k1M -d {dst_dir} -o {basename} {url}\n",
392
  " else:\n",
393
+ " parsed_link = f'\\n{url}\\n\\tout={unquote(url.split(\"/\")[-1])}'\n",
394
+ " !echo -e \"{parsed_link}\" | aria2c {header_option} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d \"{dst_dir}\" -o {basename}\n",
395
  " # -- Other --\n",
396
  " elif 'http' in url or 'magnet' in url:\n",
397
  " if file_name:\n",
files_cells/python/en/downloading_en.py CHANGED
@@ -70,9 +70,10 @@ if not os.path.exists(flag_file):
70
  get_ipython().system('wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb')
71
 
72
  if env == "Google Colab":
73
- get_ipython().system('pip install -q {torch} -U')
74
  else:
75
- get_ipython().system('pip install -q {torch} -U')
 
76
  get_ipython().system('pip install -q {xformers} -U')
77
 
78
  with open(flag_file, "w") as f:
@@ -327,6 +328,7 @@ get_ipython().system('mkdir -p {models_dir} {vaes_dir} {embeddings_dir} {loras_d
327
  url = ""
328
  hf_token = optional_huggingface_token if optional_huggingface_token else "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"
329
  user_header = f"\"Authorization: Bearer {hf_token}\""
 
330
 
331
  def handle_manual(url):
332
  original_url = url
@@ -347,6 +349,7 @@ def handle_manual(url):
347
 
348
  def manual_download(url, dst_dir, file_name):
349
  basename = url.split("/")[-1] if file_name is None else file_name
 
350
 
351
  # I do it at my own risk..... Fucking CivitAi >:(
352
  civitai_token = "62c0c5956b2f9defbd844d754000180b"
@@ -366,10 +369,10 @@ def manual_download(url, dst_dir, file_name):
366
  if '/blob/' in url:
367
  url = url.replace('/blob/', '/resolve/')
368
  if file_name:
369
- get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --header={user_header} -c -j5 -x16 -s16 -k1M -d {dst_dir} -o {basename} {url}')
370
  else:
371
- parsed_link = '\n{}\n\tout={}'.format(url, unquote(url.split('/')[-1]))
372
- get_ipython().system('echo -e "{parsed_link}" | aria2c --header={user_header} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d "{dst_dir}" -o {basename}')
373
  # -- Other --
374
  elif 'http' in url or 'magnet' in url:
375
  if file_name:
 
70
  get_ipython().system('wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb')
71
 
72
  if env == "Google Colab":
73
+ get_ipython().system('pip install -q pip install xformers==0.0.26.dev769 -U')
74
  else:
75
+ if env != "Kaggle":
76
+ get_ipython().system('pip install -q {torch} -U')
77
  get_ipython().system('pip install -q {xformers} -U')
78
 
79
  with open(flag_file, "w") as f:
 
328
  url = ""
329
  hf_token = optional_huggingface_token if optional_huggingface_token else "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"
330
  user_header = f"\"Authorization: Bearer {hf_token}\""
331
+ # user_header = f"\"Authorization: Bearer {optional_huggingface_token}\""
332
 
333
  def handle_manual(url):
334
  original_url = url
 
349
 
350
  def manual_download(url, dst_dir, file_name):
351
  basename = url.split("/")[-1] if file_name is None else file_name
352
+ header_option = f"--header={user_header}" # if optional_huggingface_token else ""
353
 
354
  # I do it at my own risk..... Fucking CivitAi >:(
355
  civitai_token = "62c0c5956b2f9defbd844d754000180b"
 
369
  if '/blob/' in url:
370
  url = url.replace('/blob/', '/resolve/')
371
  if file_name:
372
+ get_ipython().system('aria2c {header_option} --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -c -j5 -x16 -s16 -k1M -d {dst_dir} -o {basename} {url}')
373
  else:
374
+ parsed_link = f'\n{url}\n\tout={unquote(url.split("/")[-1])}'
375
+ get_ipython().system('echo -e "{parsed_link}" | aria2c {header_option} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d "{dst_dir}" -o {basename}')
376
  # -- Other --
377
  elif 'http' in url or 'magnet' in url:
378
  if file_name:
files_cells/python/ru/downloading_ru.py CHANGED
@@ -70,9 +70,10 @@ if not os.path.exists(flag_file):
70
  get_ipython().system('wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb')
71
 
72
  if env == "Google Colab":
73
- get_ipython().system('pip install -q {torch} -U')
74
  else:
75
- get_ipython().system('pip install -q {torch} -U')
 
76
  get_ipython().system('pip install -q {xformers} -U')
77
 
78
  with open(flag_file, "w") as f:
@@ -327,6 +328,7 @@ get_ipython().system('mkdir -p {models_dir} {vaes_dir} {embeddings_dir} {loras_d
327
  url = ""
328
  hf_token = optional_huggingface_token if optional_huggingface_token else "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"
329
  user_header = f"\"Authorization: Bearer {hf_token}\""
 
330
 
331
  def handle_manual(url):
332
  original_url = url
@@ -347,6 +349,7 @@ def handle_manual(url):
347
 
348
  def manual_download(url, dst_dir, file_name):
349
  basename = url.split("/")[-1] if file_name is None else file_name
 
350
 
351
  # I do it at my own risk..... Fucking CivitAi >:(
352
  civitai_token = "62c0c5956b2f9defbd844d754000180b"
@@ -366,10 +369,10 @@ def manual_download(url, dst_dir, file_name):
366
  if '/blob/' in url:
367
  url = url.replace('/blob/', '/resolve/')
368
  if file_name:
369
- get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 --header={user_header} -c -j5 -x16 -s16 -k1M -d {dst_dir} -o {basename} {url}')
370
  else:
371
- parsed_link = '\n{}\n\tout={}'.format(url, unquote(url.split('/')[-1]))
372
- get_ipython().system('echo -e "{parsed_link}" | aria2c --header={user_header} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d "{dst_dir}" -o {basename}')
373
  # -- Other --
374
  elif 'http' in url or 'magnet' in url:
375
  if file_name:
 
70
  get_ipython().system('wget -P /home/studio-lab-user https://huggingface.co/NagisaNao/fast_repo/resolve/main/sagemaker/FULL_DELETED_NOTEBOOK.ipynb')
71
 
72
  if env == "Google Colab":
73
+ get_ipython().system('pip install -q pip install xformers==0.0.26.dev769 -U')
74
  else:
75
+ if env != "Kaggle":
76
+ get_ipython().system('pip install -q {torch} -U')
77
  get_ipython().system('pip install -q {xformers} -U')
78
 
79
  with open(flag_file, "w") as f:
 
328
  url = ""
329
  hf_token = optional_huggingface_token if optional_huggingface_token else "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"
330
  user_header = f"\"Authorization: Bearer {hf_token}\""
331
+ # user_header = f"\"Authorization: Bearer {optional_huggingface_token}\""
332
 
333
  def handle_manual(url):
334
  original_url = url
 
349
 
350
  def manual_download(url, dst_dir, file_name):
351
  basename = url.split("/")[-1] if file_name is None else file_name
352
+ header_option = f"--header={user_header}" # if optional_huggingface_token else ""
353
 
354
  # I do it at my own risk..... Fucking CivitAi >:(
355
  civitai_token = "62c0c5956b2f9defbd844d754000180b"
 
369
  if '/blob/' in url:
370
  url = url.replace('/blob/', '/resolve/')
371
  if file_name:
372
+ get_ipython().system('aria2c {header_option} --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -c -j5 -x16 -s16 -k1M -d {dst_dir} -o {basename} {url}')
373
  else:
374
+ parsed_link = f'\n{url}\n\tout={unquote(url.split("/")[-1])}'
375
+ get_ipython().system('echo -e "{parsed_link}" | aria2c {header_option} --console-log-level=error --summary-interval=10 -i- -j5 -x16 -s16 -k1M -c -d "{dst_dir}" -o {basename}')
376
  # -- Other --
377
  elif 'http' in url or 'magnet' in url:
378
  if file_name: