fix: add models for infra

pull/3/head
AoyuQC 2023-05-15 06:28:13 +00:00
parent 2bf7fb5cdd
commit 08177d5fa4
3 changed files with 34 additions and 2 deletions

Binary file not shown.

View File

@ -42,6 +42,9 @@ sagemaker = boto3.client('sagemaker')
inference_table = ddb_client.Table(DDB_INFERENCE_TABLE_NAME)
endpoint_deployment_table = ddb_client.Table(DDB_ENDPOINT_DEPLOYMENT_TABLE_NAME)
# name for utils sagemaker endpoint name
utils_endpoint_name = os.environ.get("SAGEMAKER_ENDPOINT_NAME")
async def custom_exception_handler(request: Request, exc: HTTPException):
headers = {
"Access-Control-Allow-Headers": "Content-Type",

View File

@ -446,8 +446,37 @@ def sagemaker_deploy(instance_type, initial_instance_count=1):
r = response.json()
print(f"response for rest api {r}")
def modelmerger_on_cloud_func(primary_model_name, secondary_model_name, tertiary_model_name):
print(f"function not implemented, current checkpoint_info is {checkpoint_info}")
try:
r = response.json()
except JSONDecodeError as e:
print(f"Failed to decode JSON response: {e}")
print(f"Raw server response: {response.text}")
else:
print(f"response for rest api {r}")
model_merge_id = r.get('model_merge_id') # Assuming the response contains 'inference_id' field
job_status = get_inference_job(model_merge_id)
status = job_status['status']
print(f"status is {status}")
def modelmerger_on_cloud_func(primary_model_name, secondary_model_name, teritary_model_name):
print(f"function under development, current checkpoint_info is {checkpoint_info}")
if api_gateway_url is None:
print(f"failed to get the api-gateway url, can not fetch remote data")
return []
modelmerge_url = f"{api_gateway_url}inference/run-model-merge"
payload = {
"primary_model_name" : primary_model_name,
"secondary_model_name" : secondary_model_name,
"tertiary_model_name" : teritary_model_name
}
headers = {
"x-api-key": api_key,
"Content-Type": "application/json"
}
response = requests.post(modelmerge_url, json=payload, headers=headers)
def txt2img_config_save():
# placeholder for saving txt2img config