Download python_lora_dataset_builder/pipeline/audit.py from api-relay/sadASDasd: direct link, hf CLI and curl.
- Browser
- Download file 389 Bytes
-
https://huggingface.co/datasets/api-relay/sadASDasd/resolve/main/python_lora_dataset_builder/pipeline/audit.py
- Command line
-
hf download hf://datasets/api-relay/sadASDasd/python_lora_dataset_builder/pipeline/audit.py
-
curl -L -o audit.py https://huggingface.co/datasets/api-relay/sadASDasd/resolve/main/python_lora_dataset_builder/pipeline/audit.py
389 Bytes
| from __future__ import annotations | |
| import hashlib | |
| def deterministic_audit_selected(record_id: str, rate: float, minimum_counter: int = 0) -> bool: | |
| """Stable sampling: the same record always gets the same audit decision.""" | |
| if minimum_counter > 0: | |
| return True | |
| value = int(hashlib.sha256(record_id.encode()).hexdigest()[:12], 16) / float(16**12) | |
| return value < rate | |