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

WIP Model card #53

Merged
merged 8 commits into from
Jan 17, 2023
Merged

WIP Model card #53

merged 8 commits into from
Jan 17, 2023

Conversation

merveenoyan
Copy link
Collaborator

@merveenoyan merveenoyan commented Dec 3, 2022

This is a WIP for model card. Opening this PR so you could take a quick look to see if the behavior seems good.
I will add what I can add on top of it (Evaluation results, model plot and so on)

@merveenoyan
Copy link
Collaborator Author

I checked out from my documentation PR, feel free to ignore the parts about adding docstrings.

@merveenoyan merveenoyan requested a review from sayakpaul December 3, 2022 14:55
Copy link
Collaborator

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Looking good so far.

Did you use the model card utility as a part of the pipeline yet?

No worries, if not. I was just being curious.

Comment on lines 9 to 10
model_metadata (dict): Dict of card metadata.
see here for what you can pass to the metadata section:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Include descriptions about the other arguments too.

"""
if model_metadata is None:
model_metadata = {}
model_metadata["library_name"] = "vertex"
Copy link
Collaborator

Choose a reason for hiding this comment

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

If one runs the pipeline on a different orchestrator then vertex won't make sense. Also, it's better to call the key orchestrator or runner to denote that it's the platform on which things are getting executed.

@@ -0,0 +1,27 @@
---
# For reference on model card metadata, see: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
Copy link
Collaborator

Choose a reason for hiding this comment

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

see => refer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks!


## Model Description

This is a {{ task | default("segmentation")}} model trained using Vertex AI.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're not using Vertex AI, then it doesn't make sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What is this project specifically made for?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The project can be run any compatible platform. We ran it locally and Vertex AI.

Cc: @deep-diver

Copy link
Owner

@deep-diver deep-diver Dec 5, 2022

Choose a reason for hiding this comment

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

yes it is. the pipeline has two targets, Local and Vertex AI (which is Kubeflow 2.x). Better to say something like model trained using TensorFlow Extended

@@ -0,0 +1,27 @@
---
# For reference on model card metadata, see: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this link also show how we can specify the formatting like:

This is a {{ task | default("segmentation")}} model trained using Vertex AI.

Copy link
Collaborator Author

@merveenoyan merveenoyan Dec 4, 2022

Choose a reason for hiding this comment

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

it just shows the keys, so nope.
it's a jinja template, I can add that as a note.

@deep-diver
Copy link
Owner

It looks good as a starting point. I just want to ask to add a notebook that shows before and after running create_card() function to clearly see what the generated model card looks like. WDYT?

@merveenoyan
Copy link
Collaborator Author

@deep-diver sure I'll do that 🙂

@deep-diver
Copy link
Owner

@merveenoyan thanks! that would be great 👍🏼

@merveenoyan merveenoyan marked this pull request as ready for review January 16, 2023 12:28
@sayakpaul
Copy link
Collaborator

@deep-diver

@merveenoyan is finishing the first version of the model card feature in this PR. She wanted to test HFPusher (which has the model card utility) in isolation, preferably in a notebook.

Do you have any starter notebook which she could use?

@merveenoyan
Copy link
Collaborator Author

merveenoyan commented Jan 16, 2023

The revision of the test repository lies here, I tested like below (thought it would be good to test deployment in isolation but there might be a problem with HfPusher calling this, I haven't test separately yet) https://huggingface.co/merve/tfx-blessed-model/blob/merve/README.md
@sayakpaul @deep-diver

import tensorflow as tf
from runner import deploy_model_for_hf_hub

model = model_init() # random dummy model
model.save("./model_save_dir")

model_card_metadata = {}
deploy_model_for_hf_hub(
    username="merve",
    access_token=access_token,
    repo_name="tfx-blessed-model",
    model_path="./model_save_dir",
    model_version="merve"
)

@merveenoyan
Copy link
Collaborator Author

@deep-diver had to add create_card to __init__ so it was importable :/

@merveenoyan merveenoyan requested a review from sayakpaul January 16, 2023 15:29
Copy link
Collaborator

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Thanks a lot for working on this!

Will defer to @deep-diver for the final merge.

@merveenoyan
Copy link
Collaborator Author

Closes #43

@deep-diver
Copy link
Owner

Let's merge this PR as a starting point. @merveenoyan @sayakpaul

There is a couple of things to mention/check:

  • It looks like Hugging Face Model repo only shows model card in Model Card Tab in the main branch. Am I right? Like even though I switch to a certain branch.

  • I see that you create model_card_template.md file in Python code. I think it is better if we could keep the template as a static file in the project repo. I have recently upgraded HFPusher to push additional files to Model repository (Link). In this reference, I did it to include custom_handler.py that refers to the latest branch of a Model repo. Let's see if we could use this feature to include model_card_template.md in the future. It could automatically inject HF username or some additional metadata.

    • this feature is not merged in the TFX Addon yet though.

@deep-diver deep-diver merged commit 2f95ae1 into deep-diver:main Jan 17, 2023
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.

3 participants