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-sd) Usability and logging improvements. #491

Merged
merged 20 commits into from
Nov 13, 2024
Merged

Conversation

monorimet
Copy link
Contributor

@monorimet monorimet commented Nov 13, 2024

  • Port configuration fixes
  • Reduce need for topology footguns by implementing simple topology config artifacts for 4 setups (cpx:single/multi, spx:single/multi). These set server/device topologies to "known good" configurations.
  • Fix example client script (send_request.py -> simple_client.py) and include in python package, arg problems fixed as well (--save)
  • Remove need for source code
  • Safer failures for invalid output dims
  • Don't report server startup under uvicorn.error
  • Updates sd README with new example CLI inputs
  • Adds help for client CLI args

@monorimet monorimet marked this pull request as ready for review November 13, 2024 17:56
@monorimet monorimet changed the title (WIP) (shortfin-sd) Usability and logging improvements. (shortfin-sd) Usability and logging improvements. Nov 13, 2024
Copy link
Contributor

@amd-chrissosa amd-chrissosa left a comment

Choose a reason for hiding this comment

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

Mostly small code quality improvements / questions.

@@ -38,19 +38,15 @@ def __init__(self):
native_handler.setFormatter(NativeFormatter())

# TODO: Source from env vars.
logger.setLevel(logging.INFO)
logger.setLevel(logging.DEBUG)
Copy link
Contributor

Choose a reason for hiding this comment

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

For release should we move this back to info/warn? if you want I can just clean up the logging after you submit. I feel tempted to just add a debug/verbose option and pipe that through here.

}


def bytes_to_img(bytes, idx=0, width=1024, height=1024, outputdir="./gen_imgs"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you have this as an arg from the arg parser no need to have a second default.


def get_batched(request, arg, idx):
if isinstance(request[arg], list):
if len(request[arg]) == 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why ignore the index if there is only one item? Is the index -1 or something? Maybe add a comment

print(f"Error: Received {response.status} from server")
raise Exception
except Exception as e:
print(f"Request failed: {e}")
Copy link
Contributor

Choose a reason for hiding this comment

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

This except clause seems redundant with the internal one. Based on docs for async with you already have a try except inside there right?

p.add_argument(
"--file",
type=str,
default="default",
Copy link
Contributor

Choose a reason for hiding this comment

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

Cleaner to just check for None than a hard coded default string

parser.add_argument(
"--tuning_spec",
type=str,
default="",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd stick to "" or None for string defaults.

from shortfin_apps.sd.components.config_struct import ModelParams

this_dir = os.path.dirname(os.path.abspath(__file__))
parent = os.path.dirname(this_dir)
Copy link
Contributor

Choose a reason for hiding this comment

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

do you use this anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, copied from the other builder. Thanks.

Copy link

@kumardeepakamd kumardeepakamd left a comment

Choose a reason for hiding this comment

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

Looks good to be landed and iterated for testing. Address Chris's comments.

@@ -24,7 +24,7 @@
sfnp.bfloat16: "bf16",
}

ARTIFACT_VERSION = "11022024"
ARTIFACT_VERSION = "11132024"

Choose a reason for hiding this comment

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

Can artifact version bump be automated in future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

STROBE_SHORT_DELAY = 0.1
STROBE_LONG_DELAY = 0.25
STROBE_SHORT_DELAY = 0.5
STROBE_LONG_DELAY = 1

Choose a reason for hiding this comment

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

How does this impact user experience?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are the increments by which the batcher checks for incoming requests

@monorimet monorimet merged commit 2fa1f92 into main Nov 13, 2024
12 of 13 checks passed
@monorimet monorimet deleted the sd-logging branch November 13, 2024 22:15
@monorimet
Copy link
Contributor Author

Merging and will follow up with addressing review comments

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