Download flora_studio_entry.py from finerobotics/annotation-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/spaces/finerobotics/annotation-studio/resolve/main/flora_studio_entry.py
- Command line
-
hf download hf://spaces/finerobotics/annotation-studio/flora_studio_entry.py
-
curl -L -o flora_studio_entry.py https://huggingface.co/spaces/finerobotics/annotation-studio/resolve/main/flora_studio_entry.py
1.66 kB
| """Run the validated worker from Studio's image using its isolated CUDA environment.""" | |
| import hashlib | |
| import json | |
| import os | |
| import tempfile | |
| from pathlib import Path | |
| def verify_runtime(): | |
| from flora_acceleration import require_fast_kernels | |
| versions = require_fast_kernels() | |
| if versions != json.loads(os.environ["FLORA_EXPECTED_KERNELS"]): | |
| raise RuntimeError("Studio's CUDA dependency versions differ from the validated Flora runtime") | |
| files = { | |
| **json.loads(os.environ["FLORA_EXPECTED_CODE"]), | |
| **json.loads(os.environ["FLORA_EXPECTED_RUNTIME_FILES"]), | |
| } | |
| for name, expected in files.items(): | |
| if ( | |
| Path(name).name != name | |
| or hashlib.sha256(Path(__file__).with_name(name).read_bytes()).hexdigest() != expected | |
| ): | |
| raise RuntimeError("Studio's Flora runtime differs from its validated source") | |
| return versions | |
| def main(): | |
| versions = verify_runtime() | |
| if os.environ.get("FLORA_SMOKE_ONLY") == "1": | |
| from flora_vision import verify_cuda_batching | |
| with tempfile.TemporaryDirectory(dir="/workspace") as folder: | |
| Path(folder, "writable").write_text("ok") | |
| print( | |
| json.dumps( | |
| { | |
| "event": "integrated_flora_smoke", | |
| "kernels": versions, | |
| "cuda_attention": verify_cuda_batching(), | |
| "workspace_writable": True, | |
| } | |
| ), | |
| flush=True, | |
| ) | |
| return | |
| from flora_speed_entry import main as run_validated_worker | |
| run_validated_worker() | |
| if __name__ == "__main__": | |
| main() | |