-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support payload input in GAP #219
base: feature-request-level-timing
Are you sure you want to change the base?
Support payload input in GAP #219
Conversation
7ca4922
to
91f8ec1
Compare
c829674
to
a143645
Compare
a143645
to
10148f4
Compare
Replace with correct variable
10148f4
to
ae3759c
Compare
ae3759c
to
82a3726
Compare
82a3726
to
7f47060
Compare
b5c5d71
to
3f6e35c
Compare
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.
Excellent work, Harshini! I appreciate you cleaning things up as you go too.
Left some comments.
with open(str(filename), "w") as f: | ||
f.write(json.dumps(self._stats_and_args, indent=2)) | ||
|
||
def _prepare_args_for_export(self) -> None: | ||
self._args.pop("func", None) | ||
self._args.pop("output_format", None) | ||
self._args.pop("input_file", None) | ||
self._args.pop("payload_input_file", None) |
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.
Aside to the team: I didn't know this was here. We should create a cleaner way to do this. Like having a separate function with a list of args that are excluded, then popping them all. We could get refactor the code to get rid of all of the args that aren't necessary for the JSON exporter to make it cleaner.
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.
Agree
@@ -56,6 +56,11 @@ def convert( | |||
payload = { | |||
"input": [{"type": "image_url", "url": img} for img in row.images] | |||
} | |||
request_body["data"].append({"payload": [payload]}) | |||
self._add_payload_params(payload, row.optional_data) |
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 don't love this approach. Is there a way to wrap this and make it cleaner? This is going to make the converters less straightforward to write. You'll also need to update the customizable frontends tutorial to reflect any changes here.
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.
Do you mean for this converter? OR are you making a general statement about the way this was implemented? Just trying to understand the scope of the ask.
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.
All the converters. I think this is the "hot path" for adding a new converter (i.e. customizable frontend). We want it to be as simple, concise, and intuitive as possible.
Any changes to this process also need to be documented in customizable_frontends.md.
if not filename.exists(): | ||
raise FileNotFoundError(f"The file '{filename}' does not exist.") | ||
|
||
def _get_content_from_input_file(self, filename: Path) -> Union[ |
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.
Do you want to organize these into the implemented ones vs the non-implemented ones? And perhaps alphabetize them within each of those sections for easy navigation?
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.
Sorry. This was also my mess. I agree that it needs to be cleaned up more.
genai-perf/genai_perf/inputs/retrievers/payload_input_retriever.py
Outdated
Show resolved
Hide resolved
genai-perf/genai_perf/inputs/retrievers/payload_input_retriever.py
Outdated
Show resolved
Hide resolved
genai-perf/genai_perf/inputs/retrievers/payload_input_retriever.py
Outdated
Show resolved
Hide resolved
0b19aad
to
482a3b7
Compare
8a6b941
to
6096b2c
Compare
|
||
if args.prompt_source == ic.PromptSource.PAYLOAD: | ||
if args.concurrency or args.request_rate: | ||
raise ValueError( |
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.
nit: Could you return this as a parser.error? That's more native to ArgParse and consistent with the other errors returned.
|
||
Filename: TypeAlias = str | ||
TypeOfData: TypeAlias = str | ||
ListOfData: TypeAlias = List[str] | ||
DataRowDict: TypeAlias = Dict[TypeOfData, ListOfData] | ||
DataRowDict: TypeAlias = Dict[str, Union[List[str], Dict[str, Any], str]] |
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.
Maybe loop in our alias whiz, @nv-braf? My guess though is that if it's this complex, we're doing some overloading with typing that's really unclean and masking other issues. I also would have no idea what's going on here from a quick review of the code.
I can't speak to the complexity over time, which we have tried to reduce, but if you look at the before/after, one of these is relatively straightforward and the other is relatively messy. Having three possible datatypes values for a DataRowDict (or anything) doesn't sit right with me. That's too much overloading. We could fix the underlying issue in a future refactor, theoretically, but it looks like this PR is creating the above issue so we should fix it now.
""" | ||
|
||
files_data: Dict[str, FileData] = {} | ||
input_file = cast(Path, self.config.payload_input_filename) |
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.
Okay, so it sounds like we need to clean this up somewhere. This is using latent knowledge of what the types should be, which is dangerous and hard to navigate as a code reader.
We can leave this given the other code already does this, but whenever we have a major refactor (e.g. for GA), we should look at removing these casts wherever possible. Ryan pointed this out to me in one of my reviews that I cleaned up: there was a type that was optional to make the code flow easier and he asked whether it ever should be optional; the answer was no, so even though it required more effort to think through the default, I swapped it to have the correct data type and only that type.
This PR creates a