Text Classification
Transformers
Safetensors
English
roberta
intent-classification
email
triage
Synthetic
text-embeddings-inference
Instructions to use aitrainingdatabroker/inbound-inquiry-intent-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aitrainingdatabroker/inbound-inquiry-intent-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="aitrainingdatabroker/inbound-inquiry-intent-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("aitrainingdatabroker/inbound-inquiry-intent-classifier") model = AutoModelForSequenceClassification.from_pretrained("aitrainingdatabroker/inbound-inquiry-intent-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 5,539 Bytes
d2c78fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | """Datasets 1 to 4 and the training files of models 1 to 3, built from the text of our own published pages (2026-10-30).
python hf-work/gen_derived.py
Reads hf-work/site_content.json (extracted from aitrainingdatabroker.com's page sources by extract_src.ts) and writes
datasets/<name>/data/train.jsonl and models/<name>/data/{train,test}.jsonl. Every row is our own text; nothing is from a customer.
"""
import json
import random
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
SITE = "https://aitrainingdatabroker.com"
src = json.load(open(Path(__file__).parent / "site_content.json", encoding="utf-8"))
pages = src["pages"]
industries = [p for p in pages if p["kind"] == "industry"]
records_pages = [p for p in pages if p["kind"] == "data"]
rng = random.Random(20261030)
def write(kind, name, split, rows):
out = ROOT / kind / name / "data"
out.mkdir(parents=True, exist_ok=True)
with open(out / f"{split}.jsonl", "w", encoding="utf-8", newline="\n") as f:
for r in rows:
f.write(json.dumps(r, ensure_ascii=False) + "\n")
print(f"{kind}/{name}/{split}: {len(rows)} rows")
def url(p):
return SITE + p["path"]
# ---- dataset 1: what a company in each industry can consider licensing and what stays out ----
rows = []
for p in industries:
for kind, items in (("can_be_considered", p["records"]), ("stays_out", p["keepsOut"])):
for it in items:
rows.append({"industry": p["name"], "industry_slug": p["slug"], "kind": kind, "label": it["label"],
"text": it["text"], "source_url": url(p)})
for i, r in enumerate(rows, 1):
r["id"] = f"ind-{i:03d}"
write("datasets", "company-data-licensability-by-industry", "train", [{"id": r.pop("id"), **r} for r in rows])
ind_rows = rows
# ---- dataset 2: the same for 33 record types ----
rows = []
for p in records_pages:
for kind, items in (("what_it_holds", p["records"]), ("limits", p["keepsOut"])):
for it in items:
rows.append({"record_type": p["name"], "record_type_slug": p["slug"], "kind": kind, "label": it["label"],
"text": it["text"], "source_url": url(p)})
write("datasets", "company-record-types-and-limits", "train", [{"id": f"rec-{i:03d}", **r} for i, r in enumerate(rows, 1)])
rec_rows = rows
# ---- dataset 3: questions and answers, by industry, record type and guide ----
rows = []
for p in pages:
for q in p["faq"]:
rows.append({"topic_kind": "industry" if p["kind"] == "industry" else "record_type", "topic": p["name"],
"question": q["q"], "answer": q["a"], "source_url": url(p)})
for g in src["guides"]:
for q in g["faq"]:
rows.append({"topic_kind": f"{g['area']}_guide", "topic": g["h1"], "question": q["q"], "answer": q["a"],
"source_url": SITE + g["url"]})
write("datasets", "company-data-licensing-faq-by-topic", "train", [{"id": f"faq-{i:03d}", **r} for i, r in enumerate(rows, 1)])
faq_rows = rows
# ---- dataset 4: glossary ----
rows = []
for t in src["glossary"]:
more = t.get("more") or []
rows.append({"term": t["term"], "definition": t["def"], "see_also": more[0] if len(more) > 0 else "",
"see_also_url": SITE + more[1] if len(more) > 1 else ""})
write("datasets", "data-licensing-glossary", "train", [{"id": f"gls-{i:03d}", **r} for i, r in enumerate(rows, 1)])
# ---- model 1: which industry page does a passage belong to (train on records, ledes and sections; test on its FAQ) ----
train, test = [], []
for p in industries:
for it in p["records"] + p["keepsOut"]:
train.append({"text": f"{it['label']}. {it['text']}", "label": p["slug"]})
train.append({"text": p["lede"], "label": p["slug"]})
for s in p["sections"]:
for para in s["paragraphs"]:
train.append({"text": para, "label": p["slug"]})
for q in p["faq"]:
test.append({"text": f"{q['q']} {q['a']}", "label": p["slug"]})
rng.shuffle(train)
write("models", "industry-page-classifier", "train", train)
write("models", "industry-page-classifier", "test", test)
# ---- model 2: can be considered, or stays out (train on industry pages, test on record-type pages: a different subject) ----
train = [{"text": f"{it['label']}. {it['text']}", "label": "can_be_considered" if k == "r" else "stays_out"}
for p in industries for k, items in (("r", p["records"]), ("o", p["keepsOut"])) for it in items]
test = [{"text": f"{it['label']}. {it['text']}", "label": "can_be_considered" if k == "r" else "stays_out"}
for p in records_pages for k, items in (("r", p["records"]), ("o", p["keepsOut"])) for it in items]
rng.shuffle(train)
write("models", "licensable-or-stays-out-classifier", "train", train)
write("models", "licensable-or-stays-out-classifier", "test", test)
# ---- model 3: which record-type page does a passage belong to (train on records, ledes, sections; test on FAQ) ----
train, test = [], []
for p in records_pages:
for it in p["records"] + p["keepsOut"]:
train.append({"text": f"{it['label']}. {it['text']}", "label": p["slug"]})
train.append({"text": p["lede"], "label": p["slug"]})
for s in p["sections"]:
for para in s["paragraphs"]:
train.append({"text": para, "label": p["slug"]})
for q in p["faq"]:
test.append({"text": f"{q['q']} {q['a']}", "label": p["slug"]})
rng.shuffle(train)
write("models", "record-type-page-classifier", "train", train)
write("models", "record-type-page-classifier", "test", test)
|