Enhance model publishing workflow with detailed metadata and licenses#459
Enhance model publishing workflow with detailed metadata and licenses#459HenryNdubuaku merged 5 commits intomainfrom
Conversation
Signed-off-by: jakmro <[email protected]>
Signed-off-by: jakmro <[email protected]>
Signed-off-by: jakmro <[email protected]>
There was a problem hiding this comment.
Pull request overview
This pull request enhances the model publishing workflow by adding detailed metadata (pipeline tags, tags, descriptions) and automatic license detection to published HuggingFace model cards. The changes improve discoverability and documentation of published models.
Changes:
- Added YAML-based model card generation with metadata fields (base_model, pipeline_tag, tags, license, description)
- Enhanced organization README publishing with proper YAML frontmatter for HuggingFace Spaces
- Added LiquidAI/LFM2-8B-A1B model to the publishing configuration
- Extended CLI to accept pipeline-tag, tags, and description arguments
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| python/src/publish_to_hf.py | Added yaml import, FALLBACK_LICENSES dict, metadata handling in model card generation, frontmatter for org README, and new CLI arguments for metadata |
| .github/workflows/publish_to_hf.yml | Updated MODELS_CONFIG with metadata for all models, added new LFM2-8B-A1B model, modified bash script to pass metadata parameters to Python script |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| publish_model() { | ||
| local model=$1 int4=$2 int8=$3 fp16=$4 apple=$5 | ||
| local model=$1 int4=$2 int8=$3 fp16=$4 apple=$5 pipeline_tag=$6 tags=$7 description="${8:-}" |
There was a problem hiding this comment.
The publish_model function signature now requires 8 parameters including pipeline_tag, tags, and description. However, the manual workflow path at lines 115-120 (not shown in this diff) only passes 5 arguments. This will cause the manual publish path to fail or pass incorrect values. Consider adding default empty values for the new parameters when called manually, or document that manual workflow dispatch is not fully supported.
| python -m src.publish_to_hf --task export_model $FLAGS | ||
| [ -n "$pipeline_tag" ] && FLAGS="$FLAGS --pipeline-tag $pipeline_tag" | ||
| [ -n "$tags" ] && FLAGS="$FLAGS --tags $tags" | ||
| python -m src.publish_to_hf --task export_model $FLAGS --description "$description" |
There was a problem hiding this comment.
The FLAGS variable is expanded without quotes in the command. While this is intentional to allow word splitting of the flags, if any of the values (like model names, tags, or pipeline_tag) contain spaces, this could cause incorrect argument parsing. Consider using an array instead of a string for FLAGS, or ensure that all components are properly quoted when building FLAGS.
|
|
||
| try: | ||
| info = api.model_info(args.model) | ||
| source_license = (info.card_data and info.card_data.license) or FALLBACK_LICENSES.get(args.model) |
There was a problem hiding this comment.
The license fetching logic attempts to access info.card_data.license without checking if card_data is None first. While the expression uses 'and' short-circuit evaluation correctly, if info.card_data exists but is an object without a license attribute, this could raise an AttributeError. Consider using getattr(info.card_data, 'license', None) for safer attribute access.
| source_license = (info.card_data and info.card_data.license) or FALLBACK_LICENSES.get(args.model) | |
| source_license = (getattr(info.card_data, "license", None) if info.card_data is not None else None) or FALLBACK_LICENSES.get(args.model) |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…cactus-compute#459) * Enhance model publishing workflow with detailed metadata and licenses Signed-off-by: jakmro <[email protected]> * clean Signed-off-by: jakmro <[email protected]> * Update pipeline tag for Silero VAD model in publish workflow Signed-off-by: jakmro <[email protected]> * Update python/src/publish_to_hf.py Co-authored-by: Copilot <[email protected]> * Update python/src/publish_to_hf.py Co-authored-by: Copilot <[email protected]> --------- Signed-off-by: jakmro <[email protected]> Co-authored-by: Copilot <[email protected]>
…cactus-compute#459) * Enhance model publishing workflow with detailed metadata and licenses Signed-off-by: jakmro <[email protected]> * clean Signed-off-by: jakmro <[email protected]> * Update pipeline tag for Silero VAD model in publish workflow Signed-off-by: jakmro <[email protected]> * Update python/src/publish_to_hf.py Co-authored-by: Copilot <[email protected]> * Update python/src/publish_to_hf.py Co-authored-by: Copilot <[email protected]> --------- Signed-off-by: jakmro <[email protected]> Co-authored-by: Copilot <[email protected]>
No description provided.