-
-
Notifications
You must be signed in to change notification settings - Fork 787
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 #2021 from FedML-AI/alexleung/dev_branch_online
Alexleung/dev branch online
- Loading branch information
Showing
128 changed files
with
13,024 additions
and
1,317 deletions.
There are no files selected for viewing
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,26 @@ | ||
workspace: "./src" | ||
|
||
inference_image_name: "raphaeljin/fedml" | ||
enable_custom_image: true | ||
|
||
bootstrap: | | ||
echo "Bootstrap start..." | ||
pwd | ||
ls -l | ||
echo "Check shell script" | ||
cat fedml-deploy-bootstrap-entry-auto-gen.sh | ||
echo "Check main script" | ||
cat serve_main.py | ||
echo "Bootstrap finished" | ||
## Simulate a successful deployment | ||
#job: | | ||
# python3 serve_main.py | ||
|
||
# Then during update, simulate a failed deployment | ||
job: | | ||
echo "Simulate a failed deployment" | ||
exit 1 | ||
auto_detect_public_ip: true | ||
use_gpu: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
workspace: "./src" | ||
entry_point: "serve_main.py" | ||
bootstrap: | | ||
echo "Bootstrap start..." | ||
sleep 5 | ||
echo "Bootstrap finished" | ||
auto_detect_public_ip: true | ||
use_gpu: true |
32 changes: 32 additions & 0 deletions
32
python/examples/deploy/dummy_gpu_occupier/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 was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
python/examples/launch/train_build_package/src/bootstrap.sh
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 @@ | ||
### don't modify this part ### | ||
set -x | ||
############################## | ||
|
||
pip install -r requirements.txt | ||
echo "Bootstrap finished." | ||
|
||
### don't modify this part ### | ||
exit 0 | ||
############################## |
File renamed without changes.
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
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
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.