Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions benchmarks/migrations/0022_model_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('benchmarks', '0021_change_meta_fields_to_foreignkey'),
]

operations = [
migrations.AddField(
model_name='model',
name='group',
field=models.CharField(max_length=50, default=None, null=True),
),
]
8 changes: 8 additions & 0 deletions benchmarks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ class Meta:


class Model(models.Model):
class Group:
REFERENCE = 'reference'
TOP10_2024 = 'top10_2024'
BEST_NEURAL = 'best_neural'
BEST_BEHAVIORAL = 'best_behavioral'
GLOBAL_SCORE = 'global_score'

id = models.AutoField(primary_key=True)
name = models.CharField(max_length=200)
owner = models.ForeignKey(User, on_delete=models.PROTECT)
Expand All @@ -227,6 +234,7 @@ class Model(models.Model):
public = models.BooleanField(default=False)
competition = models.CharField(max_length=200, default=None, null=True)
domain = models.CharField(max_length=200, default="vision")
group = models.CharField(max_length=50, default=None, null=True)

def __repr__(self):
return generic_repr(self)
Expand Down
32 changes: 28 additions & 4 deletions benchmarks/templates/benchmarks/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ <h1>Explore Benchmarks and Models</h1>


{% block content %}
<script src="{% static 'benchmarks/js/components/tooltip.js' %}"></script>
<div class="columns">
<div class="column">
<div class="banner box benchmark-box">
Expand All @@ -22,13 +23,36 @@ <h2 class="title is-title-2">{{ benchmarks|length }} public Benchmarks</h2>
</div>
<div class="column">
<div class="banner box model-box">
<h2 class="title is-title-2">{{ models|length }} public Models</h2>
<h2 class="title is-title-2">{{ total_model_count }} public Models</h2>
</div>

{% if representative_models %}
<div class="mb-4">
<h3 class="title is-5">
Representative Models ({{ representative_models|length }})
<span class="icon is-small ml-1"
data-tooltip="This curated set of 100 models includes: 10 reference models (e.g., AlexNet, CORnet-S), 8 top 2024 competition winners, 20 best neural performers (top 5 per V1, V2, V4, IT), 20 best behavioral performers, and 42 highest-scoring models by overall Brain-Score."
data-tooltip-position="right"
style="cursor: help; color: #5C8DB8;">
<i class="fa-solid fa-circle-info"></i>
</span>
</h3>
<div>
{% for model in representative_models %}
<a class="tag model-tag" href="{% url 'model-view' domain model.id %}">{{ model.name }}</a>
{% endfor %}
</div>
</div>
<hr>
{% endif %}

<div>
{% for model in models %}
<a class="tag model-tag" href="{% url 'model-view' domain model.id %}">{{ model.name }}</a>
{% endfor %}
<h3 class="title is-5">Other Models</h3>
<div>
{% for model in other_models %}
<a class="tag model-tag" href="{% url 'model-view' domain model.id %}">{{ model.name }}</a>
{% endfor %}
</div>
</div>
</div>
</div>
Expand Down
35 changes: 30 additions & 5 deletions benchmarks/views/explore.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,39 @@


def view(request, domain):
models = (Model.objects
.filter(domain=domain, public=True)
.order_by('name')
.values('name', 'id'))
base_query = Model.objects.filter(domain=domain, public=True)

representative_groups = [
Model.Group.REFERENCE,
Model.Group.TOP10_2024,
Model.Group.BEST_NEURAL,
Model.Group.BEST_BEHAVIORAL,
Model.Group.GLOBAL_SCORE,
]

representative_models = (base_query
.filter(group__in=representative_groups)
.order_by('name')
.values('name', 'id'))

other_models = (base_query
.filter(group__isnull=True)
.order_by('name')
.values('name', 'id'))

total_model_count = base_query.count()

