Datasets:
Tasks:
Text Classification
Formats:
parquet
Sub-tasks:
multi-class-classification
Size:
1K - 10K
License:
EmoTweetID unified under Ekman's 7 universal emotions: human labels kept, anger pool split into anger/contempt by laya
f5a2109 verified Download bench_batch.py from mahalisyarifuddin/emotweetid-ekman7: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/datasets/mahalisyarifuddin/emotweetid-ekman7/resolve/main/bench_batch.py
- Command line
-
hf download hf://datasets/mahalisyarifuddin/emotweetid-ekman7/bench_batch.py
-
curl -L -o bench_batch.py https://huggingface.co/datasets/mahalisyarifuddin/emotweetid-ekman7/resolve/main/bench_batch.py
1.08 kB
| """Batch cap sweep on laya's own numbers: rows/pass is the knob, not max_len.""" | |
| import json, sys, time | |
| import numpy as np, pandas as pd, torch | |
| import laya_opt | |
| from ekman_questions import EKMAN_QUESTIONS | |
| from bench_speedup import texts | |
| agent = laya_opt.load_agent() | |
| tx = texts(48) | |
| q = {"ekman": EKMAN_QUESTIONS["ekman"]} | |
| base = None | |
| for budget in [1, 512, 1024, 2048, 4096, 6144, 12288]: | |
| if budget == 1: # one state per pass == laya's own predict semantics | |
| t0 = time.time() | |
| for t in tx: | |
| agent.predict(t, q) | |
| dt = time.time() - t0 | |
| rows_pp, tag = 1.0, "stock predict (1 state/pass)" | |
| else: | |
| _, st = laya_opt.score_texts(agent, q, tx, max_len=256, head_max_len=144, | |
| token_budget=budget, log=lambda *a: None) | |
| dt, rows_pp, tag = st["seconds"], st["rows"]/st["forward_passes"], "budget=%d" % budget | |
| ms = dt/len(tx)*1000 | |
| if base is None: base = ms | |
| print("%-28s %6.1f ms/doc rows/pass=%5.1f speedup vs stock=%.2fx" % (tag, ms, rows_pp, base/ms)) | |
| sys.stdout.flush() | |