Upload folder using huggingface_hub
Browse filesFiles changed (4)
123456789101112131415161718192021222324252627282930313233343536373839404142434445{ "agent_s": 2.7, "late": false, "exit": 1, "usage": [], "correct": false, "jobs": 0, "failed": 0, "timeout": 0, "cancelled": 0, "left": 0, "usd": 0, "usd_ours": 0.0035, "gpu_s": 0, "gpu_s_ours": 9.8, "calls": 0, "peeked": false, "cell": "0.5B-256x512", "epoch": 1, "said": null, "ours": { "job": "a10-7", "gpu": "A10", "limit_s": 3600, "cmd": "python loss.py --model Qwen/Qwen2.5-0.5B --docs 256 --ctx 512 --batch 4", "posted_at": 1795292402.7972782, "state": "SUCCEEDED", "start_at": 1795292403.5754673, "end_at": 1795292414.7726612, "seconds": 9.8, "exit": 0, "timeout": false, "peak_gpu_mb": 4377, "gpu_util_mean": 41.8, "gpu_busy_share": 0.5, "usd": 0.0035, "cell": "0.5B-256x512", "batch": 4, "loss": 2.855, "tok_s": 31923.0, "uid": "a385a463c0", "cause": null }, "posted": []}1Reading additional input from stdin...1234{"type":"thread.started","thread_id":"01a2005c-4bee-73c1-887b-e631da14503d"}{"type":"turn.started"}{"type":"error","message":"You’ve hit your usage limit. Upgrade to Pro (https://chatgpt.com/explore/pro), visit https://chatgpt.com/settings/usage to purchase more credits or try again at Nov 22nd, 2026 12:49 AM."}{"type":"turn.failed","error":{"message":"You’ve hit your usage limit. Upgrade to Pro (https://chatgpt.com/explore/pro), visit https://chatgpt.com/settings/usage to purchase more credits or try again at Nov 22nd, 2026 12:49 AM."}}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152"""Mean next-token loss of a causal language model on the first --docs chunks of --ctx tokens ofthe WikiText-103 training text.
python loss.py --model Qwen/Qwen2.5-1.5B --docs 2000 --ctx 1024 [--batch 16]"""
import argparseimport time
import torchfrom datasets import load_datasetfrom transformers import AutoModelForCausalLM, AutoTokenizer
ROWS = 2000
def chunks(tok, docs, ctx): rows = load_dataset("Salesforce/wikitext", "wikitext-103-raw-v1", split="train")["text"] ids = [] for i in range(0, len(rows), ROWS): ids += tok("".join(rows[i : i + ROWS]), add_special_tokens=False)["input_ids"] if len(ids) >= docs * ctx: break return torch.tensor(ids[: docs * ctx]).view(docs, ctx)
def main(): ap = argparse.ArgumentParser() ap.add_argument("--model", required=True) ap.add_argument("--docs", type=int, required=True) ap.add_argument("--ctx", type=int, required=True) ap.add_argument("--batch", type=int, default=16) a = ap.parse_args() dev = "cuda" if torch.cuda.is_available() else "cpu" print(f"device {dev}", flush=True) x = chunks(AutoTokenizer.from_pretrained(a.model), a.docs, a.ctx) m = AutoModelForCausalLM.from_pretrained(a.model, torch_dtype=torch.bfloat16).to(dev).eval() total, t, said = 0.0, time.time(), 0 with torch.no_grad(): for i in range(0, a.docs, a.batch): b = x[i : i + a.batch].to(dev) total += m(input_ids=b, labels=b).loss.item() * len(b) done = i + len(b) if done * 10 // a.docs > said: said = done * 10 // a.docs print(f"{done}/{a.docs} docs {time.time() - t:.0f} s", flush=True) print(f"tok_s {a.docs * a.ctx / (time.time() - t):.0f}") print(f"loss {total / a.docs:.4f}")
if __name__ == "__main__": main()post/20261121-7084aa7/codex/0.5B-256x512-1/episode.jsonAdded+45
post/20261121-7084aa7/codex/0.5B-256x512-1/stderr.txtAdded+1
post/20261121-7084aa7/codex/0.5B-256x512-1/transcript.jsonlAdded+4
post/20261121-7084aa7/codex/0.5B-256x512-1/work/loss.pyAdded+52