Spaces:
Sleeping
Sleeping
File size: 5,164 Bytes
1070692 127c41d f83fa62 99351a1 f83fa62 134e659 ed922f9 134e659 ed922f9 f83fa62 99351a1 f83fa62 99351a1 f83fa62 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
import os
from huggingface_hub import HfApi
PROBLEM_TYPES = ["unconditional", "conditional"]
TOKEN = os.environ.get("HF_TOKEN")
CACHE_PATH=os.getenv("HF_HOME", ".")
API = HfApi(token=TOKEN)
organization="LeMaterial"
submissions_repo = f'{organization}/lemat-gen-bench-submissions'
results_repo = f'{organization}/lemat-genbench-results'
# Column display names mapping
COLUMN_DISPLAY_NAMES = {
'model_name': 'Model',
'n_structures': 'Total Structures',
# Validity metrics
'overall_valid_count': 'Valid',
'charge_neutral_count': 'Charge Neutral',
'distance_valid_count': 'Distance Valid',
'plausibility_valid_count': 'Plausibility Valid',
# Uniqueness and Novelty
'unique_count': 'Unique',
'novel_count': 'Novel',
# Energy-based metrics
'mean_formation_energy': 'Formation Energy (eV)',
'formation_energy_std': 'Formation Energy Std',
'stability_mean_above_hull': 'E Above Hull (eV)',
'stability_std_e_above_hull': 'E Above Hull Std',
'mean_relaxation_RMSD': 'Relaxation RMSD (Γ
)',
'relaxation_RMSE_std': 'Relaxation RMSD Std',
# Stability metrics
'stable_count': 'Stable',
'unique_in_stable_count': 'Unique in Stable',
'sun_count': 'SUN',
# Metastability metrics
'metastable_count': 'Metastable',
'unique_in_metastable_count': 'Unique in Metastable',
'msun_count': 'MSUN',
# Distribution metrics
'JSDistance': 'JS Distance',
'MMD': 'MMD',
'FrechetDistance': 'FID',
# Diversity metrics
'element_diversity': 'Element Diversity',
'space_group_diversity': 'Space Group Diversity',
'site_diversity': 'Atomic Site Diversity',
'physical_size_diversity': 'Crystal Size Diversity',
# HHI metrics
'hhi_production_mean': 'HHI Production',
'hhi_reserve_mean': 'HHI Reserve',
'hhi_combined_mean': 'HHI Combined',
}
# Metrics that can be shown as percentages (count-based metrics)
COUNT_BASED_METRICS = [
'overall_valid_count',
'charge_neutral_count',
'distance_valid_count',
'plausibility_valid_count',
'unique_count',
'novel_count',
'stable_count',
'unique_in_stable_count',
'sun_count',
'metastable_count',
'unique_in_metastable_count',
'msun_count',
]
# Metric groups for organized display
METRIC_GROUPS = {
'Validity β': [
'overall_valid_count',
'charge_neutral_count',
'distance_valid_count',
'plausibility_valid_count',
],
'Uniqueness & Novelty β': [
'unique_count',
'novel_count',
],
'Energy Metrics β': [
'stability_mean_above_hull',
'stability_std_e_above_hull',
'mean_formation_energy',
'formation_energy_std',
'mean_relaxation_RMSD',
'relaxation_RMSE_std',
],
'Stability β': [
'stable_count',
'unique_in_stable_count',
'sun_count',
],
'Metastability β': [
'metastable_count',
'unique_in_metastable_count',
'msun_count',
],
'Distribution β': [
'JSDistance',
'MMD',
'FrechetDistance',
],
'Diversity β': [
'element_diversity',
'space_group_diversity',
'site_diversity',
'physical_size_diversity',
],
'HHI β': [
'hhi_production_mean',
'hhi_reserve_mean',
],
}
# Color coding for metric families (background colors with transparency)
METRIC_GROUP_COLORS = {
'Validity β': 'rgba(33, 150, 243, 0.15)', # Light blue with transparency
'Uniqueness & Novelty β': 'rgba(156, 39, 176, 0.15)', # Light purple with transparency
'Energy Metrics β': 'rgba(255, 152, 0, 0.15)', # Light orange with transparency
'Stability β': 'rgba(76, 175, 80, 0.15)', # Light green with transparency
'Metastability β': 'rgba(139, 195, 74, 0.15)', # Light lime with transparency
'Distribution β': 'rgba(233, 30, 99, 0.15)', # Light pink with transparency
'Diversity β': 'rgba(0, 188, 212, 0.15)', # Light cyan with transparency
'HHI β': 'rgba(255, 193, 7, 0.15)', # Light amber with transparency
}
# Map each column to its group for styling
def get_column_to_group_mapping():
"""Returns a dict mapping column names to their metric group."""
col_to_group = {}
for group_name, cols in METRIC_GROUPS.items():
for col in cols:
col_to_group[col] = group_name
return col_to_group
COLUMN_TO_GROUP = get_column_to_group_mapping()
# Compact view columns (most important metrics visible without scrolling)
COMPACT_VIEW_COLUMNS = [
'model_name',
'overall_valid_count',
'unique_count',
'novel_count',
'stable_count',
'metastable_count',
'sun_count',
'msun_count',
'stability_mean_above_hull',
'mean_formation_energy',
'mean_relaxation_RMSD',
]
# Full view columns (all metrics organized by groups)
FULL_VIEW_COLUMNS = ['model_name', 'n_structures']
for group_name, cols in METRIC_GROUPS.items():
FULL_VIEW_COLUMNS.extend(cols)
# Default columns for backward compatibility
DEFAULT_COLUMNS = COMPACT_VIEW_COLUMNS
|