Skip to content

Commit

Permalink
modify stat
Browse files Browse the repository at this point in the history
  • Loading branch information
congee524 committed Jan 14, 2021
1 parent 394dbe0 commit ffde91e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import glob
import re

import numpy as np
import titlecase

files = sorted(glob.glob('*_models.md'))
Expand All @@ -18,9 +19,10 @@

# count papers
papers = set(
titlecase.titlecase(x.lower().strip())
for x in re.findall(r'\btitle\s*=\s*{(.*)}', content))
paperlist = '\n'.join(sorted(' - ' + x for x in papers))
(papertype, titlecase.titlecase(paper.lower().strip()))
for (papertype, paper) in re.findall(
r'\[([A-Z]+?)\].*?\btitle\s*=\s*{(.*?)}', content, re.DOTALL))
paperlist = '\n'.join(sorted(f' - [{t}] {x}' for t, x in papers))

# count configs
configs = set(x.lower().strip()
Expand Down Expand Up @@ -48,12 +50,18 @@
allckpts = func.reduce(lambda a, b: a.union(b), [c for _, _, c, _ in stats])
msglist = '\n'.join(x for _, _, _, x in stats)

papertypes, papercounts = np.unique([t for t, _ in allpapers],
return_counts=True)
countstr = '\n'.join(
[f' - {t}: {c}' for t, c in zip(papertypes, papercounts)])

modelzoo = f"""
# Model Zoo Statistics
* Number of checkpoints: {len(allckpts)}
* Number of configs: {len(allconfigs)}
* Number of papers: {len(allpapers)}
{countstr}
{msglist}
"""
Expand Down

0 comments on commit ffde91e

Please sign in to comment.