-
Notifications
You must be signed in to change notification settings - Fork 570
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
Introducing list of tags to Keras model card #806
Conversation
BTW (commenting here because i just glanced at the code): maybe more future proof to create the yaml part of the model card using I remember that's what we did in |
Actually we already have |
@julien-c thanks for the tip, it looks much cleaner! |
@osanseviero I didn't see your comment and added with |
I think using |
|
The documentation is not available anymore as the PR was closed or merged. |
Merged main into this branch for other docs related changes and aligned docstring with main. |
is there any formatter or style checker that can indicate if a docstring is fit? @osanseviero |
Not sure, but as you can see at #806 (comment), the docs are actually built for you 🔥 Maybe @LysandreJik knows |
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.
Thanks!
Sorry I kinda rushed it, missed the nits. I added a test. @osanseviero I'll be waiting for @adrinjalali's comment on deprecation. |
I left metadata part as dictionary for convenience.
|
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.
Cool! This is looking safer and very nice! I left a couple of cleanup nits but almost ready to go 🚀
src/huggingface_hub/keras_mixin.py
Outdated
metadata["tags"] = tags | ||
elif isinstance(tags, str): | ||
metadata["tags"] = [tags] | ||
if "task_name" in locals(): |
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.
In lines 194 to 199 you can maybe do
task_name = model_save_kwargs.pop("task_name", None) # This means the default will be None
if task_name is not None:
warnings.warn(
"`task_name` input argument is removed. Pass `tags` instead.",
FutureWarning,
)
and similarly, here you won't need to check locals()
, which seems a bit hacky, and you can just do
if task_name is not 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.
it doesn't work, it says "task_name
local variable mentioned before assignment" that's why I had to do it. I'll check if I mention it anywhere else.
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.
Yes, you get the error because task_name
is created within an if. My suggestion is to have this outside all the ifs.
os.makedirs(save_directory, exist_ok=True)
task_name = model_save_kwargs.pop("task_name", None) # This means the default will be None
if task_name is not None:
warnings.warn(
"`task_name` input argument is removed. Pass `tags` instead.",
FutureWarning,
)
...
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 thought it wouldn't be able to pop or return KeyError. thanks!
@osanseviero my stupidity, I did fix them after I did a git add and I didn't add changes again apparently 😅😂 I was like "I could swear I changed them previously!!! am I hallucinating? 🥲" very sorry, I do listen to your comments before I resolve them, just saying. |
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.
Very nice! Thank you so much for this PR and iterating on it! 🚀
Co-authored-by: Omar Sanseviero <osanseviero@gmail.com>
Please don't merge PRs that are in red like this one, all tests from last 4 days show in red https://github.com/huggingface/huggingface_hub/actions/workflows/python-tests.yml due to a (very minor though) mismatch in a test warning. I sent #855 to fix this |
Also, note that we're trying to merge other people's PRs instead of our own on this repo :) (I should get on writing our policies and their variations for our repos) |
This PR closes #800
Resulting model card looks like this when given the tags list ["audio", "speech"].