read cdn yaml config from api

automate tensorrt model conversion in case of no existing one for user's gpu
This commit is contained in:
Alex Bezdieniezhnykh
2025-04-23 23:20:08 +03:00
parent c68c293448
commit e798af470b
23 changed files with 265 additions and 93 deletions
-7
View File
@@ -1,7 +0,0 @@
python -m venv venv
venv\Scripts\pip install -r requirements.txt
venv\Scripts\pyinstaller --onefile --collect-all boto3 cdn_manager.py
move dist\cdn_manager.exe .\cdn_manager.exe
rmdir /s /q dist
rmdir /s /q build
+19 -3
View File
@@ -36,8 +36,24 @@ class CDNManager:
def download(self, bucket: str, filename: str):
try:
self.download_client.download_file(bucket, filename, filename)
print(f'downloaded {filename} from the {bucket} to current folder')
if filename is not None:
self.download_client.download_file(bucket, filename, os.path.join(bucket, filename))
print(f'downloaded {filename} from the {bucket} to current folder')
else:
response = self.download_client.list_objects_v2(Bucket=bucket)
if 'Contents' in response:
for obj in response['Contents']:
object_key = obj['Key']
local_filepath = os.path.join(bucket, object_key)
local_dir = os.path.dirname(local_filepath)
if local_dir:
os.makedirs(local_dir, exist_ok=True)
if not object_key.endswith('/'):
try:
self.download_client.download_file(bucket, object_key, local_filepath)
except Exception as e_file:
all_successful = False # Mark as failed if any file fails
return True
except Exception as e:
print(e)
@@ -58,7 +74,7 @@ cdn_manager = CDNManager(CDNCredentials(
input_action = sys.argv[1]
input_bucket = sys.argv[2]
input_filename = sys.argv[3]
input_filename = sys.argv[3] if len(sys.argv) > 3 else None
if len(sys.argv) > 4: # 0 is this script's path, hence 5 args is max
input_path = sys.argv[4]
+2 -2
View File
@@ -43,6 +43,7 @@ venv\Scripts\pyinstaller --name=azaion-inference ^
--collect-all onnxruntime ^
--collect-all tensorrt ^
--collect-all pycuda ^
--collect-all pynvml ^
--collect-all re ^
--hidden-import constants ^
--hidden-import annotation ^
@@ -71,8 +72,7 @@ cd..
echo Download onnx model
cd build
call cdn_manager.exe download models azaion.onnx.big
call cdn_manager.exe download models azaion.engine.big
call cdn_manager.exe download models
move azaion.* ..\dist\
cd..