Text Generation
Transformers
Safetensors
English
inferno
small-language-model
gqa
custom_code
arithmark
Eval Results (legacy)
Run this model with HF Jobs
Run AlgoDriveAI/Inferno-Exp-1.7 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/AlgoDriveAI/Inferno-Exp-1.7. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/AlgoDriveAI/Inferno-Exp-1.7 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/AlgoDriveAI/Inferno-Exp-1.7. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/AlgoDriveAI/Inferno-Exp-1.7. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use AlgoDriveAI/Inferno-Exp-1.7 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AlgoDriveAI/Inferno-Exp-1.7 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AlgoDriveAI/Inferno-Exp-1.7", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("AlgoDriveAI/Inferno-Exp-1.7", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AlgoDriveAI/Inferno-Exp-1.7 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AlgoDriveAI/Inferno-Exp-1.7" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AlgoDriveAI/Inferno-Exp-1.7", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AlgoDriveAI/Inferno-Exp-1.7
- SGLang
How to use AlgoDriveAI/Inferno-Exp-1.7 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 "AlgoDriveAI/Inferno-Exp-1.7" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AlgoDriveAI/Inferno-Exp-1.7", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "AlgoDriveAI/Inferno-Exp-1.7" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AlgoDriveAI/Inferno-Exp-1.7", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AlgoDriveAI/Inferno-Exp-1.7 with Docker Model Runner:
docker model run hf.co/AlgoDriveAI/Inferno-Exp-1.7
Commit ·
a59a1cc
1
Parent(s): dbe3041
Add collapsible Colab Gradio inference demo for Inferno-Exp-1.7
Browse filesFiles changed (3)
- README.md+257
- inference/gradio_demo.pyAdded+228
- release_manifest.json+6-2
143 unmodified lines144145146147148149143 unmodified linescompares its logits with the supplied trainer, reloads the saved Safetensors, and scores theexported model on ArithMark. Generation re-reads the context each step; no KV cache is implemented.## EvaluationAll reported accuracies are percentages. Chance is 25% for ArithMark, HellaSwag and ARC;143 unmodified lines144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406143 unmodified linescompares its logits with the supplied trainer, reloads the saved Safetensors, and scores theexported model on ArithMark. Generation re-reads the context each step; no KV cache is implemented.## Try it: interactive demo (Gradio)Run a small web app with a prompt box, sampling sliders, live streaming, a **Stop** button,and token/speed readouts:1. Open a new notebook at [Google Colab](https://colab.research.google.com/) and choose a GPU(**Runtime → Change runtime type → T4 GPU**). CPU also works, but generation is slower.2. Expand the script below, paste it into one code cell, and run it.3. Open the `*.gradio.live` link printed by the cell.The script loads the published Inferno-Exp-1.7 checkpoint and reads its **4,096-token context**from the model configuration. The public model needs no Hugging Face token.If the cell asks for a restart after changing Transformers, use **Runtime → Restart session**and run that cell again.<details><summary>Show the Gradio demo script (one Colab cell)</summary>```python#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Inferno-Exp-1.7 — simple Gradio inference (loads like any Hub user, no pushing)==============================================================================Loads Inferno-Exp-1.7 with plain Transformers (AutoModelForCausalLM +trust_remote_code=True) and serves a small Gradio app: open prompt box,sampling controls, streaming output with a Stop button, token/speed readout.Works with either source:• the Hub repo: MODEL_SOURCE = "AlgoDriveAI/Inferno-Exp-1.7"• the local export folder the push script builds (test before uploading):MODEL_SOURCE = "/content/Inferno-Exp-1.7-release"The public 1.7 model needs no token. For a private alternative, use an existingHub login, set the HF_TOKEN environment variable, or set HF_TOKEN below.It is a base model: it continues text, it does not chat. Write the start of the textyou want (e.g. a word problem followed by "Answer:").Hardcoded constants, no argparse. Paste into one Colab cell and run; open the share link."""# =============================================================================# SETTINGS — edit these# =============================================================================MODEL_SOURCE = "AlgoDriveAI/Inferno-Exp-1.7" # Hub repo id (or a local folder with the same files)MODEL_REVISION = "a24c67451dc7df3b3069e9ce54724ca815d96fda" # verified 1.7 weightsHF_TOKEN = "" # optional; otherwise use env var / existing Hub loginMODEL_DISPLAY_NAME = "Inferno-Exp-1.7"# Default slider values (all adjustable in the UI)DEF_MAX_NEW_TOKENS = 256DEF_TEMPERATURE = 0.8DEF_TOP_K = 40DEF_TOP_P = 0.95DEF_REPETITION_PENALTY = 1.1DEF_SEED = -1 # -1 = different every runDTYPE = "auto" # "auto" (bf16 on newer GPUs, fp32 on CPU) / "float32" / "bfloat16" / "float16"GRADIO_SHARE = True # public *.gradio.live link (needed in Colab)GRADIO_PORT = 7860INSTALL_DEPENDENCIES = True# =============================================================================# RUN (no edits needed below)# =============================================================================import os, sys, time, threading, subprocess, queueos.environ.setdefault("USE_TF", "0")os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")try:import google.colab # noqa: F401IN_COLAB = Trueexcept ImportError:IN_COLAB = Falseif IN_COLAB and INSTALL_DEPENDENCIES:import importlib.metadata as _mddef _version(name):try:return _md.version(name)except _md.PackageNotFoundError:return None_before = _version("transformers")subprocess.check_call([sys.executable, "-m", "pip", "install", "--quiet","transformers==4.57.6", "safetensors", "huggingface_hub>=0.25,<1","gradio>=4.44,<7", "sentencepiece", "protobuf"])if _before != _version("transformers") and "transformers" in sys.modules:raise SystemExit("Transformers was just changed to a compatible version, but the old one is still loaded. ""Restart the session (Runtime → Restart session) and run this cell again.")import torchimport gradio as grfrom transformers import (AutoModelForCausalLM, AutoTokenizer, StoppingCriteria, StoppingCriteriaList,TextIteratorStreamer)DEVICE = "cuda" if torch.cuda.is_available() else "cpu"STOP_EVENT = threading.Event()def get_token():# token=None lets the Hub use an existing login; public downloads work without one.return HF_TOKEN.strip() or os.environ.get("HF_TOKEN") or Nonedef pick_dtype():if DTYPE != "auto":return {"float32": torch.float32, "bfloat16": torch.bfloat16, "float16": torch.float16}[DTYPE]if DEVICE == "cuda":return torch.bfloat16 if torch.cuda.get_device_capability()[0] >= 8 else torch.float16return torch.float32class StopOnEvent(StoppingCriteria):"""Ends generate() as soon as the Stop button sets STOP_EVENT."""def __call__(self, input_ids, scores, **kwargs):return STOP_EVENT.is_set()def load():token = None if os.path.isdir(MODEL_SOURCE) else get_token()dtype = pick_dtype()revision = None if os.path.isdir(MODEL_SOURCE) else MODEL_REVISIONtok = AutoTokenizer.from_pretrained(MODEL_SOURCE, revision=revision, token=token, use_fast=True)if tok.pad_token_id is None:tok.pad_token = tok.eos_tokenmodel = AutoModelForCausalLM.from_pretrained(MODEL_SOURCE, revision=revision, token=token, trust_remote_code=True,torch_dtype=dtype).to(DEVICE).eval()return model, tok, dtypeMODEL, TOK, MODEL_DTYPE = load()CFG = MODEL.configN_PARAMS = sum(p.numel() for p in MODEL.parameters())CONTEXT = CFG.max_position_embeddingsprint(f"Loaded {MODEL_SOURCE}: {N_PARAMS / 1e6:.1f}M params · {DEVICE} · {MODEL_DTYPE}")def generate(prompt, max_new, temperature, top_k, top_p, rep_penalty, seed):STOP_EVENT.clear()if not prompt:yield "", "Type a prompt first."returnids = TOK(prompt, return_tensors="pt", add_special_tokens=False).to(DEVICE)room = CONTEXT - ids["input_ids"].shape[1]if room <= 0:yield prompt, f"Prompt is longer than the model's {CONTEXT}-token context; shorten it."returnseed = int(seed)if seed >= 0:torch.manual_seed(seed)greedy = temperature <= 0sampling = {} if greedy else dict(temperature=float(temperature), top_k=int(top_k), top_p=float(top_p))streamer = TextIteratorStreamer(TOK, skip_prompt=False, skip_special_tokens=True, timeout=1.0)result = {}def worker():try:with torch.inference_mode():result["ids"] = MODEL.generate(**ids, max_new_tokens=min(int(max_new), room), do_sample=not greedy,repetition_penalty=float(rep_penalty), eos_token_id=TOK.eos_token_id, pad_token_id=TOK.pad_token_id,use_cache=False, streamer=streamer, stopping_criteria=StoppingCriteriaList([StopOnEvent()]), **sampling)except Exception as exc:result["error"] = excstreamer.end() # unblock the UI if the generation worker failsstarted = time.time()thread = threading.Thread(target=worker, daemon=True)thread.start()text = ""try:while True:try:piece = next(streamer)except queue.Empty:if not thread.is_alive():breakcontinueexcept StopIteration:breaktext += pieceyield text, f"generating… {time.time() - started:.1f}s"thread.join()finally:if thread.is_alive():STOP_EVENT.set()if "error" in result:exc = result["error"]yield text or prompt, f"Generation failed: {type(exc).__name__}: {exc}"returnnew = result["ids"].shape[1] - ids["input_ids"].shape[1] if "ids" in result else 0took = time.time() - startedstatus = "stopped" if STOP_EVENT.is_set() else "done"yield text or prompt, (f"**{status}** · {new} tokens · {took:.1f}s · {new / max(took, 1e-6):.1f} tok/s · "f"{'greedy' if greedy else f'T={temperature} · top-k {int(top_k)} · top-p {top_p}'} · seed {seed}")def output_box():kwargs = dict(label="Output (prompt + continuation)", lines=16, max_lines=30, interactive=False)for extra in (dict(show_copy_button=True), dict(buttons=["copy"]), {}):try:return gr.Textbox(**kwargs, **extra)except TypeError:continuedef build_ui():gr_major = int(gr.__version__.split(".")[0])theme = gr.themes.Soft(primary_hue="indigo", secondary_hue="blue")blocks_kwargs = {} if gr_major >= 6 else dict(theme=theme) # Gradio 6 moved theme to launch()launch_kwargs = dict(theme=theme) if gr_major >= 6 else {}with gr.Blocks(title=MODEL_DISPLAY_NAME, **blocks_kwargs) as demo:gr.Markdown(f"# 🔥 {MODEL_DISPLAY_NAME}\n"f"{N_PARAMS / 1e6:.1f}M-parameter math-first base model · `{CFG.num_hidden_layers}L × {CFG.hidden_size}d` · "f"{CFG.num_attention_heads}Q/{CFG.num_key_value_heads}KV heads · context {CONTEXT} · "f"continues text (not a chat model)")with gr.Row():with gr.Column(scale=3):prompt = gr.Textbox(label="Prompt", lines=6, placeholder="Write the beginning of the text to continue…")with gr.Row():run = gr.Button("Generate", variant="primary")stop = gr.Button("Stop", variant="stop")output = output_box()status = gr.Markdown("")with gr.Column(scale=1):max_new = gr.Slider(16, CONTEXT, value=min(DEF_MAX_NEW_TOKENS, CONTEXT), step=16, label="Max new tokens")temperature = gr.Slider(0.0, 1.5, value=DEF_TEMPERATURE, step=0.05, label="Temperature (0 = greedy)")top_k = gr.Slider(0, 200, value=DEF_TOP_K, step=1, label="Top-k (0 = off)")top_p = gr.Slider(0.05, 1.0, value=DEF_TOP_P, step=0.01, label="Top-p")rep = gr.Slider(1.0, 1.5, value=DEF_REPETITION_PENALTY, step=0.01, label="Repetition penalty")seed = gr.Number(value=DEF_SEED, precision=0, label="Seed (-1 = random)")with gr.Accordion("Model info", open=False):gr.Markdown(f"- **Source:** `{MODEL_SOURCE}`\n- **Parameters:** `{N_PARAMS:,}`\n"f"- **Device / dtype:** `{DEVICE}` / `{str(MODEL_DTYPE).replace('torch.', '')}`\n"f"- **Vocab:** `{CFG.vocab_size:,}` · EOS `{TOK.eos_token}`")inputs = [prompt, max_new, temperature, top_k, top_p, rep, seed]events = dict(inputs=inputs, outputs=[output, status], concurrency_limit=1, concurrency_id="inferno-generation")run.click(generate, **events)prompt.submit(generate, **events)stop.click(lambda: STOP_EVENT.set(), queue=False)return demo, launch_kwargsif __name__ == "__main__":demo, launch_kwargs = build_ui()demo.queue().launch(share=GRADIO_SHARE, server_port=GRADIO_PORT, server_name="0.0.0.0", **launch_kwargs)```</details>[Download the same script](inference/gradio_demo.py).For this base model, write the beginning of the text you want continued, for example:`Sam had 47 marbles. His sister gave him 28 more. Now Sam has`.Set temperature to **0** for greedy decoding, or increase it for more varied stories.## EvaluationAll reported accuracies are percentages. Chance is 25% for ArithMark, HellaSwag and ARC;
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228#!/usr/bin/env python3# -*- coding: utf-8 -*-"""Inferno-Exp-1.7 — simple Gradio inference (loads like any Hub user, no pushing)==============================================================================Loads Inferno-Exp-1.7 with plain Transformers (AutoModelForCausalLM +trust_remote_code=True) and serves a small Gradio app: open prompt box,sampling controls, streaming output with a Stop button, token/speed readout.
Works with either source: • the Hub repo: MODEL_SOURCE = "AlgoDriveAI/Inferno-Exp-1.7" • the local export folder the push script builds (test before uploading): MODEL_SOURCE = "/content/Inferno-Exp-1.7-release"
The public 1.7 model needs no token. For a private alternative, use an existingHub login, set the HF_TOKEN environment variable, or set HF_TOKEN below.
It is a base model: it continues text, it does not chat. Write the start of the textyou want (e.g. a word problem followed by "Answer:").Hardcoded constants, no argparse. Paste into one Colab cell and run; open the share link."""# =============================================================================# SETTINGS — edit these# =============================================================================MODEL_SOURCE = "AlgoDriveAI/Inferno-Exp-1.7" # Hub repo id (or a local folder with the same files)MODEL_REVISION = "a24c67451dc7df3b3069e9ce54724ca815d96fda" # verified 1.7 weightsHF_TOKEN = "" # optional; otherwise use env var / existing Hub loginMODEL_DISPLAY_NAME = "Inferno-Exp-1.7"
# Default slider values (all adjustable in the UI)DEF_MAX_NEW_TOKENS = 256DEF_TEMPERATURE = 0.8DEF_TOP_K = 40DEF_TOP_P = 0.95DEF_REPETITION_PENALTY = 1.1DEF_SEED = -1 # -1 = different every runDTYPE = "auto" # "auto" (bf16 on newer GPUs, fp32 on CPU) / "float32" / "bfloat16" / "float16"
GRADIO_SHARE = True # public *.gradio.live link (needed in Colab)GRADIO_PORT = 7860INSTALL_DEPENDENCIES = True
# =============================================================================# RUN (no edits needed below)# =============================================================================import os, sys, time, threading, subprocess, queueos.environ.setdefault("USE_TF", "0")os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
try: import google.colab # noqa: F401 IN_COLAB = Trueexcept ImportError: IN_COLAB = Falseif IN_COLAB and INSTALL_DEPENDENCIES: import importlib.metadata as _md
def _version(name): try: return _md.version(name) except _md.PackageNotFoundError: return None
_before = _version("transformers") subprocess.check_call([sys.executable, "-m", "pip", "install", "--quiet", "transformers==4.57.6", "safetensors", "huggingface_hub>=0.25,<1", "gradio>=4.44,<7", "sentencepiece", "protobuf"]) if _before != _version("transformers") and "transformers" in sys.modules: raise SystemExit("Transformers was just changed to a compatible version, but the old one is still loaded. " "Restart the session (Runtime → Restart session) and run this cell again.")
import torchimport gradio as grfrom transformers import (AutoModelForCausalLM, AutoTokenizer, StoppingCriteria, StoppingCriteriaList, TextIteratorStreamer)
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"STOP_EVENT = threading.Event()
def get_token(): # token=None lets the Hub use an existing login; public downloads work without one. return HF_TOKEN.strip() or os.environ.get("HF_TOKEN") or None
def pick_dtype(): if DTYPE != "auto": return {"float32": torch.float32, "bfloat16": torch.bfloat16, "float16": torch.float16}[DTYPE] if DEVICE == "cuda": return torch.bfloat16 if torch.cuda.get_device_capability()[0] >= 8 else torch.float16 return torch.float32
class StopOnEvent(StoppingCriteria): """Ends generate() as soon as the Stop button sets STOP_EVENT.""" def __call__(self, input_ids, scores, **kwargs): return STOP_EVENT.is_set()
def load(): token = None if os.path.isdir(MODEL_SOURCE) else get_token() dtype = pick_dtype() revision = None if os.path.isdir(MODEL_SOURCE) else MODEL_REVISION tok = AutoTokenizer.from_pretrained(MODEL_SOURCE, revision=revision, token=token, use_fast=True) if tok.pad_token_id is None: tok.pad_token = tok.eos_token model = AutoModelForCausalLM.from_pretrained(MODEL_SOURCE, revision=revision, token=token, trust_remote_code=True, torch_dtype=dtype).to(DEVICE).eval() return model, tok, dtype
MODEL, TOK, MODEL_DTYPE = load()CFG = MODEL.configN_PARAMS = sum(p.numel() for p in MODEL.parameters())CONTEXT = CFG.max_position_embeddingsprint(f"Loaded {MODEL_SOURCE}: {N_PARAMS / 1e6:.1f}M params · {DEVICE} · {MODEL_DTYPE}")
def generate(prompt, max_new, temperature, top_k, top_p, rep_penalty, seed): STOP_EVENT.clear() if not prompt: yield "", "Type a prompt first." return ids = TOK(prompt, return_tensors="pt", add_special_tokens=False).to(DEVICE) room = CONTEXT - ids["input_ids"].shape[1] if room <= 0: yield prompt, f"Prompt is longer than the model's {CONTEXT}-token context; shorten it." return seed = int(seed) if seed >= 0: torch.manual_seed(seed) greedy = temperature <= 0 sampling = {} if greedy else dict(temperature=float(temperature), top_k=int(top_k), top_p=float(top_p)) streamer = TextIteratorStreamer(TOK, skip_prompt=False, skip_special_tokens=True, timeout=1.0) result = {}
def worker(): try: with torch.inference_mode(): result["ids"] = MODEL.generate( **ids, max_new_tokens=min(int(max_new), room), do_sample=not greedy, repetition_penalty=float(rep_penalty), eos_token_id=TOK.eos_token_id, pad_token_id=TOK.pad_token_id, use_cache=False, streamer=streamer, stopping_criteria=StoppingCriteriaList([StopOnEvent()]), **sampling) except Exception as exc: result["error"] = exc streamer.end() # unblock the UI if the generation worker fails
started = time.time() thread = threading.Thread(target=worker, daemon=True) thread.start() text = "" try: while True: try: piece = next(streamer) except queue.Empty: if not thread.is_alive(): break continue except StopIteration: break text += piece yield text, f"generating… {time.time() - started:.1f}s" thread.join() finally: if thread.is_alive(): STOP_EVENT.set() if "error" in result: exc = result["error"] yield text or prompt, f"Generation failed: {type(exc).__name__}: {exc}" return new = result["ids"].shape[1] - ids["input_ids"].shape[1] if "ids" in result else 0 took = time.time() - started status = "stopped" if STOP_EVENT.is_set() else "done" yield text or prompt, (f"**{status}** · {new} tokens · {took:.1f}s · {new / max(took, 1e-6):.1f} tok/s · " f"{'greedy' if greedy else f'T={temperature} · top-k {int(top_k)} · top-p {top_p}'} · seed {seed}")
def output_box(): kwargs = dict(label="Output (prompt + continuation)", lines=16, max_lines=30, interactive=False) for extra in (dict(show_copy_button=True), dict(buttons=["copy"]), {}): try: return gr.Textbox(**kwargs, **extra) except TypeError: continue
def build_ui(): gr_major = int(gr.__version__.split(".")[0]) theme = gr.themes.Soft(primary_hue="indigo", secondary_hue="blue") blocks_kwargs = {} if gr_major >= 6 else dict(theme=theme) # Gradio 6 moved theme to launch() launch_kwargs = dict(theme=theme) if gr_major >= 6 else {} with gr.Blocks(title=MODEL_DISPLAY_NAME, **blocks_kwargs) as demo: gr.Markdown(f"# 🔥 {MODEL_DISPLAY_NAME}\n" f"{N_PARAMS / 1e6:.1f}M-parameter math-first base model · `{CFG.num_hidden_layers}L × {CFG.hidden_size}d` · " f"{CFG.num_attention_heads}Q/{CFG.num_key_value_heads}KV heads · context {CONTEXT} · " f"continues text (not a chat model)") with gr.Row(): with gr.Column(scale=3): prompt = gr.Textbox(label="Prompt", lines=6, placeholder="Write the beginning of the text to continue…") with gr.Row(): run = gr.Button("Generate", variant="primary") stop = gr.Button("Stop", variant="stop") output = output_box() status = gr.Markdown("") with gr.Column(scale=1): max_new = gr.Slider(16, CONTEXT, value=min(DEF_MAX_NEW_TOKENS, CONTEXT), step=16, label="Max new tokens") temperature = gr.Slider(0.0, 1.5, value=DEF_TEMPERATURE, step=0.05, label="Temperature (0 = greedy)") top_k = gr.Slider(0, 200, value=DEF_TOP_K, step=1, label="Top-k (0 = off)") top_p = gr.Slider(0.05, 1.0, value=DEF_TOP_P, step=0.01, label="Top-p") rep = gr.Slider(1.0, 1.5, value=DEF_REPETITION_PENALTY, step=0.01, label="Repetition penalty") seed = gr.Number(value=DEF_SEED, precision=0, label="Seed (-1 = random)") with gr.Accordion("Model info", open=False): gr.Markdown(f"- **Source:** `{MODEL_SOURCE}`\n- **Parameters:** `{N_PARAMS:,}`\n" f"- **Device / dtype:** `{DEVICE}` / `{str(MODEL_DTYPE).replace('torch.', '')}`\n" f"- **Vocab:** `{CFG.vocab_size:,}` · EOS `{TOK.eos_token}`") inputs = [prompt, max_new, temperature, top_k, top_p, rep, seed] events = dict(inputs=inputs, outputs=[output, status], concurrency_limit=1, concurrency_id="inferno-generation") run.click(generate, **events) prompt.submit(generate, **events) stop.click(lambda: STOP_EVENT.set(), queue=False) return demo, launch_kwargs
if __name__ == "__main__": demo, launch_kwargs = build_ui() demo.queue().launch(share=GRADIO_SHARE, server_port=GRADIO_PORT, server_name="0.0.0.0", **launch_kwargs)3 unmodified lines456789101182 unmodified lines9495969798993 unmodified lines"step": 275000,"files": {"README.md": {"sha256": "8772db21862d28ad58ebb8e5029907b8250d6b709193bfcc7289136253cb297e","bytes": 12607},"added_tokens.json": {"sha256": "73c50d674f73ad891b34b41c5d9f333a40c3efa7513642507e4cb3cf31c4f9e6",82 unmodified lines"training/train_inferno_exact.py": {"sha256": "ce792e3792a02edc3f31584294f4dfc68282d2f07f945168ec7ec905abf305f9","bytes": 121913}}}3 unmodified lines456789101182 unmodified lines9495969798991001011021033 unmodified lines"step": 275000,"files": {"README.md": {"sha256": "b7d229cfe76415355066181ed9a2dc07d4d41797546b65f0082f0e1546ca59fb","bytes": 24312},"added_tokens.json": {"sha256": "73c50d674f73ad891b34b41c5d9f333a40c3efa7513642507e4cb3cf31c4f9e6",82 unmodified lines"training/train_inferno_exact.py": {"sha256": "ce792e3792a02edc3f31584294f4dfc68282d2f07f945168ec7ec905abf305f9","bytes": 121913},"inference/gradio_demo.py": {"sha256": "d2003ba0dae16a256ff03e51d69b73305bc8ad37ae110d3bcaacb568c141bd3d","bytes": 10547}}}
README.md+257
inference/gradio_demo.pyAdded+228
release_manifest.json+6-2