Skip to content

Commit 5f0210c

Browse files
committed
format
1 parent 952b261 commit 5f0210c

File tree

6 files changed

+19
-35
lines changed

6 files changed

+19
-35
lines changed

examples/sdk/create_cserve.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ def get_default_cserve_config(cclient, name, model):
3636
def main():
3737
with get_centml_client() as cclient:
3838
### Get the configurations for the Qwen model
39-
qwen_config = get_fastest_cserve_config(
40-
cclient, name="qwen-fastest", model="Qwen/Qwen2-VL-7B-Instruct"
41-
)
39+
qwen_config = get_fastest_cserve_config(cclient, name="qwen-fastest", model="Qwen/Qwen2-VL-7B-Instruct")
4240
# qwen_config = get_default_cserve_config(cclient, name="qwen-default", model="Qwen/Qwen2-VL-7B-Instruct")
4341

4442
### Modify the recipe if necessary

examples/sdk/create_inference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ def main():
3838
cclient.delete(deployment.id)
3939
'''
4040

41+
4142
if __name__ == "__main__":
4243
main()

examples/sdk/get_deployment_usage.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from centml.sdk.api import get_centml_client
44
from centml.sdk import Metric
55

6-
76
HOUR_IN_SECONDS = 60 * 60
87
DAY_IN_SECONDS = 24 * HOUR_IN_SECONDS
98
MAX_DATA_POINTS = 10_000
@@ -17,22 +16,23 @@ def get_step_size(start_time_in_seconds: int, end_time_in_seconds: int) -> int:
1716
# 2 days to 7 days: 5m
1817
elif time_delta_in_seconds <= 7 * DAY_IN_SECONDS:
1918
return 5 * 60
20-
# 7 days to 14 days: 10m
19+
# 7 days to 14 days: 10m
2120
elif time_delta_in_seconds <= 14 * DAY_IN_SECONDS:
2221
return 10 * 60
23-
# 14 days to 30 days: 30m
22+
# 14 days to 30 days: 30m
2423
elif time_delta_in_seconds <= 30 * DAY_IN_SECONDS:
2524
return 30 * 60
26-
# 30 days to 60 days: 1 hour
25+
# 30 days to 60 days: 1 hour
2726
elif time_delta_in_seconds <= 60 * DAY_IN_SECONDS:
2827
return HOUR_IN_SECONDS
29-
# 60 days to 90 days: 2 hours
28+
# 60 days to 90 days: 2 hours
3029
elif time_delta_in_seconds <= 90 * DAY_IN_SECONDS:
3130
return 2 * HOUR_IN_SECONDS
32-
# 90+ days: 3 hours (This catches all ranges greater than 90 days)
31+
# 90+ days: 3 hours (This catches all ranges greater than 90 days)
3332
else:
3433
return 3 * HOUR_IN_SECONDS
3534

35+
3636
def main():
3737
with get_centml_client() as cclient:
3838
start_time = 1752084581

scripts/data_collection.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
AutoModelForCausalLM,
88
AutoTokenizer,
99
AutoModelForImageClassification,
10-
AutoModelForObjectDetection
10+
AutoModelForObjectDetection,
1111
)
1212

1313

14-
1514
from centml.compiler.prediction.kdtree import KDTreeWithValues
1615
from centml.compiler.prediction.profiler import Profiler
1716
from scripts.timer import timed
@@ -26,8 +25,8 @@
2625
# Different HuggingFace Models + Different Input Sizes
2726
llm_tests = [
2827
("google/gemma-7b", (1, 128)),
29-
("microsoft/phi-2", (1,512)),
30-
("microsoft/phi-2", (2,512)),
28+
("microsoft/phi-2", (1, 512)),
29+
("microsoft/phi-2", (2, 512)),
3130
("facebook/bart-large", (1, 1024)),
3231
("facebook/bart-large", (2, 512)),
3332
("gpt2-xl", (1, 1024)),
@@ -212,6 +211,7 @@ def image_classification_test(model_name, batch_size, custom_backend):
212211
gc.collect()
213212
torch.cuda.empty_cache()
214213

214+
215215
def object_detection_test(model_name, batch_size, custom_backend):
216216
global cuda_kernel_time
217217
global actual_time
@@ -240,6 +240,7 @@ def object_detection_test(model_name, batch_size, custom_backend):
240240
gc.collect()
241241
torch.cuda.empty_cache()
242242

243+
243244
# for model_name, input_size in large_llm_tests:
244245
# llm_test(model_name, input_size, custom_backend)
245246

scripts/timer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import torch
22

3+
34
def timed(fn):
45
start = torch.cuda.Event(enable_timing=True)
56
end = torch.cuda.Event(enable_timing=True)

scripts/user_vault/get_vault_items.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@
1515
from platform_api_python_client import UserVaultType
1616

1717

18-
def get_vault_items(
19-
vault_type: Optional[UserVaultType] = None,
20-
search_query: Optional[str] = None,
21-
):
18+
def get_vault_items(vault_type: Optional[UserVaultType] = None, search_query: Optional[str] = None):
2219
"""Retrieve items from user's vault."""
2320
with get_centml_client() as client:
2421
response = client._api.get_all_user_vault_items_endpoint_user_vault_get(
25-
type=vault_type,
26-
search_query=search_query,
22+
type=vault_type, search_query=search_query
2723
)
2824
return response.results
2925

@@ -65,18 +61,8 @@ def display_vault_items(items, show_values: bool = False):
6561
type=click.Choice([t.value for t in UserVaultType], case_sensitive=False),
6662
help="Filter by vault type (env_vars, ssh_keys, bearer_tokens, access_tokens, certificates)",
6763
)
68-
@click.option(
69-
"--search",
70-
"search_query",
71-
type=str,
72-
help="Search query to filter items by key",
73-
)
74-
@click.option(
75-
"--show-values",
76-
is_flag=True,
77-
default=False,
78-
help="Show vault item values",
79-
)
64+
@click.option("--search", "search_query", type=str, help="Search query to filter items by key")
65+
@click.option("--show-values", is_flag=True, default=False, help="Show vault item values")
8066
def main(vault_type: Optional[str], search_query: Optional[str], show_values: bool):
8167
"""Retrieve all items from user's vault (secrets).
8268
@@ -99,10 +85,7 @@ def main(vault_type: Optional[str], search_query: Optional[str], show_values: bo
9985
"""
10086
type_enum = UserVaultType(vault_type) if vault_type else None
10187

102-
items = get_vault_items(
103-
vault_type=type_enum,
104-
search_query=search_query,
105-
)
88+
items = get_vault_items(vault_type=type_enum, search_query=search_query)
10689

10790
display_vault_items(items, show_values=show_values)
10891

0 commit comments

Comments
 (0)