-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: pass task-specific config to backend #922
Changes from 4 commits
33670c6
e52d589
d84ec7a
685cf75
4482186
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,8 +131,9 @@ tflite-run-sd: | |
bazel-bin/flutter/cpp/binary/main EXTERNAL stable_diffusion \ | ||
--mode=PerformanceOnly \ | ||
--output_dir="${REPO_ROOT_DIR}/output" \ | ||
--model_file="${REPO_ROOT_DIR}/mobile_back_apple/dev-resources/stable_diffusion/sd-models" \ | ||
--model_file="${REPO_ROOT_DIR}/mobile_back_apple/dev-resources/stable_diffusion/dynamic-sd-models" \ | ||
--lib_path="bazel-bin/mobile_back_tflite/cpp/backend_tflite/libtflitebackend.so" \ | ||
--custom_config="stable_diffusion_num_steps:20,stable_diffusion_seed:633994880" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the |
||
--input_tfrecord="${REPO_ROOT_DIR}/mobile_back_apple/dev-resources/stable_diffusion/coco_gen_full.tfrecord" \ | ||
--input_clip_model="${REPO_ROOT_DIR}/mobile_back_apple/dev-resources/stable_diffusion/clip_model_512x512.tflite" \ | ||
--min_query_count=5 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,15 @@ mlperf_backend_ptr_t StableDiffusionPipeline::backend_create( | |
SDBackendData* backend_data = new SDBackendData(); | ||
backendExists = true; | ||
|
||
for (int i = 0; i < configs->count; ++i) { | ||
if (strcmp(configs->keys[i], "stable_diffusion_seed") == 0) { | ||
backend_data->seed = atoi(configs->values[i]); | ||
} | ||
if (strcmp(configs->keys[i], "stable_diffusion_num_steps") == 0) { | ||
backend_data->num_steps = atoi(configs->values[i]); | ||
} | ||
} | ||
|
||
Comment on lines
+67
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The backend can read them from |
||
// Load models from the provided directory path | ||
std::string text_encoder_path = | ||
std::string(model_path) + "/sd_text_encoder_dynamic.tflite"; | ||
|
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.
This how a custom setting for all backends can be defined in
tasks.pbtxt