Download flora_speed_entry.py from finerobotics/annotation-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.33 kB
-
https://huggingface.co/spaces/finerobotics/annotation-studio/resolve/main/flora_speed_entry.py
- Command line
-
hf download hf://spaces/finerobotics/annotation-studio/flora_speed_entry.py
-
curl -L -o flora_speed_entry.py https://huggingface.co/spaces/finerobotics/annotation-studio/resolve/main/flora_speed_entry.py
1.33 kB
| """GPU benchmark entry: validate code identity before loading weights or writing data.""" | |
| import hashlib | |
| import json | |
| import os | |
| import time | |
| from pathlib import Path | |
| def main(): | |
| folder = Path(__file__).parent | |
| for name, expected in json.loads(os.environ["FLORA_EXPECTED_CODE"]).items(): | |
| if Path(name).name != name or hashlib.sha256((folder / name).read_bytes()).hexdigest() != expected: | |
| raise RuntimeError("Flora image differs from the approved benchmark code") | |
| if os.environ.get("FLORA_EXECUTION") != "accelerated": | |
| raise RuntimeError("Benchmark must use the explicit accelerated profile") | |
| if os.environ.get("FLORA_VISION_FRAME_BATCHING") == "1": | |
| from flora_vision import verify_cuda_batching | |
| print( | |
| "FLORA_RUNTIME " + json.dumps({"event": "vision_sdpa_cuda_check", **verify_cuda_batching()}), | |
| flush=True, | |
| ) | |
| os.environ["ANNOTATION_DEADLINE_EPOCH"] = str(time.time() + int(os.environ["FLORA_RUNTIME_SECONDS"]) - 60) | |
| from worker import run | |
| manifest = json.loads(os.environ["ANNOTATION_MANIFEST"]) | |
| if manifest["provider_required"] or manifest["features"] != ["Subtasks"]: | |
| raise RuntimeError("Speed benchmark must be independent native Flora subtasks") | |
| run(manifest) | |
| if __name__ == "__main__": | |
| main() | |