Text Generation
Transformers
Safetensors
English
Hindi
llama
text-to-json
home-automation
tiny-model
from-scratch
experimental
edge-ai
conversational
text-generation-inference
Instructions to use sraivante/superfast-tiny-home-robotics-json-1m-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sraivante/superfast-tiny-home-robotics-json-1m-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sraivante/superfast-tiny-home-robotics-json-1m-v1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sraivante/superfast-tiny-home-robotics-json-1m-v1") model = AutoModelForCausalLM.from_pretrained("sraivante/superfast-tiny-home-robotics-json-1m-v1", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sraivante/superfast-tiny-home-robotics-json-1m-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sraivante/superfast-tiny-home-robotics-json-1m-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sraivante/superfast-tiny-home-robotics-json-1m-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sraivante/superfast-tiny-home-robotics-json-1m-v1
- SGLang
How to use sraivante/superfast-tiny-home-robotics-json-1m-v1 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "sraivante/superfast-tiny-home-robotics-json-1m-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sraivante/superfast-tiny-home-robotics-json-1m-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "sraivante/superfast-tiny-home-robotics-json-1m-v1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sraivante/superfast-tiny-home-robotics-json-1m-v1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sraivante/superfast-tiny-home-robotics-json-1m-v1 with Docker Model Runner:
docker model run hf.co/sraivante/superfast-tiny-home-robotics-json-1m-v1
Download training/audit_dataset.py from sraivante/superfast-tiny-home-robotics-json-1m-v1: direct link, hf CLI and curl.
- Browser
- Download file 4.05 kB
-
https://huggingface.co/sraivante/superfast-tiny-home-robotics-json-1m-v1/resolve/main/training/audit_dataset.py
- Command line
-
hf download hf://sraivante/superfast-tiny-home-robotics-json-1m-v1/training/audit_dataset.py
-
curl -L -o audit_dataset.py https://huggingface.co/sraivante/superfast-tiny-home-robotics-json-1m-v1/resolve/main/training/audit_dataset.py
4.05 kB
| """Stream the supplied file into a deduplicated SQLite audit; never alter the source.""" | |
| from collections import Counter | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| import re | |
| import sqlite3 | |
| import time | |
| import unicodedata | |
| SOURCE = Path("home-commands-3.4M.jsonl") | |
| OUT = Path("data") | |
| OUT.mkdir(exist_ok=True) | |
| db = sqlite3.connect(OUT / "audit.sqlite") | |
| db.execute("PRAGMA journal_mode=WAL") | |
| db.execute("PRAGMA synchronous=NORMAL") | |
| db.execute("CREATE TABLE IF NOT EXISTS examples (key TEXT PRIMARY KEY, instruction TEXT, output TEXT, line INTEGER, occurrences INTEGER NOT NULL DEFAULT 1)") | |
| if db.execute("SELECT COUNT(*) FROM examples").fetchone()[0]: | |
| raise SystemExit("Audit database already contains examples; refusing to mix snapshots") | |
| counts, fields, actions, activities, subjects, scripts = (Counter() for _ in range(6)) | |
| conflicts, invalid, sample = [], [], [] | |
| digest = hashlib.sha256() | |
| start = time.time() | |
| with SOURCE.open("rb") as stream: | |
| for line_no, raw in enumerate(stream, 1): | |
| digest.update(raw) | |
| if not raw.strip(): | |
| counts["blank"] += 1 | |
| continue | |
| try: | |
| row = json.loads(raw) | |
| assert isinstance(row["instruction"], str) and row["instruction"].strip() | |
| assert isinstance(row["output"], dict) | |
| text = row["instruction"] | |
| target = json.dumps(row["output"], ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False) | |
| key = re.sub(r"\s+", " ", unicodedata.normalize("NFKC", text)).strip().casefold() | |
| fields[",".join(sorted(row["output"]))] += 1 | |
| actions[str(row["output"].get("action"))] += 1 | |
| activities[str(row["output"].get("activity"))] += 1 | |
| subjects[str(row["output"].get("subject"))] += 1 | |
| scripts["devanagari" if any('\u0900' <= c <= '\u097f' for c in text) else "latin_or_other"] += 1 | |
| counts["rows"] += 1 | |
| counts["input_characters"] += len(text) | |
| counts["output_characters"] += len(target) | |
| if len(sample) < 25 or line_no % 200000 == 0: | |
| sample.append({"line": line_no, **row}) | |
| previous = db.execute("SELECT output FROM examples WHERE key=?", (key,)).fetchone() | |
| if previous: | |
| counts["normalized_duplicate_rows"] += 1 | |
| if previous[0] != target: | |
| counts["conflicting_rows"] += 1 | |
| if len(conflicts) < 30: | |
| conflicts.append({"line": line_no, "instruction": text, "first": json.loads(previous[0]), "other": row["output"]}) | |
| db.execute("UPDATE examples SET occurrences=occurrences+1 WHERE key=?", (key,)) | |
| else: | |
| db.execute("INSERT INTO examples(key,instruction,output,line) VALUES (?,?,?,?)", (key, text, target, line_no)) | |
| except (ValueError, KeyError, TypeError, AssertionError) as error: | |
| counts["invalid_rows"] += 1 | |
| if len(invalid) < 20: | |
| invalid.append({"line": line_no, "error": str(error)}) | |
| if line_no % 200000 == 0: | |
| db.commit() | |
| print(json.dumps({"rows": line_no, "elapsed_seconds": round(time.time()-start), "duplicates": counts["normalized_duplicate_rows"]}), flush=True) | |
| db.commit() | |
| counts["unique_normalized_inputs"] = db.execute("SELECT COUNT(*) FROM examples").fetchone()[0] | |
| report = {"source": str(SOURCE), "sha256": digest.hexdigest(), "bytes": SOURCE.stat().st_size, | |
| "counts": dict(counts), "output_field_sets": dict(fields), "actions": dict(actions), | |
| "activities": dict(activities), "subjects": dict(subjects), "scripts": dict(scripts), | |
| "conflict_examples": conflicts, "invalid_examples": invalid, "sample": sample, | |
| "elapsed_seconds": round(time.time()-start, 2)} | |
| (OUT / "source_audit.json").write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8") | |
| db.close() | |
| print(json.dumps({k:v for k,v in report.items() if k != "sample"}, ensure_ascii=True, indent=2), flush=True) | |