Emma Scharfmann commited on
Commit
1c77408
Β·
1 Parent(s): e482586
Files changed (3) hide show
  1. .gradio/certificate.pem +31 -0
  2. app.py +10 -3
  3. requirements.txt +10 -6
.gradio/certificate.pem ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
3
+ TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
4
+ cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
5
+ WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
6
+ ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
7
+ MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
8
+ h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
9
+ 0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
10
+ A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
11
+ T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
12
+ B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
13
+ B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
14
+ KBds0p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/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
30
+ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
31
+ -----END CERTIFICATE-----
app.py CHANGED
@@ -19,7 +19,6 @@ import numpy as np
19
  import gradio as gr
20
  import spaces
21
 
22
-
23
  # ── Lazy imports so Gradio loads even before heavy deps are installed ──────────
24
 
25
  def _import_deps():
@@ -106,15 +105,18 @@ def _get_open_data(ekd, ekr, date, param, levelist=[], **kwargs):
106
  @spaces.GPU
107
  def run_forecast(lead_time: int, num_chunks: int, progress=gr.Progress(track_tqdm=True)):
108
  """Download ICs, run AIFS, return status message."""
 
109
  global _runner, _states
110
 
111
- torch, ekd, ekr, SimpleRunner, OpendataClient, plt, ccrs, cfeature, tri = _import_deps()
112
 
 
 
113
  # GPU check
114
  if not torch.cuda.is_available():
115
  return "❌ No CUDA GPU detected. This model requires an Ampere GPU (e.g. Colab L4/A100).", gr.update(choices=[])
116
 
117
  major, _ = torch.cuda.get_device_capability(0)
 
118
  if major < 8:
119
  gpu = torch.cuda.get_device_name(0)
120
  return f"❌ GPU '{gpu}' is below Ampere (compute capability < 8.0). FlashAttention requires Ampere or newer.", gr.update(choices=[])
@@ -171,7 +173,12 @@ def run_forecast(lead_time: int, num_chunks: int, progress=gr.Progress(track_tqd
171
  # Load runner (cache it)
172
  yield "πŸ€– Loading AIFS Single v2 checkpoint from Hugging Face…", gr.update(choices=[])
173
  if _runner is None:
174
- _runner = SimpleRunner(CHECKPOINT)
 
 
 
 
 
175
 
176
  # Run inference
177
  _states = []
 
19
  import gradio as gr
20
  import spaces
21
 
 
22
  # ── Lazy imports so Gradio loads even before heavy deps are installed ──────────
23
 
24
  def _import_deps():
 
105
  @spaces.GPU
106
  def run_forecast(lead_time: int, num_chunks: int, progress=gr.Progress(track_tqdm=True)):
107
  """Download ICs, run AIFS, return status message."""
108
+
109
  global _runner, _states
110
 
 
111
 
112
+ torch, ekd, ekr, SimpleRunner, OpendataClient, plt, ccrs, cfeature, tri = _import_deps()
113
+ print("1")
114
  # GPU check
115
  if not torch.cuda.is_available():
116
  return "❌ No CUDA GPU detected. This model requires an Ampere GPU (e.g. Colab L4/A100).", gr.update(choices=[])
117
 
118
  major, _ = torch.cuda.get_device_capability(0)
119
+ print("2")
120
  if major < 8:
121
  gpu = torch.cuda.get_device_name(0)
122
  return f"❌ GPU '{gpu}' is below Ampere (compute capability < 8.0). FlashAttention requires Ampere or newer.", gr.update(choices=[])
 
173
  # Load runner (cache it)
174
  yield "πŸ€– Loading AIFS Single v2 checkpoint from Hugging Face…", gr.update(choices=[])
175
  if _runner is None:
176
+ #_runner = SimpleRunner(CHECKPOINT)
177
+ # Override the attention implementation to avoid flash-attn
178
+ _runner = SimpleRunner(
179
+ CHECKPOINT,
180
+ overrides={"model.processor.attention_implementation": "scaled_dot_product_attention"}
181
+ )
182
 
183
  # Run inference
184
  _states = []
requirements.txt CHANGED
@@ -1,15 +1,12 @@
1
- # spaces must be installed for ZeroGPU
2
  spaces
3
 
4
- # torch first β€” flash-attn depends on it at build time
5
  torch==2.11.0
6
  torch-geometric==2.6.1
7
 
8
  # flash-attn pre-built wheel matching the HF Space environment exactly:
9
  # Python 3.12 | CUDA 13.0 | torch 2.11 | CXX11 ABI True
10
- flash-attn @ https://github.com/lesj0610/flash-attention/releases/download/v2.8.3-cu12-torch2.11/flash_attn-2.8.3+cu12torch2.11cxx11abiTRUE-cp312-cp312-linux_x86_64.whl
11
 
12
- # AIFS / anemoi stack
13
  anemoi-inference[huggingface]==0.8.3
14
  anemoi-models==0.9.3
15
  anemoi-utils==0.4.35.post3
@@ -17,7 +14,14 @@ earthkit-regrid==0.5.1
17
  ecmwf-opendata==0.3.29
18
  earthkit-data<1.0.0
19
 
20
- # Plotting
21
  gradio
22
  matplotlib
23
- cartopy
 
 
 
 
 
 
 
 
 
 
1
  spaces
2
 
 
3
  torch==2.11.0
4
  torch-geometric==2.6.1
5
 
6
  # flash-attn pre-built wheel matching the HF Space environment exactly:
7
  # Python 3.12 | CUDA 13.0 | torch 2.11 | CXX11 ABI True
8
+ #flash-attn @ https://github.com/lesj0610/flash-attention/releases/download/v2.8.3-cu12-torch2.11/flash_attn-2.8.3+cu12torch2.11cxx11abiTRUE-cp312-cp312-linux_x86_64.whl
9
 
 
10
  anemoi-inference[huggingface]==0.8.3
11
  anemoi-models==0.9.3
12
  anemoi-utils==0.4.35.post3
 
14
  ecmwf-opendata==0.3.29
15
  earthkit-data<1.0.0
16
 
 
17
  gradio
18
  matplotlib
19
+ cartopy
20
+
21
+ # HF Space environment config:
22
+ # Python: 3.12.12 (main, Feb 24 2026, 21:49:09) [GCC 14.2.0]
23
+ #Platform: Linux-6.12.80-106.156.amzn2023.x86_64-x86_64-with-glibc2.41
24
+ #Torch: 2.11.0+cu130
25
+ #CUDA: 13.0
26
+ #CXX11 ABI: True
27
+ #GPU: NVIDIA RTX PRO 6000 Blackwell Server Edition