-
Notifications
You must be signed in to change notification settings - Fork 1
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
Stable Diffusion 1.4 #70
base: main
Are you sure you want to change the base?
Conversation
I'm going to ask you to rebase this to |
@@ -0,0 +1,6 @@ | |||
TT_METAL_DOCKERFILE_VERSION=v0.53.0-rc34 | |||
TT_METAL_COMMIT_SHA_OR_TAG=4da4a5e79a13ece7ff5096c30cef79cb0c504f0e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reference to this commit in tt-metal
anywhere? Curious how you selected this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copy+pasted this from the YOLOv4 server because that required a specific commit as the metal YOLOv4 improvements got reverted as couldn't pass CI.
Should I just use the latest release? That would be release v0.55.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use release v0.55.0 in 4582863
# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC | ||
|
||
from locust import HttpUser, task | ||
from utils import sample_file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be get_sample_prompt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed locust tests in 016af35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a locustfile
needed for this demo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No this isn't needed. The locust test here won't really measure performance, I want it to enqueue 5 prompts into the input queue and process them. I will add this to test_inference_api.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed locust tests in 016af35
app = Flask(__name__) | ||
|
||
# var to indicate ready state | ||
ready = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global variable ready
: this flag is accessed and modified by multiple threads (warmup and request handlers). This may lead to race conditions. Consider using thread-safe mechanisms like threading.Lock
or Event
to manage state changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
@app.route("/clean_up", methods=["POST"]) | ||
def clean_up(): | ||
with open(json_file_path, "r") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated code blocks : the code repeatedly reads and writes json_file_path
. This can be refactored into utility functions for cleaner logic:
def read_json_file(file_path):
if not os.path.isfile(file_path):
return {"prompts": []}
with open(file_path, "r") as f:
return json.load(f)
def write_json_file(file_path, data):
with open(file_path, "w") as f:
json.dump(data, f, indent=4)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored in a75d0e6
os.remove( | ||
"models/demos/wormhole/stable_diffusion/demo/web_demo/input_prompts.json" | ||
) | ||
print("Deleted json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use logging
instead of print statements for better production diagnostics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used logging
instead of print in f5650c5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some feedback added.
For the license headers, the year should be set to 2025.
This PR adds a flask server implementation of stable diffusion 1.4 and dockerizes it
It creates a new flask server that: