Skip to content

Commit

Permalink
changes to scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
argenspin committed Aug 21, 2024
1 parent 66bd181 commit 7e24f3f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Update_Rope.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
call setenv.bat
"%GIT_EXECUTABLE%" pull origin main
"%PYTHON_EXECUTABLE%" .\scripts\download_models.py
"%PYTHON_EXECUTABLE%" .\scripts\update_rope.py

echo.
echo --------Update completed--------
Expand Down
33 changes: 0 additions & 33 deletions scripts/download_models.py

This file was deleted.

37 changes: 35 additions & 2 deletions scripts/update_rope.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
from . import download_models

import requests
from tqdm import tqdm
from pathlib import Path

def get_filename_from_link(file_link):
return f"models\{file_link.split(r'/')[-1]}"

def download_file(url):
filename = get_filename_from_link(url)

if Path(filename).is_file():
print(f"Skipping {filename} as it is already downloaded ")
else:
print(f"{filename}")
response = requests.get(url, stream=True)

# Sizes in bytes.
total_size = int(response.headers.get("content-length", 0))
block_size = 1024

with tqdm(total=total_size, unit="B", unit_scale=True) as progress_bar:
with open(filename, "wb") as file:
for data in response.iter_content(block_size):
progress_bar.update(len(data))
file.write(data)

if total_size != 0 and progress_bar.n != total_size:
raise RuntimeError("Could not download file")

#Download required Models
model_links = open("scripts\model_links.txt").read().splitlines()
for link in model_links:
download_file(link)

''' Additional Functions to execute when updating'''
pass
pass

0 comments on commit 7e24f3f

Please sign in to comment.