davanstrien HF staff commited on
Commit
3533641
1 Parent(s): a7a5300

add org rankings

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +24 -2
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Base Model Explorer
3
- emoji: 🏃
4
  colorFrom: green
5
  colorTo: purple
6
  sdk: gradio
 
1
  ---
2
  title: Base Model Explorer
3
+ emoji: 🧭
4
  colorFrom: green
5
  colorTo: purple
6
  sdk: gradio
app.py CHANGED
@@ -37,6 +37,14 @@ base_models = [
37
  df = pd.DataFrame(
38
  pd.DataFrame({"base_model": base_models}).value_counts()
39
  ).reset_index()
 
 
 
 
 
 
 
 
40
 
41
  grouped_by_base_model = groupby(
42
  lambda x: x.cardData.get("base_model"), models_with_base_model_info
@@ -61,12 +69,26 @@ def return_models_for_base_model(base_model):
61
 
62
 
63
  with gr.Blocks() as demo:
64
- gr.Markdown("### Models with base model info")
 
 
 
 
65
  gr.Markdown(summary)
66
  gr.Markdown("### Find all models trained from a base model")
67
  base_model = gr.Dropdown(all_base_models, label="Base Model")
68
  results = gr.Markdown()
69
  base_model.change(return_models_for_base_model, base_model, results)
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- # gr.DataFrame(df)
72
  demo.launch()
 
37
  df = pd.DataFrame(
38
  pd.DataFrame({"base_model": base_models}).value_counts()
39
  ).reset_index()
40
+ df_with_org = df.copy(deep=True)
41
+
42
+ def parse_org(hub_id):
43
+ parts = hub_id.split('/')
44
+ return parts[0] if len(parts) == 2 else None
45
+
46
+ df_with_org["org"] = df_with_org["base_model"].apply(parse_org)
47
+ df_with_org = df_with_org.dropna(subset=['org'])
48
 
49
  grouped_by_base_model = groupby(
50
  lambda x: x.cardData.get("base_model"), models_with_base_model_info
 
69
 
70
 
71
  with gr.Blocks() as demo:
72
+ gr.Markdown("# Base model explorer")
73
+ gr.Markdown(
74
+ """When sharing models to the Hub it is possible to specify a base model in the model card i.e. that your model is a fine-tuned version of [bert/base-cased](https://huggingface.co/bert-base-cased).
75
+ This Space allows you to find children models for a given base model and view the popularity of models for fine-tuning."""
76
+ )
77
  gr.Markdown(summary)
78
  gr.Markdown("### Find all models trained from a base model")
79
  base_model = gr.Dropdown(all_base_models, label="Base Model")
80
  results = gr.Markdown()
81
  base_model.change(return_models_for_base_model, base_model, results)
82
+ with gr.Accordion("Base model popularity ranking"):
83
+ gr.DataFrame(df.head(50))
84
+ with gr.Accordion("Base model popularity ranking by organisation"):
85
+ gr.DataFrame(
86
+ pd.DataFrame(
87
+ df_with_org.groupby("org")["count"]
88
+ .sum()
89
+ .sort_values(ascending=False)
90
+ .head(50)
91
+ ).reset_index()).sort_values("count", ascending=False)
92
+
93
 
 
94
  demo.launch()