-
-
Notifications
You must be signed in to change notification settings - Fork 789
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2142 from FedML-AI/dimitris/fail_fast_policy_merge
Fast Fail and Timeout Enforcement Policy for Model Deploy Endpoints
- Loading branch information
Showing
11 changed files
with
308 additions
and
162 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
python/examples/deploy/debug/inference_timeout/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
workspace: "./src" | ||
entry_point: "serve_main.py" | ||
bootstrap: | | ||
echo "Bootstrap start..." | ||
sleep 5 | ||
echo "Bootstrap finished" | ||
auto_detect_public_ip: true | ||
use_gpu: true | ||
|
||
request_timeout_sec: 10 |
32 changes: 32 additions & 0 deletions
32
python/examples/deploy/debug/inference_timeout/src/serve_main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from fedml.serving import FedMLPredictor | ||
from fedml.serving import FedMLInferenceRunner | ||
import uuid | ||
import torch | ||
|
||
# Calculate the number of elements | ||
num_elements = 1_073_741_824 // 4 # using integer division for whole elements | ||
|
||
|
||
class DummyPredictor(FedMLPredictor): | ||
def __init__(self): | ||
super().__init__() | ||
# Create a tensor with these many elements | ||
tensor = torch.empty(num_elements, dtype=torch.float32) | ||
|
||
# Move the tensor to GPU | ||
tensor_gpu = tensor.cuda() | ||
|
||
# for debug | ||
with open("/tmp/dummy_gpu_occupier.txt", "w") as f: | ||
f.write("GPU is occupied") | ||
|
||
self.worker_id = uuid.uuid4() | ||
|
||
def predict(self, request): | ||
return {f"AlohaV0From{self.worker_id}": request} | ||
|
||
|
||
if __name__ == "__main__": | ||
predictor = DummyPredictor() | ||
fedml_inference_runner = FedMLInferenceRunner(predictor) | ||
fedml_inference_runner.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
python/fedml/computing/scheduler/model_scheduler/device_http_inference_protocol.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.