-
Notifications
You must be signed in to change notification settings - Fork 24
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
Features/timestamp-embedding-parser #928
base: submission-v4.1
Are you sure you want to change the base?
Conversation
* Add TaskConfig.CustomConfig and pass them to backend * Add CustomConfig for main.cc * Use seed and num_steps from CustomConfig for TFLite backend * Replace std::cout with LOG(INFO) * Format files
* Add ConvertOutputs() API * Add ConvertOutputs() for mobile_back_tflite * Set minimum macos version * Set minimum macos version to 13.1 * Update _kIphoneOnGitHubAction
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
Quality Gate passedIssues Measures |
@mohitmundhragithub to share the code used to generate this embedding. |
@RSMNYS, The function where the time step embedding is generated is shared here: https://github.com/mlcommons/submissions_mobile_v4.1/issues/6#issuecomment-2399205941
|
@mohitmundhragithub Shown code is only for the embedding generation. And no operations from the cut part are shown. (fully connected layer, Logistic/Sigmoid activation, and mul operation. |
@anhappdev to share the QPM Stable Diffusion Jupyter notebook with @RSMNYS |
Increase minSdkVersion to 30
@AhmedTElthakeb to provide a small tflite with only 3 operations. @mohitmundhragithub will try to compare tflite and onnx files. |
|
Hi guys! So I've used the model prepared by Ahmed to generate the embedding file. Now all works good. Here the link to the colab: https://colab.research.google.com/drive/1LG_rC5dlx2CbW2ZF4EamOnCdwtwLQESv?usp=sharing to prepare the embedding file, and the link to the models and embedding file: https://drive.google.com/drive/folders/1CT6VUWwGaTw34Za6dTJE7ptms20NUKH3?usp=sharing |
* master: chore: increase Android minSdkVersion from 21 to 30 (#859) fix: resolve crash due to permission denied on Android Play Store version (#930) refactor: use custom setting in Core ML backend to detect NCHW input. (#924) # Conflicts: # mobile_back_tflite/cpp/backend_tflite/stable_diffusion_pipeline.cc
please use pickle for saving the embedding. @mohitmundhragithub please help figure out the difference between the one generated by @RSMNYS and Q's. |
once the pickle is done, please make the embedding part of the files to be downloaded for Stable Diffusion for the TFLite backend. |
here you can find 2 files in json format to be able to compare numbers at least: https://drive.google.com/drive/folders/1SO1akyvWd2uYz9Xf_u5OGBJLetuW6x5A?usp=sharing |
guys, I've updated the colab to generate the pkl file. Also adjusted embedding_utils code to parse this. Here you can find the pkl file: https://drive.google.com/file/d/1pDd5wZje1KbIS4JcWzhDx00aN8GmTBpc/view?usp=share_link |
@anhappdev I think for this we only need to upload the new UNET model (without embedding operations), and our embedding file. Right? If yes, can you please help upload those 2 files to the storage, from where we download models and other assets: https://drive.google.com/file/d/1pDd5wZje1KbIS4JcWzhDx00aN8GmTBpc/view?usp=share_link |
@RSMNYS Here is the URL for the 2 files you shared And other model files for reference: |
Current noise scheduling for TFLite was derived from my C++ code, which in turn was from Keras CV's code
|
The ts sequence values are different. Does that come from ODE solver? |
Hi guys! The new models works good. But we have one issue with pickle file format. And the problem is it's hard to decode and parse in c++, we need to use some special libs to parse it (and I wan't able to find such), or manual parsing which is hard and complex to parse the pickle data and protocols. So what I did I saved the tilmestep and embeddings in the same format as we originally had from Mohit. So while we can have the embedding part in pkl file format, in the c++ code I still use the old bin file format. So let's decide tomorrow if we need to stick to pkl or we can use the existing one .bin. The code to save embedding you can see in colab: https://colab.research.google.com/drive/1LG_rC5dlx2CbW2ZF4EamOnCdwtwLQESv#scrollTo=B6UTUZcQuj2f |
we also tried at our end. NB: small change is needed in the script to match to the pkl format that we use. |
Let's check @mohitmundhragithub can share. @RSMNYS to check if the tflite backend can use the "original" hard-coded embedding from Q. which is supposed to be generated from print("Loading scheduler")
scheduler = DPMSolverMultistepScheduler(beta_start=0.00085,
beta_end=0.012,
beta_schedule="scaled_linear",
num_train_timesteps=1000)
scheduler.set_timesteps(config.diffusion_steps)
scheduler.config.prediction_type = 'epsilon' |
Hi, This is the script that we used to generate the pickle file. It contains couple of changes to generate the .pkl file in required format. I was slightly wrong in the meeting. The qti backend cpp code doesn't consume the pkl file directly. The pkl file is consumed by the flatten.py file shared here: https://github.com/mlcommons/mobile_app_open/blob/submission-v4.1/mobile_back_qti/DLC/util/StableDiffusion/flatten.py#L147 This generates a bin file, which gets packed along with other model files, and is consumed by the qti backend along with the models. |
…f the timesteps and embeddings
@anhappdev please help put the embedding file to the right place (Cloudflare?) @anhappdev please create 5.0 submission branch after the checking is done. And then we can fixed the file location, and then free the submission branch. |
@RSMNYS Please change the base branch of this PR from |
@RSMNYS Can you please create a public GitHub repo and upload all the relevant files there like I did in this one and use those GitHub links for the backend settings. After we have a running code with final models / files, I will replace the GitHub links with the CloudFare one. This way I don't miss or upload wrong files. |
unet_time_step_embeddings_20.pkl.txt Sharing the .pkl files and the .bin files generated as described in the steps here: Please note that i was unable to upload .pkl and .bin.ts files (github's restriction), so had to append .txt in the filenames. Please remove the .txt extension to use those. |
that works good! |
* submission-v4.1: feat: add icon and description for Stable Diffusion benchmark (#917) enable stable diffusion in Pixel backend (#936) Update tflite_settings_mtk_mt6989.pbtxt Update QTI backend for submission v4.1 (#13) Applying linter changes Ran make format Update seed and num_steps for TFLite SD task (#16) Addressing review comments Final Submission for code for Qualcomm Add a caption_id to coco_gen dataset (#918) Enable stable_diffusion tests # Conflicts: # flutter/cpp/datasets/coco_gen.cc # mobile_back_apple/dev-utils/Makefile # mobile_back_tflite/cpp/backend_tflite/backend_settings/tflite_settings_android.pbtxt # mobile_back_tflite/cpp/backend_tflite/stable_diffusion_pipeline.h
Hi guys! I can run stable diffusion on my android device (Samsung Galaxy S22), but at the end I have 0 as a result, however I see all the steps in logs. Checking why. Also, during the stable diffusion process we are not updating the progress, so it's hard to understand what is going on. |
can you share the loadgen and logcat logs? |
Let's
|
Benchmark result.json |
Quality Gate passedIssues Measures |
Timestamp-embedding-parser