Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deploy] Refactor the quick start example, use public ip as default. #2158

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions python/examples/deploy/quick_start/config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
workspace: "./src"
workspace: "."
entry_point: "main_entry.py"

# If you want to install some packages
# Please write the command in the bootstrap.sh
bootstrap: |
echo "Bootstrap start..."
sh ./config/bootstrap.sh
echo "Bootstrap finished"

# If you do not have any GPU resource but want to serve the model
# Try FedML® Nexus AI Platform, and Uncomment the following lines.
# ------------------------------------------------------------
computing:
minimum_num_gpus: 1 # minimum # of GPUs to provision
maximum_cost_per_hour: $3000 # max cost per hour for your job per gpu card
#allow_cross_cloud_resources: true # true, false
#device_type: CPU # options: GPU, CPU, hybrid
resource_type: A100-80G # e.g., A100-80G,
# please check the resource type list by "fedml show-resource-type"
# or visiting URL: https://open.fedml.ai/accelerator_resource_type
# ------------------------------------------------------------
echo "Install some packages..."
echo "Install finished!"
27 changes: 27 additions & 0 deletions python/examples/deploy/quick_start/main_entry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from fedml.serving import FedMLPredictor
from fedml.serving import FedMLInferenceRunner


class Bot(FedMLPredictor): # Inherit FedMLClientPredictor
def __init__(self):
super().__init__()

# --- Your model initialization code here ---

# -------------------------------------------

def predict(self, request: dict):
input_dict = request
question: str = input_dict.get("text", "").strip()

# --- Your model inference code here ---
response = "I do not know the answer to your question."
# ---------------------------------------

return {"generated_text": f"The answer to your question {question} is: {response}"}


if __name__ == "__main__":
chatbot = Bot()
fedml_inference_runner = FedMLInferenceRunner(chatbot)
fedml_inference_runner.run()
Empty file.
Empty file.
Empty file.
68 changes: 0 additions & 68 deletions python/examples/deploy/quick_start/src/app/pipe/constants.py

This file was deleted.

261 changes: 0 additions & 261 deletions python/examples/deploy/quick_start/src/app/pipe/instruct_pipeline.py

This file was deleted.

Loading
Loading