Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Update to DeepSpeed model #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# !pip install 'git+https://github.com/Lightning-AI/stablediffusion.git@lit'
# !pip install 'git+https://github.com/Lightning-AI/stablediffusion.git@add_deepspeed'
# !pip install 'git+https://github.com/Lightning-AI/DiffusionWithAutoscaler.git'
# !pip install 'git+https://github.com/Lightning-AI/LAI-API-Access-UI-Component.git'
# !curl https://raw.githubusercontent.com/Lightning-AI/stablediffusion/lit/configs/stable-diffusion/v1-inference.yaml -o v1-inference.yaml
Expand Down Expand Up @@ -27,7 +27,7 @@ def setup(self):
checkpoint_path="v1-5-pruned-emaonly.ckpt",
device=device,
)
self._model.steps = 30
L.seed_everything(42)

def predict(self, requests):
texts = [request.text for request in requests.inputs]
Expand Down
4 changes: 2 additions & 2 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

for i in range(100):
start = time.time()
response = requests.post('https://vsjly-01gmqtjwnyy1sd1qgkv545btyp.litng-ai-03.litng.ai/predict', json={
"text": "A portrait of a person looking away from the camera"
response = requests.post('https://buaac-01gpc0bjpwqxkk143xmr73dcs2.litng-ai-03.litng.ai/predict', json={
"text": "astronaut riding a horse, digital art, epic lighting, highly-detailed masterpiece trending HQ"
})

img = response.json()["image"]
Expand Down
10 changes: 5 additions & 5 deletions diffusion_with_autoscaler/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Text(BaseModel):

@staticmethod
def get_sample_data() -> Dict[Any, Any]:
return {"text": "A portrait of a person looking away from the camera"}
return {"text": "astronaut riding a horse, digital art, epic lighting, highly-detailed masterpiece trending HQ"}

@staticmethod
def request_code_sample(url: str) -> str:
Expand All @@ -64,13 +64,13 @@ def request_code_sample(url: str) -> str:
response = requests.post('"""
+ url
+ """', json={
"text": "A portrait of a person looking away from the camera"
"text": "astronaut riding a horse, digital art, epic lighting, highly-detailed masterpiece trending HQ"
})
# If you are using basic authentication for your app, you should add your credentials to the request:
# response = requests.post('"""
+ url
+ """', json={
# "text": "A portrait of a person looking away from the camera"
# "text": "astronaut riding a horse, digital art, epic lighting, highly-detailed masterpiece trending HQ"
# }, auth=requests.auth.HTTPBasicAuth('your_username', 'your_password'))
"""
)
Expand All @@ -89,13 +89,13 @@ def request_code_sample(url: str) -> str:
response = requests.post('"""
+ url
+ """', json={
"inputs": [{"text": "A portrait of a person looking away from the camera"}]
"inputs": [{"text": "astronaut riding a horse, digital art, epic lighting, highly-detailed masterpiece trending HQ"}]
})
# If you are using basic authentication for your app, you should add your credentials to the request:
# response = requests.post('"""
+ url
+ """', json={
# "inputs": [{"text": "A portrait of a person looking away from the camera"}],
# "inputs": [{"text": "astronaut riding a horse, digital art, epic lighting, highly-detailed masterpiece trending HQ"}],
# }, auth=requests.auth.HTTPBasicAuth('your_username', 'your_password'))
"""
)
Expand Down
4 changes: 2 additions & 2 deletions loadtest/locustfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os, time
import os

from locust import FastHttpUser, task

TEXT = "A cat running away from a mouse"
TEXT = "astronaut riding a horse, digital art, epic lighting, highly-detailed masterpiece trending HQ"
SERVER_URL = os.getenv("SERVER_URL", None)


Expand Down