benchmarks = (BenchmarkInstance.objects
.filter(benchmark_type__domain=domain, benchmark_type__visible=True)
.order_by('benchmark_type__identifier', '-version')
.distinct('benchmark_type__identifier')
.values('id', 'benchmark_type__identifier', 'version'))
context = {'domain': domain, 'models': models, 'benchmarks': benchmarks}

context = {
'domain': domain,
'representative_models': representative_models,
'other_models': other_models,
'total_model_count': total_model_count,
'benchmarks': benchmarks,
}
return render(request, 'benchmarks/explore.html', context)
13 changes: 11 additions & 2 deletions benchmarks/views/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numpy as np
from django.shortcuts import render

from ..models import Model
from ..utils import cache_get_context, cache_page_for_public_only
from .index import get_context, get_datetime_range

Expand Down Expand Up @@ -235,6 +236,12 @@ def get_ag_grid_context(user=None, domain="vision", benchmark_filter=None, model

benchmark_metadata_list.append(metadata_entry)

# Build a lookup for model group membership (group field lives on brainscore_model)
model_ids = [m.model_id for m in context['models']]
group_lookup = dict(
Model.objects.filter(id__in=model_ids).values_list('id', 'group')
)

# Build `row_data` from materialized-view models WITH metadata
row_data = []
for model in context['models']:
Expand Down Expand Up @@ -273,7 +280,8 @@ def get_ag_grid_context(user=None, domain="vision", benchmark_filter=None, model
'model_size_mb': meta.get('model_size_mb', 0),
'runnable': meta.get('runnable', False),
'training_dataset': meta.get('training_dataset', ''),
'task_specialization': meta.get('task_specialization', '')
'task_specialization': meta.get('task_specialization', ''),
'group': group_lookup.get(model.model_id)
}

# Collect values for filter options
Expand Down Expand Up @@ -349,7 +357,8 @@ def get_ag_grid_context(user=None, domain="vision", benchmark_filter=None, model
'model_size_mb': 0,
'runnable': False,
'training_dataset': '',
'task_specialization': ''
'task_specialization': '',
'group': group_lookup.get(model.model_id)
}

# Add metadata to row data
Expand Down
5 changes: 4 additions & 1 deletion static/benchmarks/css/components/tooltip.sass
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
border-radius: 4px
font-size: 0.875rem
font-weight: 500
white-space: nowrap
white-space: normal
max-width: 300px
line-height: 1.4
opacity: 0
animation: tooltipFadeIn 0.2s ease-out forwards
position: fixed
z-index: 10000
pointer-events: none

// Tooltip arrow
&::after
Expand Down
49 changes: 39 additions & 10 deletions static/benchmarks/css/leaderboard/components/_cells.sass
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,54 @@
font-style: italic

// ======================
// RUNNABLE STATUS CELL
// INLINE RUNNABLE ICON (in model cell)
// ======================
.ag-cell[col-id="runnable_status"]
.model-name-row
display: flex
align-items: center
gap: 6px
max-width: 100%

a
white-space: nowrap
overflow: hidden
text-overflow: ellipsis
flex-shrink: 1
min-width: 0

.runnable-inline-icon
display: inline-block
width: 8px
height: 8px
border-radius: 50%
flex-shrink: 0

&.runnable-inline-green
background-color: #28a745

&.runnable-inline-red
background-color: #dc3545

&.runnable-inline-grey
background-color: #6c757d

// ======================
// GROUP STATUS CELL
// ======================
.ag-cell[col-id="group_status"]
display: flex
justify-content: center
align-items: center
height: 100%

.runnable-status-cell
.group-status-cell
display: flex
justify-content: center
align-items: center
height: 100%
pointer-events: auto

.runnable-status-icon
.group-status-icon
width: 12px
height: 12px
border-radius: 50%
Expand All @@ -71,13 +103,10 @@
z-index: 1
pointer-events: auto

&.runnable-green
background-color: #28a745

&.runnable-red
background-color: #dc3545
&.group-blue
background-color: $brainscore_blue

&.runnable-grey
&.group-grey
background-color: #6c757d

// ======================
Expand Down
Loading