diff --git a/centml/sdk/api.py b/centml/sdk/api.py index 3419652..d7c4457 100644 --- a/centml/sdk/api.py +++ b/centml/sdk/api.py @@ -12,7 +12,6 @@ DeploymentStatus, CreateInferenceV3DeploymentRequest, CreateComputeDeploymentRequest, - CreateCServeV3DeploymentRequest, CreateDynamoDeploymentRequest, CreateJobDeploymentRequest, CreateHardwareInstanceRequest, @@ -169,9 +168,6 @@ def create_compute(self, request: CreateComputeDeploymentRequest): def create_job(self, request: CreateJobDeploymentRequest): return self._api.create_job_deployment_deployments_job_post(request) - def create_cserve(self, request: CreateCServeV3DeploymentRequest): - return self._api.create_cserve_v3_deployment_deployments_cserve_v3_post(request) - def create_dynamo(self, request: CreateDynamoDeploymentRequest): return self._api.create_dynamo_deployment_deployments_dynamo_post(request) @@ -181,9 +177,6 @@ def update_inference(self, deployment_id: int, request: CreateInferenceV3Deploym def update_compute(self, deployment_id: int, request: CreateComputeDeploymentRequest): return self._api.update_compute_deployment_deployments_compute_put(deployment_id, request) - def update_cserve(self, deployment_id: int, request: CreateCServeV3DeploymentRequest): - return self._api.update_cserve_v3_deployment_deployments_cserve_v3_put(deployment_id, request) - def update_dynamo(self, deployment_id: int, request: CreateDynamoDeploymentRequest): return self._api.update_dynamo_deployment_deployments_dynamo_put(deployment_id, request) @@ -220,9 +213,6 @@ def delete_hardware_instance(self, hardware_instance_id: int): def get_prebuilt_images(self, depl_type: DeploymentType): return self._api.get_prebuilt_images_prebuilt_images_get(type=depl_type) - def get_cserve_recipe(self, model=None, hf_token=None): - return self._api.get_cserve_recipe_deployments_cserve_recipes_get(model=model, hf_token=hf_token).results - def get_cluster_id(self, hardware_instance_id): filtered_hw = list(filter(lambda h: h.id == hardware_instance_id, self.get_hardware_instances())) diff --git a/examples/sdk/create_cserve.py b/examples/sdk/create_cserve.py deleted file mode 100644 index d355019..0000000 --- a/examples/sdk/create_cserve.py +++ /dev/null @@ -1,73 +0,0 @@ -import centml -from centml.sdk.api import get_centml_client -from centml.sdk import DeploymentType, CreateCServeV3DeploymentRequest, CServeV2Recipe - - -def get_fastest_cserve_config(cclient, name, model): - fastest = cclient.get_cserve_recipe(model=model)[0].fastest - - return CreateCServeV3DeploymentRequest( - name=name, - cluster_id=cclient.get_cluster_id(fastest.hardware_instance_id), - hardware_instance_id=fastest.hardware_instance_id, - recipe=fastest.recipe, - min_replicas=1, - max_replicas=1, - env_vars={}, - ) - - -def get_default_cserve_config(cclient, name, model): - default_recipe = CServeV2Recipe(model=model) - - hardware_instance = cclient.get_hardware_instances(cluster_id=1001)[0] - - return CreateCServeV3DeploymentRequest( - name=name, - cluster_id=hardware_instance.cluster_id, - hardware_instance_id=hardware_instance.id, - recipe=default_recipe, - min_replicas=1, - max_replicas=1, - env_vars={}, - ) - - -def main(): - with get_centml_client() as cclient: - ### Get the configurations for the Qwen model - qwen_config = get_fastest_cserve_config(cclient, name="qwen-fastest", model="Qwen/Qwen2-VL-7B-Instruct") - # qwen_config = get_default_cserve_config(cclient, name="qwen-default", model="Qwen/Qwen2-VL-7B-Instruct") - - ### Modify the recipe if necessary - qwen_config.recipe.additional_properties["max_num_seqs"] = 512 - - # Create CServeV3 deployment - response = cclient.create_cserve(qwen_config) - print("Create deployment response: ", response) - - ### Get deployment details - deployment = cclient.get_cserve(response.id) # Automatically detects V2 - print("Deployment details: ", deployment) - - """ - ### Scale replicas in place (no new revision / no rolling update) - # Changing only min_replicas and/or max_replicas on the same Create* - # request updates the selected revision in place; revision_number stays put. - # Any other field change still creates a new revision. - qwen_config.min_replicas = 2 - qwen_config.max_replicas = 4 - cclient.update_cserve(deployment.id, qwen_config) - scaled = cclient.get_cserve(deployment.id) - print(f"Scaled to {scaled.min_replicas}-{scaled.max_replicas}; revision {scaled.revision_number}") - - ### Pause the deployment - cclient.pause(deployment.id) - - ### Delete the deployment - cclient.delete(deployment.id) - """ - - -if __name__ == "__main__": - main() diff --git a/tests/test_cli_cluster.py b/tests/test_cli_cluster.py index e4cb501..5e3b00e 100644 --- a/tests/test_cli_cluster.py +++ b/tests/test_cli_cluster.py @@ -158,7 +158,7 @@ def test_get_job_routes_to_job_api_and_displays_job_config(): deployment = _deployment(status=DeploymentStatus.ACTIVE) hardware = HardwareInstanceResponse( - id=2, name="h100", gpu_type="H100", num_gpu=8, cpu=96, memory=1024, cluster_id=1 + id=2, name="h100", gpu_type="H100", num_gpu=8, cpu=96, memory=1024, cost_per_hr=0, cluster_id=1 ) runner = CliRunner()