mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-01-23 15:01:32 -05:00
the script now generate into a HTML table, which allows us to use the copy button from the README.md Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
28 lines
718 B
Python
Executable File
28 lines
718 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from markdown_it import MarkdownIt
|
|
|
|
import openllm
|
|
|
|
md = MarkdownIt()
|
|
|
|
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
with open(os.path.join(ROOT, "README.md"), "r") as f:
|
|
readme = md.parse(f.read())
|
|
|
|
# NOTE: Currently, we only have one table in README, which is the Model readme.
|
|
table = [r for r in readme if r.type == "html_block" and r.content.startswith("<td><a")]
|
|
|
|
available = len(openllm.CONFIG_MAPPING.keys())
|
|
|
|
on_table = len(table) # NOTE: minus the header
|
|
|
|
if available - on_table != 0:
|
|
print("README.md is out of date! Make sure to run ./tools/update-readme.py")
|
|
raise SystemExit(1)
|
|
raise SystemExit(0)
|