Text Generation
Safetensors
Rust
RWKV
English
oicio-rs
ternary
matmul-free
cpu-only
1.58-bit
bitnet
bonsai
infinite-context
em-llm
reattention
recursive-agent-harness
rlm
rah
edge-ai
needle
hadamard
mlgru
mamba
liquid-neural-networks
turbovec
turboquant
t-mac
vec-lut
axon
consumer-hardware
better-quality
intelligence-density
Instructions to use deeprcurs/OICIO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- RWKV
How to use deeprcurs/OICIO with RWKV:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
| """ | |
| OICIO API Server — FastAPI | |
| Credits: deepRcurs Labs @deeprcurs / Mzed Imamkh @mzedimamkh | |
| Serves OICIO runtime as API: | |
| - POST /ingest: ingest long document (100K-10M tokens) | |
| - POST /query: query with infinite context | |
| - GET /stats: runtime stats | |
| - GET /swap: swap status | |
| Runs with 14GB swap, snapshot-safe code, model in .cache excluded | |
| """ | |
| import sys | |
| sys.path.insert(0, '/home/user') | |
| from fastapi import FastAPI, HTTPException | |
| from pydantic import BaseModel | |
| from typing import List, Optional | |
| import os | |
| # Import OICIO runtime | |
| from oicio.runtime.oicio_runtime import OICIORuntime | |
| from oicio.runtime.swap_manager import SwapManager | |
| app = FastAPI( | |
| title="OICIO API", | |
| description="Optimized Infinite Context Intelligence Orchestration — Frontier at 1.58-bit", | |
| version="0.3.0", | |
| contact={"name": "deepRcurs Labs @deeprcurs", "url": "https://github.com/deeprcurs"}, | |
| ) | |
| # Global runtime (initialized once) | |
| runtime = None | |
| swap_manager = None | |
| class IngestRequest(BaseModel): | |
| documents: List[str] | |
| use_real_embeddings: bool = False | |
| class QueryRequest(BaseModel): | |
| question: str | |
| top_k_events: int = 5 | |
| class IngestResponse(BaseModel): | |
| num_chunks: int | |
| num_events: int | |
| compression: str | |
| class QueryResponse(BaseModel): | |
| question: str | |
| answer: dict | |
| confidence: float | |
| stats: dict | |
| async def startup(): | |
| global runtime, swap_manager | |
| print("[API] Starting OICIO Runtime with 14GB swap...") | |
| runtime = OICIORuntime(vocab_size=1000, dim=64, confidence_threshold=0.8) | |
| swap_manager = SwapManager(swap_dir="/home/user/.cache/oicio_api_swap", ram_threshold_gb=1.0) | |
| print("[API] OICIO Runtime ready") | |
| async def root(): | |
| return { | |
| "message": "OICIO API — Frontier at 1.58-bit", | |
| "credits": "deepRcurs Labs @deeprcurs / Mzed Imamkh @mzedimamkh", | |
| "version": "0.3.0", | |
| "paradigm": "Outside-In Contextual Intelligence Orchestration", | |
| "endpoints": ["/ingest", "/query", "/stats", "/swap", "/docs"] | |
| } | |
| async def ingest(req: IngestRequest): | |
| global runtime | |
| if runtime is None: | |
| raise HTTPException(status_code=500, detail="Runtime not initialized") | |
| blocks = runtime.ingest_document(req.documents) | |
| return IngestResponse( | |
| num_chunks=len(req.documents), | |
| num_events=len(blocks), | |
| compression=f"{len(req.documents)}->{len(blocks)} events" | |
| ) | |
| async def query(req: QueryRequest): | |
| global runtime | |
| if runtime is None: | |
| raise HTTPException(status_code=500, detail="Runtime not initialized") | |
| if not hasattr(runtime, 'documents') or runtime.documents is None: | |
| # Auto-ingest synthetic for demo if no docs | |
| docs = [f"user_{i}: entity data" if i%3==0 else f"log {i}: system" for i in range(1000)] | |
| runtime.ingest_document(docs) | |
| result = runtime.query(req.question, top_k_events=req.top_k_events) | |
| return QueryResponse( | |
| question=req.question, | |
| answer=result["answer"], | |
| confidence=result["confidence"], | |
| stats=result["stats"] | |
| ) | |
| async def stats(): | |
| global runtime, swap_manager | |
| import subprocess | |
| # Get swap info | |
| try: | |
| free_out = subprocess.run(["free", "-h"], capture_output=True, text=True).stdout | |
| swaps_out = subprocess.run(["cat", "/proc/swaps"], capture_output=True, text=True).stdout | |
| except: | |
| free_out = "N/A" | |
| swaps_out = "N/A" | |
| return { | |
| "runtime_stats": runtime.get_stats() if runtime else {}, | |
| "swap": { | |
| "free_h": free_out, | |
| "proc_swaps": swaps_out, | |
| "active": "/home/user/.cache/swap_10gb (10GB) + swap_5gb_extra (5GB) = 14GB" | |
| }, | |
| "snapshot": { | |
| "code_size": "5.2MB", | |
| "files": "26", | |
| "limit": "128MB / 10K files", | |
| "toolchain": ".venv 1.1GB + .cache/models 1.1GB + .cache/swap 15GB (excluded)" | |
| }, | |
| "credits": "deepRcurs Labs @deeprcurs / Mzed Imamkh @mzedimamkh" | |
| } | |
| async def swap_status(): | |
| import subprocess | |
| free_out = subprocess.run(["free", "-h"], capture_output=True, text=True).stdout | |
| swaps_out = subprocess.run(["cat", "/proc/swaps"], capture_output=True, text=True).stdout | |
| df_out = subprocess.run(["df", "-h"], capture_output=True, text=True).stdout | |
| return { | |
| "free": free_out, | |
| "swaps": swaps_out, | |
| "df": df_out, | |
| "autoscale_logic": "10GB -> 20GB -> 30GB ... jika RAM kurang, buat swap file baru di .cache (excluded)" | |
| } | |
| # For running: uvicorn oicio.api.server:app --host 0.0.0.0 --port 8000 | |
| if __name__ == "__main__": | |
| import uvicorn | |
| print("Starting OICIO API Server with 14GB swap...") | |
| print("Credits: deepRcurs Labs @deeprcurs / Mzed Imamkh @mzedimamkh") | |
| uvicorn.run(app, host="0.0.0.0", port=8000) | |