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

(shortfin-apps)(flux) Align flux response handling with shark-ui compatibility requirements #1128

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

monorimet
Copy link
Contributor

@monorimet monorimet commented Mar 20, 2025

Mirrors changes from the following sd-focused PRs:

#1025
#1068
#1069

@monorimet monorimet disabled auto-merge March 22, 2025 03:52
Copy link
Contributor

@bjacobgordon bjacobgordon Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l'm glad that this was easy enough to find, @monorimet! I believe there's an opportunity to keep flux and sd in-step with each other.

What if, instead of duplicating, we moved the existing copy from shortfin_apps/sd/components to a new shortfin_apps/text_to_image directory to keep the common, model-agnostic components separate? In the future, if needed, we can just subclass this for aspects specific to SDXL or Flux.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to defer this to the coming refactor patches.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can defer if you'd like, totally!

But I recommend doing this now mainly because:

  1. It shrinks the diff for this particular PR (renaming an existing file with no line changes rather than adding a few dozen lines in the form of a new file)
  2. It's a simple, easy thing we can do right now that will shorten the list of things to refactor.
  3. Which as a result can simplify or completely avoid the merge conflicts we might encounter along the way.

Would you still like to defer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using the existing shortfin_apps/types directory?

Copy link
Contributor

@bjacobgordon bjacobgordon Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question!

The intent for that directory was more like "here's the stuff used exclusively by shortfin apps, but it's actually shortfin-agnostic", so probably not shortfin_apps/types. Now that you mention it, we'll probably wanna rename it to shortfin_apps/library the next time we mess with that directory. Not in this PR of course.

TextToImageInferenceOutput is definitely "aware" of shortfin's primary objective, and the name suggests that we'll eventually define TextToImageInferenceInput, so reserving shortfin_apps/text_to_image would help us begin with the end in mind!

And then when TextToTextInferenceOutput/TextToTextInferenceInput enter the chat, we can update our directories accordingly haha.


async def send_request(session, rep, args, data):
async def send_request(
session: aiohttp.ClientSession, rep: int, args: argparse.Namespace, data: dict
Copy link
Contributor

@bjacobgordon bjacobgordon Mar 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's an opportunity for a separate 30sec PR right here! I also have some more thoughts on this, but don't wanna clog up this review haha.

Could you bubble this signature change to its own commit at the beginning of this branch so we can cut it into a stack?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unnecessary given the commits will be squashed before merge.

Copy link
Contributor

@bjacobgordon bjacobgordon Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that basis, totally unnecessary, for sure! I'd say it's more about PR granularity, diff size, merge conflict avoidance, etc. We can skip bubbling up the commit for now!

The thing I was gonna mention is making the arguments multiline for easier diffing:

Suggested change
session: aiohttp.ClientSession, rep: int, args: argparse.Namespace, data: dict
session: aiohttp.ClientSession,
rep: int,
args: argparse.Namespace,
data: dict,

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that seems reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pre-commit actually undoes this change... let's keep aligned with the automatic linter in this case.

Copy link
Contributor

@bjacobgordon bjacobgordon Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, just tried it, and it seems to only undo the change if the dangling comma is left off! Does it pass pre-commit for you if you include the comma after dict?

Copy link
Contributor

@bjacobgordon bjacobgordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants