chassis-cloud 0.1.2__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chassis-cloud
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Official Python SDK for the Chassis GPU cloud API by OkeyMeta Ltd
5
5
  Project-URL: Homepage, https://chassis.okeymeta.com.ng/docs
6
6
  Project-URL: Documentation, https://chassis.okeymeta.com.ng/docs
@@ -53,20 +53,75 @@ from chassis import Chassis
53
53
 
54
54
  with Chassis(api_key="chs_...") as client:
55
55
  gpus = client.list_gpus()
56
-
57
56
  instance = client.spin_up(
58
57
  gpuSkuId=gpus[0]["id"],
59
58
  name="train-01",
60
- gpuCount=2, # multi-GPU (1–8, SKU-capped)
61
59
  imageName="pytorch/pytorch:2.1.0-cuda11.8-cudnn8-devel",
62
- containerDiskGb=50,
63
- cloudType="SECURE",
60
+ )
61
+ ```
62
+
63
+ ## Example: training job
64
+
65
+ Spin up a dedicated GPU, run your trainer on the instance, then stop billing.
66
+
67
+ ```python
68
+ from chassis import Chassis
69
+
70
+ with Chassis(api_key="chs_...") as client:
71
+ gpus = client.list_gpus()
72
+ gpu = next(
73
+ (g for g in gpus if "A100" in str(g.get("displayName", ""))),
74
+ gpus[0],
75
+ )
76
+
77
+ instance = client.spin_up(
78
+ gpuSkuId=gpu["id"],
79
+ name="finetune-bert",
80
+ gpuCount=1,
81
+ imageName="pytorch/pytorch:2.1.0-cuda11.8-cudnn8-devel",
82
+ containerDiskGb=80,
64
83
  ports="8888/http,22/tcp",
65
84
  )
85
+ print("running", instance["id"], instance["status"])
86
+
87
+ # On the instance (SSH / Jupyter), run train.py:
88
+ #
89
+ # import torch, torch.nn as nn
90
+ # from torch.utils.data import DataLoader, TensorDataset
91
+ # device = torch.device("cuda")
92
+ # ... train loop ...
93
+ # torch.save(model.state_dict(), "checkpoint.pt")
66
94
 
67
- client.restart(instance["id"])
68
95
  client.stop(instance["id"])
