Skip to content

Commit a48ad30

Browse files
committed
chore: add license generator section
1 parent d3067a4 commit a48ad30

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/convert-model-all-quant.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,21 @@ jobs:
126126
{"role": "system", "content": "You are a helpful assistant."},
127127
{
128128
"role": "user",
129-
"content": f"Write a concise overview for a machine learning model named '{target_model_id}' derived from '{source_model_id}', highlighting its purpose, use cases, and performance. You DO NOT generate title (# heading 1) and summary sections. For the overview section, make it concise and in a paragraph of 5 sentences"
129+
"content": f"Write a concise overview for an ai model named '{target_model_id}' derived from '{source_model_id}', highlighting its purpose, use cases, and performance. You DO NOT generate title (# heading 1) and summary sections. For the overview section, make it concise and in a paragraph of 5 sentences"
130130
}
131131
]
132132
)
133133
overview = completion.choices[0].message.content.strip()
134134
135+
model_dir = f"/mnt/models/{model_name}/hf"
136+
licenses = []
137+
for filename in os.listdir(model_dir):
138+
if filename.startswith('LICENSE'):
139+
license_url = f"https://huggingface.co/{source_model_id}/blob/main/{filename}"
140+
licenses.append(f"[{filename}]({license_url})")
141+
142+
license_links = " | ".join(licenses) if licenses else "[License](#)"
143+
135144
# README.md template
136145
readme_template = f"""\
137146
@@ -169,7 +178,7 @@ jobs:
169178
170179
- **Author:** {author}
171180
- **Converter:** [Homebrew](https://www.homebrew.ltd/)
172-
- **Original License:** [License](https://huggingface.co/{user_name}/{model_name}#license)
181+
- **Original License:** {license_links}
173182
"""
174183
175184
# Write the README.md file

0 commit comments

Comments
 (0)