py: remove license_content from metadata heuristics and add additional license file checks

This commit is contained in:
brian khuu 2024-08-06 07:26:09 +10:00
parent d79e8e12ff
commit 928aa66a92

View File

@ -381,7 +381,6 @@ class Metadata:
use_model_card_metadata("license", "license") use_model_card_metadata("license", "license")
use_model_card_metadata("license_name", "license_name") use_model_card_metadata("license_name", "license_name")
use_model_card_metadata("license_link", "license_link") use_model_card_metadata("license_link", "license_link")
use_model_card_metadata("license_content", "license_content")
use_array_model_card_metadata("tags", "tags") use_array_model_card_metadata("tags", "tags")
use_array_model_card_metadata("tags", "pipeline_tag") use_array_model_card_metadata("tags", "pipeline_tag")
@ -436,6 +435,7 @@ class Metadata:
# Detect LICENSE file and include a copy # Detect LICENSE file and include a copy
######################################### #########################################
if isinstance(metadata.license_link, str) and not (metadata.license_link.startswith("http://") or metadata.license_link.startswith("https://")):
if metadata.license_content is None: if metadata.license_content is None:
standard_license_file_path = Path("LICENSE") standard_license_file_path = Path("LICENSE")
if standard_license_file_path.is_file(): if standard_license_file_path.is_file():