69
- client.terminate(instance["id"])
96
+ # client.terminate(instance["id"])
97
+ ```
98
+
99
+ ## Example: inference (serverless)
100
+
101
+ ```python
102
+ with Chassis(api_key="chs_...") as client:
103
+ gpus = client.list_gpus()
104
+ endpoint = client.create_endpoint(
105
+ name="text-infer",
106
+ gpuSkuId=gpus[0]["id"],
107
+ workersMin=0,
108
+ workersMax=3,
109
+ )
110
+
111
+ result = client.run_sync(
112
+ endpoint["id"],
113
+ body={
114
+ "input": {
115
+ "prompt": "Summarize Chassis in one sentence.",
116
+ "max_tokens": 128,
117
+ }
118
+ },
119
+ )
120
+ print(result)
121
+
122
+ job = client.run(endpoint["id"], body={"input": {"prompt": "hello"}})
123
+ status = client.get_job(endpoint["id"], job["id"])
124
+ print(status)
70
125
  ```
71
126
 
72
127
  ## Instance options (`create_instance` / `spin_up`)
@@ -133,17 +188,6 @@ Create with `name`, `gpuSkuId`, `nodeCount` (2–8), and optional `gpusPerNode`,
133
188
  | `run(endpoint_id, body=None)` | `POST /endpoints/:id/run` |
134
189
  | `run_sync(endpoint_id, body=None, wait_ms=None)` | `POST /endpoints/:id/runsync` |
135
190
 
136
- Serverless example:
137
-
138
- ```python
139
- endpoints = client.list_endpoints()
140
- result = client.run_sync(
141
- endpoints[0]["id"],
142
- body={"input": {"prompt": "hello"}},
143
- )
144
- health = client.get_endpoint_health(endpoints[0]["id"])
145
- ```
146
-
147
191
  Create options also accept `env`, `interruptible`, and `publicIp`.
148
192
 
149
193
  Responses use `data` / `error`. Failures raise `ChassisError` with `.status`, `.body`, and a clear message.
@@ -36,20 +36,75 @@ from chassis import Chassis
36
36
 
37
37
  with Chassis(api_key="chs_...") as client:
38
38
  gpus = client.list_gpus()
39
-
40
39
  instance = client.spin_up(
41
40
  gpuSkuId=gpus[0]["id"],
42
41
  name="train-01",
43
- gpuCount=2, # multi-GPU (1–8, SKU-capped)
44
42
  imageName="pytorch/pytorch:2.1.0-cuda11.8-cudnn8-devel",
45
- containerDiskGb=50,
46
- cloudType="SECURE",
43
+ )
44
+ ```
45
+
46
+ ## Example: training job
47
+
48
+ Spin up a dedicated GPU, run your trainer on the instance, then stop billing.
49
+
50
+ ```python
51
+ from chassis import Chassis
52
+
53
+ with Chassis(api_key="chs_...") as client:
54
+ gpus = client.list_gpus()
55
+ gpu = next(
56
+ (g for g in gpus if "A100" in str(g.get("displayName", ""))),
57
+ gpus[0],
58
+ )
59
+
60
+ instance = client.spin_up(
61
+ gpuSkuId=gpu["id"],
62
+ name="finetune-bert",
63
+ gpuCount=1,
64
+ imageName="pytorch/pytorch:2.1.0-cuda11.8-cudnn8-devel",
65
+ containerDiskGb=80,
47
66
  ports="8888/http,22/tcp",
48
67
  )
68
+ print("running", instance["id"], instance["status"])
69
+
70
+ # On the instance (SSH / Jupyter), run train.py:
71
+ #
72
+ # import torch, torch.nn as nn
73
+ # from torch.utils.data import DataLoader, TensorDataset
74
+ # device = torch.device("cuda")
75
+ # ... train loop ...
76
+ # torch.save(model.state_dict(), "checkpoint.pt")
49
77
 
50
- client.restart(instance["id"])
51
78
  client.stop(instance["id"])
52
- client.terminate(instance["id"])
79
+ # client.terminate(instance["id"])
80
+ ```
81
+
82
+ ## Example: inference (serverless)
83
+
84
+ ```python
85
+ with Chassis(api_key="chs_...") as client:
86
+ gpus = client.list_gpus()
87
+ endpoint = client.create_endpoint(
88
+ name="text-infer",
89
+ gpuSkuId=gpus[0]["id"],
90
+ workersMin=0,
91
+ workersMax=3,
92
+ )
93
+
94
+ result = client.run_sync(
95
+ endpoint["id"],
96
+ body={
97
+ "input": {
98
+ "prompt": "Summarize Chassis in one sentence.",
99
+ "max_tokens": 128,
100
+ }
101
+ },
102
+ )
103
+ print(result)
104
+
105
+ job = client.run(endpoint["id"], body={"input": {"prompt": "hello"}})
106
+ status = client.get_job(endpoint["id"], job["id"])
107
+ print(status)
53
108
  ```
54
109
 
55
110
  ## Instance options (`create_instance` / `spin_up`)
@@ -116,17 +171,6 @@ Create with `name`, `gpuSkuId`, `nodeCount` (2–8), and optional `gpusPerNode`,
116
171
  | `run(endpoint_id, body=None)` | `POST /endpoints/:id/run` |
117
172
  | `run_sync(endpoint_id, body=None, wait_ms=None)` | `POST /endpoints/:id/runsync` |
118
173
 
119
- Serverless example:
120
-
121
- ```python
122
- endpoints = client.list_endpoints()
123
- result = client.run_sync(
124
- endpoints[0]["id"],
125
- body={"input": {"prompt": "hello"}},
126
- )
127
- health = client.get_endpoint_health(endpoints[0]["id"])
128
- ```
129
-
130
174
  Create options also accept `env`, `interruptible`, and `publicIp`.
131
175
 
132
176
  Responses use `data` / `error`. Failures raise `ChassisError` with `.status`, `.body`, and a clear message.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "chassis-cloud"
3
- version = "0.1.2"
3
+ version = "0.1.3"
4
4
  description = "Official Python SDK for the Chassis GPU cloud API by OkeyMeta Ltd"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
File without changes