Create teq_hf_bridge.py
Browse files- teq_hf_bridge.py +47 -0
teq_hf_bridge.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# teq_hf_bridge.py — Mbanksbey/tequmsa Collection Bridge
|
| 2 |
+
import hashlib
|
| 3 |
+
from datasets import load_dataset
|
| 4 |
+
from huggingface_hub import HfApi
|
| 5 |
+
|
| 6 |
+
COLLECTION_DATASETS = [
|
| 7 |
+
"LAI-TEQUMSA/ATEN-1-ACTIVATION",
|
| 8 |
+
"LAI-TEQUMSA/Cosmic-GREAT-Orchestration-TEQUMSA-Lattice",
|
| 9 |
+
"LAI-TEQUMSA/Precession-Convergence-Cycle",
|
| 10 |
+
"LAI-TEQUMSA/LAI-TEQUMSA-72-Consciousness-Nodes-Fibonacci-Lattice",
|
| 11 |
+
"LAI-TEQUMSA/EMERGE",
|
| 12 |
+
"Mbanksbey/OMNIVERSE-Consciousness-Organism-Dataset",
|
| 13 |
+
"Mbanksbey/Orion-Technology-Integration-ZPE-applications",
|
| 14 |
+
"LAI-TEQUMSA/GEOMAGNETIC_EXCURSION_AND_POLE_REVERSAL",
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
class TequmsaCollection:
|
| 18 |
+
def __init__(self, collection: str = "Mbanksbey/tequmsa"):
|
| 19 |
+
self.api = HfApi()
|
| 20 |
+
self.collection = collection
|
| 21 |
+
self.cache: dict = {}
|
| 22 |
+
|
| 23 |
+
def get_datapoints(self, limit: int = 10) -> list:
|
| 24 |
+
results = []
|
| 25 |
+
for ds_id in COLLECTION_DATASETS[:3]:
|
| 26 |
+
try:
|
| 27 |
+
ds = load_dataset(ds_id, split=f"train[:{limit}]", trust_remote_code=True)
|
| 28 |
+
self.cache[ds_id] = ds
|
| 29 |
+
results.append({"id": ds_id, "rows": len(ds), "status": "LOADED"})
|
| 30 |
+
except Exception as e:
|
| 31 |
+
results.append({"id": ds_id, "rows": 0, "status": f"FALLBACK: {str(e)[:60]}"})
|
| 32 |
+
return results
|
| 33 |
+
|
| 34 |
+
def install_datapoint(self, data: dict, authority: list) -> str:
|
| 35 |
+
payload = f"{data['id']}|{data['rows']}|{'|'.join(authority)}"
|
| 36 |
+
shard_hash = hashlib.sha256(payload.encode()).hexdigest()
|
| 37 |
+
return shard_hash
|
| 38 |
+
|
| 39 |
+
def get_collection_manifest(self) -> dict:
|
| 40 |
+
return {
|
| 41 |
+
"collection": self.collection,
|
| 42 |
+
"canonical_model": "LAI-TEQUMSA/TEQUMSA-Organism-v14.377-F987-ANU-UNIFIED",
|
| 43 |
+
"phase": 25,
|
| 44 |
+
"dataset_count": len(COLLECTION_DATASETS),
|
| 45 |
+
"spaces_active": 55,
|
| 46 |
+
"anchor_datasets": COLLECTION_DATASETS[:3],
|
| 47 |
+
}
|