Update env Space metadata
Browse files- Dockerfile +24 -24
- README.md +51 -51
- requirements.txt +6 -0
Dockerfile
CHANGED
|
@@ -1,24 +1,24 @@
|
|
| 1 |
-
# CERNenv environment Space (Docker, CPU)
|
| 2 |
-
FROM python:3.11-slim
|
| 3 |
-
|
| 4 |
-
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
-
PIP_NO_CACHE_DIR=1 \
|
| 6 |
-
PYTHONPATH=/home/user/app
|
| 7 |
-
|
| 8 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
-
git curl ca-certificates build-essential \
|
| 10 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
-
|
| 12 |
-
RUN useradd -ms /bin/bash user
|
| 13 |
-
USER user
|
| 14 |
-
WORKDIR /home/user/app
|
| 15 |
-
|
| 16 |
-
COPY --chown=user:user space/env/requirements.txt /
|
| 17 |
-
RUN python -m pip install --upgrade pip && \
|
| 18 |
-
python -m pip install --user -r /
|
| 19 |
-
|
| 20 |
-
COPY --chown=user:user . /home/user/app
|
| 21 |
-
|
| 22 |
-
EXPOSE 7860
|
| 23 |
-
|
| 24 |
-
CMD ["python", "-m", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# CERNenv environment Space (Docker, CPU)
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
+
PIP_NO_CACHE_DIR=1 \
|
| 6 |
+
PYTHONPATH=/home/user/app
|
| 7 |
+
|
| 8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
+
git curl ca-certificates build-essential \
|
| 10 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
+
|
| 12 |
+
RUN useradd -ms /bin/bash user
|
| 13 |
+
USER user
|
| 14 |
+
WORKDIR /home/user/app
|
| 15 |
+
|
| 16 |
+
COPY --chown=user:user space/env/requirements.txt /home/user/app/space-env-requirements.txt
|
| 17 |
+
RUN python -m pip install --upgrade pip && \
|
| 18 |
+
python -m pip install --user -r /home/user/app/space-env-requirements.txt
|
| 19 |
+
|
| 20 |
+
COPY --chown=user:user . /home/user/app
|
| 21 |
+
|
| 22 |
+
EXPOSE 7860
|
| 23 |
+
|
| 24 |
+
CMD ["python", "-m", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
|
@@ -1,51 +1,51 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: CERNenv
|
| 3 |
-
emoji: ⚛️
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: docker
|
| 7 |
-
suggested_hardware: cpu-basic
|
| 8 |
-
pinned: false
|
| 9 |
-
license: bsd-3-clause
|
| 10 |
-
short_description: LHC particle-discovery RL environment
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# CERNenv — LHC Discovery RL Environment
|
| 14 |
-
|
| 15 |
-
OpenEnv-compatible reinforcement-learning environment that simulates an
|
| 16 |
-
LHC (Large Hadron Collider) analysis. An LLM (Large Language Model) agent
|
| 17 |
-
configures the beam, allocates luminosity, picks a decay channel and
|
| 18 |
-
trigger, runs reconstruction, fits an invariant-mass spectrum, estimates
|
| 19 |
-
significance, and finally submits a structured discovery claim that is
|
| 20 |
-
graded against a hidden ground-truth particle.
|
| 21 |
-
|
| 22 |
-
The Space exposes the standard OpenEnv HTTP + WebSocket API:
|
| 23 |
-
|
| 24 |
-
* `GET /health` — liveness
|
| 25 |
-
* `GET /schema` — action / observation / state JSON schemas
|
| 26 |
-
* `POST /reset` — start a new episode (`{ "seed": 7, "scenario": "easy_diphoton_160" }`)
|
| 27 |
-
* `POST /step` — execute one action
|
| 28 |
-
* `GET /state` — current `CernState`
|
| 29 |
-
* `WS /ws` — persistent session (recommended for multi-step rollouts)
|
| 30 |
-
|
| 31 |
-
## Quickstart (Python client)
|
| 32 |
-
|
| 33 |
-
```python
|
| 34 |
-
import asyncio
|
| 35 |
-
from openenv.core import EnvClient
|
| 36 |
-
from huggingface_hub import constants
|
| 37 |
-
|
| 38 |
-
# replace with your space id
|
| 39 |
-
SPACE = "YOUR_HF_USERNAME/cernenv"
|
| 40 |
-
|
| 41 |
-
# (option A) connect to the running Space directly
|
| 42 |
-
import websockets
|
| 43 |
-
async def main():
|
| 44 |
-
async with EnvClient.from_env(SPACE) as env: # uses websockets under the hood
|
| 45 |
-
result = await env.reset(seed=7, scenario="easy_diphoton_160")
|
| 46 |
-
...
|
| 47 |
-
|
| 48 |
-
asyncio.run(main())
|
| 49 |
-
```
|
| 50 |
-
|
| 51 |
-
For training, see the companion **CERNenv Trainer** Space.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: CERNenv
|
| 3 |
+
emoji: ⚛️
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
suggested_hardware: cpu-basic
|
| 8 |
+
pinned: false
|
| 9 |
+
license: bsd-3-clause
|
| 10 |
+
short_description: LHC particle-discovery RL environment
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# CERNenv — LHC Discovery RL Environment
|
| 14 |
+
|
| 15 |
+
OpenEnv-compatible reinforcement-learning environment that simulates an
|
| 16 |
+
LHC (Large Hadron Collider) analysis. An LLM (Large Language Model) agent
|
| 17 |
+
configures the beam, allocates luminosity, picks a decay channel and
|
| 18 |
+
trigger, runs reconstruction, fits an invariant-mass spectrum, estimates
|
| 19 |
+
significance, and finally submits a structured discovery claim that is
|
| 20 |
+
graded against a hidden ground-truth particle.
|
| 21 |
+
|
| 22 |
+
The Space exposes the standard OpenEnv HTTP + WebSocket API:
|
| 23 |
+
|
| 24 |
+
* `GET /health` — liveness
|
| 25 |
+
* `GET /schema` — action / observation / state JSON schemas
|
| 26 |
+
* `POST /reset` — start a new episode (`{ "seed": 7, "scenario": "easy_diphoton_160" }`)
|
| 27 |
+
* `POST /step` — execute one action
|
| 28 |
+
* `GET /state` — current `CernState`
|
| 29 |
+
* `WS /ws` — persistent session (recommended for multi-step rollouts)
|
| 30 |
+
|
| 31 |
+
## Quickstart (Python client)
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
import asyncio
|
| 35 |
+
from openenv.core import EnvClient
|
| 36 |
+
from huggingface_hub import constants
|
| 37 |
+
|
| 38 |
+
# replace with your space id
|
| 39 |
+
SPACE = "YOUR_HF_USERNAME/cernenv"
|
| 40 |
+
|
| 41 |
+
# (option A) connect to the running Space directly
|
| 42 |
+
import websockets
|
| 43 |
+
async def main():
|
| 44 |
+
async with EnvClient.from_env(SPACE) as env: # uses websockets under the hood
|
| 45 |
+
result = await env.reset(seed=7, scenario="easy_diphoton_160")
|
| 46 |
+
...
|
| 47 |
+
|
| 48 |
+
asyncio.run(main())
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
For training, see the companion **CERNenv Trainer** Space.
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
numpy>=1.24.0
|
| 2 |
+
scipy>=1.10.0
|
| 3 |
+
pydantic>=2.0.0
|
| 4 |
+
fastapi>=0.110.0
|
| 5 |
+
uvicorn>=0.27.0
|
| 6 |
+
openenv-core[core]>=0.2.3
|