diff --git a/model_converter/README.md b/model_converter/README.md index 99faf96c..bfd5aadf 100644 --- a/model_converter/README.md +++ b/model_converter/README.md @@ -158,6 +158,7 @@ The configuration file is a JSON file with the following structure: { "model_short_name": "resnet50", "license": "bsd-3-clause", + "license_name": "bsd-3-clause", "license_link": "https://spdx.org/licenses/BSD-3-Clause.html", "model_class_name": "torchvision.models.resnet.resnet50", "model_full_name": "ResNet-50", diff --git a/model_converter/presets/config.json b/model_converter/presets/config.json index bc7b4be2..97cc8371 100644 --- a/model_converter/presets/config.json +++ b/model_converter/presets/config.json @@ -651,7 +651,7 @@ "labels": "IMAGENET1K_V1", "model_full_name": "DINOv2 Classification", "description": "DINOv2 - Self-supervised Vision Transformer for image classification", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://huggingface.co/timm/vit_small_patch14_dinov2.lvd142m", "getitune_task": "MULTI_CLASS_CLS", "getitune_recipe": "dino_v2", "model_type": "Classification", @@ -726,13 +726,13 @@ "labels": "IMAGENET1K_V1", "model_full_name": "ViT-Tiny Classification", "description": "Vision Transformer Tiny trained with getitune for multi-class classification", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://huggingface.co/timm/vit_tiny_patch16_224.augreg_in21k", "getitune_recipe": "vit_tiny", "getitune_task": "MULTI_CLASS_CLS", "model_type": "Classification", "quantization_model_type": "transformer", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/apache-2.0.md", "tags": ["image-classification", "vision"], "dataset_type": "imagenet-1k" }, @@ -826,13 +826,13 @@ "model_library": "getitune", "model_full_name": "YOLOX-S", "description": "YOLOX-S single-stage object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/yolox", "getitune_task": "DETECTION", "getitune_recipe": "yolox_s", "model_type": "YOLOX", "tags": ["object-detection", "vision"], "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "dataset_type": "coco-detection" }, { @@ -840,13 +840,13 @@ "model_library": "getitune", "model_full_name": "YOLOX-L", "description": "YOLOX-L single-stage object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/yolox", "getitune_task": "DETECTION", "getitune_recipe": "yolox_l", "model_type": "YOLOX", "tags": ["object-detection", "vision"], "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "dataset_type": "coco-detection" }, { @@ -854,13 +854,13 @@ "model_library": "getitune", "model_full_name": "YOLOX-X", "description": "YOLOX-X single-stage object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/yolox", "getitune_task": "DETECTION", "getitune_recipe": "yolox_x", "model_type": "YOLOX", "tags": ["object-detection", "vision"], "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "dataset_type": "coco-detection" }, { @@ -868,13 +868,13 @@ "model_library": "getitune", "model_full_name": "SSD MobileNet-V2", "description": "SSD with MobileNet-V2 backbone for object detection trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/ssd", "getitune_task": "DETECTION", "getitune_recipe": "ssd_mobilenetv2", "model_type": "SSD", "tags": ["object-detection", "vision"], "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "dataset_type": "coco-detection" }, { @@ -882,13 +882,13 @@ "model_library": "getitune", "model_full_name": "ATSS MobileNet-V2", "description": "ATSS with MobileNet-V2 backbone for object detection trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/atss", "getitune_task": "DETECTION", "getitune_recipe": "atss_mobilenetv2", "model_type": "SSD", "tags": ["object-detection", "vision"], "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "dataset_type": "coco-detection" }, { @@ -910,12 +910,12 @@ "model_library": "getitune", "model_full_name": "YOLOX-Tiny", "description": "YOLOX-Tiny single-stage object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/yolox", "getitune_recipe": "yolox_tiny", "getitune_task": "DETECTION", "model_type": "YOLOX", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -924,12 +924,12 @@ "model_library": "getitune", "model_full_name": "DEIM D-FINE-L", "description": "DEIM D-FINE Large transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/Intellindust-AI-Lab/DEIM", "getitune_recipe": "deim_dfine_l", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/Intellindust-AI-Lab/DEIM/blob/main/LICENSE", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -938,12 +938,12 @@ "model_library": "getitune", "model_full_name": "DEIM D-FINE-M", "description": "DEIM D-FINE Medium transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/Intellindust-AI-Lab/DEIM", "getitune_recipe": "deim_dfine_m", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/Intellindust-AI-Lab/DEIM/blob/main/LICENSE", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -952,12 +952,12 @@ "model_library": "getitune", "model_full_name": "DEIM D-FINE-X", "description": "DEIM D-FINE Extra-Large transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/Intellindust-AI-Lab/DEIM", "getitune_recipe": "deim_dfine_x", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/Intellindust-AI-Lab/DEIM/blob/main/LICENSE", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -966,12 +966,12 @@ "model_library": "getitune", "model_full_name": "DEIMv2-L", "description": "DEIMv2 Large transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/Intellindust-AI-Lab/DEIMv2", "getitune_recipe": "deimv2_l", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/Intellindust-AI-Lab/DEIM/blob/main/LICENSE", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -980,12 +980,12 @@ "model_library": "getitune", "model_full_name": "DEIMv2-M", "description": "DEIMv2 Medium transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/Intellindust-AI-Lab/DEIMv2", "getitune_recipe": "deimv2_m", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/Intellindust-AI-Lab/DEIM/blob/main/LICENSE", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -994,12 +994,12 @@ "model_library": "getitune", "model_full_name": "DEIMv2-S", "description": "DEIMv2 Small transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/Intellindust-AI-Lab/DEIMv2", "getitune_recipe": "deimv2_s", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/Intellindust-AI-Lab/DEIM/blob/main/LICENSE", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -1022,12 +1022,12 @@ "model_library": "getitune", "model_full_name": "RF-DETR Large", "description": "RF-DETR Large transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/roboflow/rf-detr", "getitune_recipe": "rfdetr_large", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://roboflow.com/licensing", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -1036,12 +1036,12 @@ "model_library": "getitune", "model_full_name": "RF-DETR Medium", "description": "RF-DETR Medium transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/roboflow/rf-detr", "getitune_recipe": "rfdetr_medium", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://roboflow.com/licensing", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -1050,12 +1050,12 @@ "model_library": "getitune", "model_full_name": "RF-DETR Small", "description": "RF-DETR Small transformer-based object detection model trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/roboflow/rf-detr", "getitune_recipe": "rfdetr_small", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://roboflow.com/licensing", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -1064,12 +1064,12 @@ "model_library": "getitune", "model_full_name": "RT-DETR ResNet-50", "description": "RT-DETR with ResNet-50 backbone for real-time object detection trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/roboflow/rf-detr", "getitune_recipe": "rtdetr_50", "getitune_task": "DETECTION", "model_type": "SSD", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://roboflow.com/licensing", "tags": ["object-detection", "vision"], "dataset_type": "coco-detection" }, @@ -1078,13 +1078,13 @@ "model_library": "getitune", "model_full_name": "Mask R-CNN ResNet-50", "description": "Mask R-CNN with ResNet-50 for instance segmentation trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://docs.pytorch.org/vision/main/models/generated/torchvision.models.detection.maskrcnn_resnet50_fpn.html", "getitune_task": "INSTANCE_SEGMENTATION", "getitune_recipe": "maskrcnn_r50", "model_type": "MaskRCNN", "tags": ["image-segmentation", "instance-segmentation", "vision"], - "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license": "bsd-3-clause", + "license_link": "https://github.com/pytorch/vision/blob/main/LICENSE", "dataset_type": "coco-detection" }, { @@ -1092,13 +1092,13 @@ "model_library": "getitune", "model_full_name": "Mask R-CNN EfficientNet-B2B", "description": "Mask R-CNN with EfficientNet-B2B backbone for instance segmentation trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/efficientnet", "getitune_task": "INSTANCE_SEGMENTATION", "getitune_recipe": "maskrcnn_efficientnetb2b", "model_type": "MaskRCNN", "tags": ["image-segmentation", "instance-segmentation", "vision"], "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "dataset_type": "coco-detection" }, { @@ -1106,13 +1106,13 @@ "model_library": "getitune", "model_full_name": "Mask R-CNN Swin-Tiny", "description": "Mask R-CNN with Swin-Tiny backbone for instance segmentation trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/swin", "getitune_recipe": "maskrcnn_swint", "getitune_task": "INSTANCE_SEGMENTATION", "model_type": "MaskRCNN", "quantization_model_type": "transformer", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "tags": ["image-segmentation", "instance-segmentation", "vision"], "dataset_type": "coco-detection" }, @@ -1121,12 +1121,12 @@ "model_library": "getitune", "model_full_name": "RF-DETR Segmentation Large", "description": "RF-DETR Large for instance segmentation trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/roboflow/rf-detr", "getitune_recipe": "rfdetr_seg_large", "getitune_task": "INSTANCE_SEGMENTATION", "model_type": "MaskRCNN", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://roboflow.com/licensing", "tags": ["image-segmentation", "instance-segmentation", "vision"], "dataset_type": "coco-detection" }, @@ -1135,12 +1135,12 @@ "model_library": "getitune", "model_full_name": "RF-DETR Segmentation Medium", "description": "RF-DETR Medium for instance segmentation trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/roboflow/rf-detr", "getitune_recipe": "rfdetr_seg_medium", "getitune_task": "INSTANCE_SEGMENTATION", "model_type": "MaskRCNN", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://roboflow.com/licensing", "tags": ["image-segmentation", "instance-segmentation", "vision"], "dataset_type": "coco-detection" }, @@ -1149,12 +1149,12 @@ "model_library": "getitune", "model_full_name": "RF-DETR Segmentation Small", "description": "RF-DETR Small for instance segmentation trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/roboflow/rf-detr", "getitune_recipe": "rfdetr_seg_small", "getitune_task": "INSTANCE_SEGMENTATION", "model_type": "MaskRCNN", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://roboflow.com/licensing", "tags": ["image-segmentation", "instance-segmentation", "vision"], "dataset_type": "coco-detection" }, @@ -1163,12 +1163,12 @@ "model_library": "getitune", "model_full_name": "RF-DETR Segmentation X-Large", "description": "RF-DETR Extra-Large for instance segmentation trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/roboflow/rf-detr", "getitune_recipe": "rfdetr_seg_xlarge", "getitune_task": "INSTANCE_SEGMENTATION", "model_type": "MaskRCNN", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://roboflow.com/licensing", "tags": ["image-segmentation", "instance-segmentation", "vision"], "dataset_type": "coco-detection" }, @@ -1177,12 +1177,12 @@ "model_library": "getitune", "model_full_name": "RTMDet Instance Tiny", "description": "RTMDet Tiny for instance segmentation trained with getitune", - "docs": "https://github.com/open-edge-platform/training_extensions", + "docs": "https://github.com/open-mmlab/mmdetection/tree/main/configs/rtmdet", "getitune_recipe": "rtmdet_inst_tiny", "getitune_task": "INSTANCE_SEGMENTATION", "model_type": "MaskRCNN", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://github.com/open-mmlab/mmdetection/blob/main/LICENSE", "tags": ["image-segmentation", "instance-segmentation", "vision"], "dataset_type": "coco-detection" }, @@ -1238,7 +1238,7 @@ "getitune_task": "SEMANTIC_SEGMENTATION", "model_type": "Segmentation", "license": "apache-2.0", - "license_link": "https://spdx.org/licenses/Apache-2.0.html", + "license_link": "https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/apache-2.0.md", "tags": ["image-segmentation", "semantic-segmentation", "vision"], "dataset_type": "ade20k" }, diff --git a/model_converter/src/model_converter/converters/base.py b/model_converter/src/model_converter/converters/base.py index f08a17e0..079d3672 100644 --- a/model_converter/src/model_converter/converters/base.py +++ b/model_converter/src/model_converter/converters/base.py @@ -30,6 +30,25 @@ from model_converter.metrics import CocoDetectionMAP, Metric +def _get_human_license_name(name: str) -> str: + mapping = { + "agpl-3.0": "AGPL-3.0-only", + "apache-2.0": "Apache-2.0", + "bsd-3-clause": "BSD-3-Clause", + } + + return mapping.get(name, name) + + +def _get_model_docs_page_name(url: str) -> str: + url = url.lower() + if "github" in url: + return "repository" + if "huggingface" in url: + return "card" + return "documentation" + + class BaseConverter(ABC): """Abstract base class for model converters. @@ -337,8 +356,12 @@ def copy_readme( model_short_name = str(model_config.get("model_short_name", "")).strip() model_library = str(model_config.get("model_library", "timm")).strip() model_license = str(model_config.get("license", "")).strip() + model_license_name = _get_human_license_name(model_license) model_license_link = str(model_config.get("license_link", "")).strip() docs = str(model_config.get("docs", "")).strip() + model_docs_page_name = str( + model_config.get("model_docs_page_name", _get_model_docs_page_name(url=docs)), + ).strip() def template_placeholder(name: str) -> str: return f"<<{name}>>" @@ -373,11 +396,13 @@ def template_placeholder(name: str) -> str: placeholders = { template_placeholder("license"): model_license, + template_placeholder("license_name"): model_license_name, template_placeholder("license_link"): model_license_link, template_placeholder("model_name"): model_short_name, template_placeholder("model_short_name"): model_short_name, template_placeholder("variant"): variant, template_placeholder("docs"): docs, + template_placeholder("model_docs_page_name"): model_docs_page_name, } # Handle tags list → YAML formatting diff --git a/model_converter/src/model_converter/templates/README-getitune-fp16.md b/model_converter/src/model_converter/templates/README-getitune-fp16.md index 11d756b3..f4202938 100644 --- a/model_converter/src/model_converter/templates/README-getitune-fp16.md +++ b/model_converter/src/model_converter/templates/README-getitune-fp16.md @@ -6,12 +6,12 @@ tags: # <>-fp16-ov -- Model creator: [Geti™](https://github.com/open-edge-platform/training_extensions) +- Model creator: [Geti™](https://github.com/open-edge-platform/geti) - Original model: [<>](<>) ## Description -This is a [Geti™](https://github.com/open-edge-platform/training_extensions) version of [<>](<>) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2026/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to FP16. +This is a [Geti™](https://github.com/open-edge-platform/geti) version of [<>](<>) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2026/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to FP16. To fine-tune your model with a custom dataset, you can use Geti™ to annotate data, perform fine-tuning, and export the resulting model. @@ -57,11 +57,11 @@ For more examples and possible optimizations, refer to the [Model API Documentat ## Limitations -Check the original [model documentation](<>) for limitations. +Check the [original model documentation](<>) for limitations. ## Legal information -The original model is distributed under the [<>](<>) license. More details can be found in [training_extensions](https://github.com/open-edge-platform/training_extensions). +The original model is distributed under the [<>](<>) license. More details can be found in the [original model <>](<>). ## Disclaimer diff --git a/model_converter/src/model_converter/templates/README-getitune-int8.md b/model_converter/src/model_converter/templates/README-getitune-int8.md index f34918c0..21f9c3e2 100644 --- a/model_converter/src/model_converter/templates/README-getitune-int8.md +++ b/model_converter/src/model_converter/templates/README-getitune-int8.md @@ -6,12 +6,12 @@ tags: # <>-int8-ov -- Model creator: [Geti™](https://github.com/open-edge-platform/training_extensions) +- Model creator: [Geti™](https://github.com/open-edge-platform/geti) - Original model: [<>](<>) ## Description -This is a [Geti™](https://github.com/open-edge-platform/training_extensions) version of [<>](<>) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2026/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to INT8. +This is a [Geti™](https://github.com/open-edge-platform/geti) version of [<>](<>) model converted to the [OpenVINO™ IR](https://docs.openvino.ai/2026/documentation/openvino-ir-format.html) (Intermediate Representation) format with weights compressed to INT8. To fine-tune your model with a custom dataset, you can use Geti™ to annotate data, perform fine-tuning, and export the resulting model. @@ -66,11 +66,11 @@ For more examples and possible optimizations, refer to the [Model API Documentat ## Limitations -Check the original [model documentation](<>) for limitations. +Check the [original model documentation](<>) for limitations. ## Legal information -The original model is distributed under the [<>](<>) license. More details can be found in [training_extensions](https://github.com/open-edge-platform/training_extensions). +The original model is distributed under the [<>](<>) license. More details can be found in the [original model <>](<>). ## Disclaimer diff --git a/model_converter/src/model_converter/templates/README-timm-fp16.md b/model_converter/src/model_converter/templates/README-timm-fp16.md index 3ff9a382..7ea85702 100644 --- a/model_converter/src/model_converter/templates/README-timm-fp16.md +++ b/model_converter/src/model_converter/templates/README-timm-fp16.md @@ -59,11 +59,11 @@ For more examples and possible optimizations, refer to the [Model API Documentat ## Limitations -Check the original [model card](https://huggingface.co/<>) for limitations. +Check the [original model card](https://huggingface.co/<>) for limitations. ## Legal information -The original model is distributed under the [<>](<>) license. More details can be found in [<>](https://huggingface.co/<>) +The original model is distributed under the [<>](<>) license. More details can be found in [<>](https://huggingface.co/<>) ## Disclaimer diff --git a/model_converter/src/model_converter/templates/README-timm-int8.md b/model_converter/src/model_converter/templates/README-timm-int8.md index 1fff675f..c897e1ac 100644 --- a/model_converter/src/model_converter/templates/README-timm-int8.md +++ b/model_converter/src/model_converter/templates/README-timm-int8.md @@ -68,11 +68,11 @@ For more examples and possible optimizations, refer to the [Model API Documentat ## Limitations -Check the original [model card](https://huggingface.co/<>) for limitations. +Check the [original model card](https://huggingface.co/<>) for limitations. ## Legal information -The original model is distributed under the [<>](<>) license. More details can be found in [<>](https://huggingface.co/<>) +The original model is distributed under the [<>](<>) license. More details can be found in [<>](https://huggingface.co/<>) ## Disclaimer diff --git a/model_converter/src/model_converter/templates/README-torchvision-fp16.md b/model_converter/src/model_converter/templates/README-torchvision-fp16.md index 664da42e..ffd0922c 100644 --- a/model_converter/src/model_converter/templates/README-torchvision-fp16.md +++ b/model_converter/src/model_converter/templates/README-torchvision-fp16.md @@ -56,11 +56,11 @@ For more examples and possible optimizations, refer to the [Model API Documentat ## Limitations -Check the original [model implementation](https://github.com/pytorch/vision) for limitations. +Check the [original model implementation](https://github.com/pytorch/vision) for limitations. ## Legal information -The original model is distributed under the [<>](<>) license. More details can be found in [https://github.com/pytorch/vision](https://github.com/pytorch/vision). +The original model is distributed under the [<>](<>) license. More details can be found in [https://github.com/pytorch/vision](https://github.com/pytorch/vision). ## Disclaimer diff --git a/model_converter/src/model_converter/templates/README-torchvision-int8.md b/model_converter/src/model_converter/templates/README-torchvision-int8.md index f6c71095..d0d5cbe3 100644 --- a/model_converter/src/model_converter/templates/README-torchvision-int8.md +++ b/model_converter/src/model_converter/templates/README-torchvision-int8.md @@ -65,11 +65,11 @@ For more examples and possible optimizations, refer to the [Model API Documentat ## Limitations -Check the original [model implementation](https://github.com/pytorch/vision) for limitations. +Check the [original model implementation](https://github.com/pytorch/vision) for limitations. ## Legal information -The original model is distributed under the [<>](<>) license. More details can be found in [https://github.com/pytorch/vision](https://github.com/pytorch/vision). +The original model is distributed under the [<>](<>) license. More details can be found in [https://github.com/pytorch/vision](https://github.com/pytorch/vision). ## Disclaimer diff --git a/model_converter/src/model_converter/templates/README-yolo-fp16.md b/model_converter/src/model_converter/templates/README-yolo-fp16.md index 4b95398f..50ffa9cb 100644 --- a/model_converter/src/model_converter/templates/README-yolo-fp16.md +++ b/model_converter/src/model_converter/templates/README-yolo-fp16.md @@ -59,7 +59,7 @@ For more examples and possible optimizations, refer to the [Model API Documentat ## Limitations -Check the original [model card](https://huggingface.co/Ultralytics/YOLO11) for limitations. +Check the [original model card](https://huggingface.co/Ultralytics/YOLO11) for limitations. ## Legal information diff --git a/model_converter/src/model_converter/templates/README-yolo-int8.md b/model_converter/src/model_converter/templates/README-yolo-int8.md index c034c6cb..d6bb1f64 100644 --- a/model_converter/src/model_converter/templates/README-yolo-int8.md +++ b/model_converter/src/model_converter/templates/README-yolo-int8.md @@ -70,7 +70,7 @@ For more examples and possible optimizations, refer to the [Model API Documentat ## Limitations -Check the original [model card](https://huggingface.co/Ultralytics/YOLO11) for limitations. +Check the [original model card](https://huggingface.co/Ultralytics/YOLO11) for limitations. ## Legal information diff --git a/model_converter/tests/unit/test_converters.py b/model_converter/tests/unit/test_converters.py index 8ea5ea82..21a2da88 100644 --- a/model_converter/tests/unit/test_converters.py +++ b/model_converter/tests/unit/test_converters.py @@ -33,8 +33,10 @@ def test_renders_placeholders_and_tags_yaml(self, converter, template_dir, tmp_p (template_dir / "README-torchvision-fp16.md").write_text( "# <>\n" "License: <>\n" + "License name: <>\n" "License link: <>\n" "Docs: <>\n" + "Docs page name: <>\n" "Variant: <>\n" "Tags:\n" "<>", @@ -46,7 +48,7 @@ def test_renders_placeholders_and_tags_yaml(self, converter, template_dir, tmp_p { "model_short_name": "test_model", "model_library": "torchvision", - "license": "Apache-2.0", + "license": "apache-2.0", "license_link": "https://apache.org/licenses/LICENSE-2.0", "docs": "https://docs.example.com", "tags": ["vision", "classification"], @@ -57,13 +59,97 @@ def test_renders_placeholders_and_tags_yaml(self, converter, template_dir, tmp_p content = (output_folder / "README.md").read_text() assert "# test_model" in content - assert "License: Apache-2.0" in content + assert "License: apache-2.0" in content + assert "License name: Apache-2.0" in content assert "License link: https://apache.org/licenses/LICENSE-2.0" in content assert "Docs: https://docs.example.com" in content + assert "Docs page name: documentation" in content assert "Variant: fp16" in content assert " - vision" in content assert " - classification" in content + @pytest.mark.parametrize( + ("license_id", "license_name"), + [ + ("apache-2.0", "Apache-2.0"), + ("rAnDoM", "rAnDoM"), + ("agpl-3.0", "AGPL-3.0-only"), + ("bsd-3-clause", "BSD-3-Clause"), + ], + ) + def test_selects_correct_license_name( + self, + converter, + template_dir, + tmp_path, + monkeypatch, + license_id, + license_name, + ): + """copy_readme fills placeholders from config and renders tags as YAML.""" + _set_template_root(monkeypatch, template_dir) + (template_dir / "README-torchvision-fp16.md").write_text( + "License: <>\nLicense name: <>\n", + ) + output_folder = tmp_path / "test_model-fp16-ov" + output_folder.mkdir() + + converter.copy_readme( + { + "model_short_name": "test_model", + "model_library": "torchvision", + "license": license_id, + "license_link": "https://apache.org/licenses/LICENSE-2.0", + "docs": "https://docs.example.com", + }, + output_folder, + variant="fp16", + ) + + content = (output_folder / "README.md").read_text() + assert f"License: {license_id}" in content + assert f"License name: {license_name}" in content + + @pytest.mark.parametrize( + ("docs_url", "docs_page_name"), + [ + ("https://docs.example.com", "documentation"), + ("https://huggingface.com/foo/bar", "card"), + ("https://github.com/foo/bar", "repository"), + ], + ) + def test_selects_correct_docs_page_name( + self, + converter, + template_dir, + tmp_path, + monkeypatch, + docs_url, + docs_page_name, + ): + """copy_readme fills placeholders from config and renders tags as YAML.""" + _set_template_root(monkeypatch, template_dir) + (template_dir / "README-torchvision-fp16.md").write_text( + "Docs page name: <>\n", + ) + output_folder = tmp_path / "test_model-fp16-ov" + output_folder.mkdir() + + converter.copy_readme( + { + "model_short_name": "test_model", + "model_library": "torchvision", + "license": "apache-2.0", + "license_link": "https://apache.org/licenses/LICENSE-2.0", + "docs": docs_url, + }, + output_folder, + variant="fp16", + ) + + content = (output_folder / "README.md").read_text() + assert f"Docs page name: {docs_page_name}" in content + @pytest.mark.parametrize( ("config", "expected"), [