Token Classification
Transformers
ONNX
Safetensors
English
Japanese
Chinese
bert
anime
filename-parsing
Eval Results (legacy)
Run this model with HF Jobs
Run ModerRAS/AniFileBERT 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 to fine-tune https://huggingface.co/ModerRAS/AniFileBERT. 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/ModerRAS/AniFileBERT 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.
Instructions to use ModerRAS/AniFileBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ModerRAS/AniFileBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ModerRAS/AniFileBERT")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("ModerRAS/AniFileBERT") model = AutoModelForTokenClassification.from_pretrained("ModerRAS/AniFileBERT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add DMHY digit-dedup list export
Browse filesFiles changed (2)
- datasets/AnimeName+1-1
- tools/export_dmhy_list.pyAdded+110
11Subproject commit 1b87d60c2e232d556ab06a48124985e77af33b53Subproject commit 7a09918c1f1190ca0e26b580f932831292b4f01a123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110"""Export a digit-skeleton deduplicated DMHY filename list."""
from __future__ import annotations
import argparseimport jsonimport osimport reimport sqlite3from datetime import datetime, timezonefrom pathlib import Path
from tools.dmhy_dataset import VIDEO_EXTENSIONS, normalize_path_basename
DIGIT_RE = re.compile(r"\d+")
def strip_video_extension(basename: str) -> tuple[str, str]: stem, ext = os.path.splitext(basename) return stem.strip(), ext.lower()
def digit_skeleton(text: str) -> str: """Return a key where only same-position non-digits must match.""" return DIGIT_RE.sub("<NUM>", text)
def iter_filenames(db_path: Path, min_id: int, max_id: int): conn = sqlite3.connect(f"file:{db_path}?mode=ro", uri=True, timeout=30) conn.execute("PRAGMA query_only=ON") try: yield from conn.execute( "SELECT id, filename FROM files WHERE id >= ? AND id <= ? ORDER BY id", (min_id, max_id), ) finally: conn.close()
def export_list(args: argparse.Namespace) -> None: db_path = Path(args.db) output_path = Path(args.output) output_path.parent.mkdir(parents=True, exist_ok=True)
conn = sqlite3.connect(f"file:{db_path}?mode=ro", uri=True, timeout=30) conn.execute("PRAGMA query_only=ON") try: db_max_id = conn.execute("SELECT MAX(id) FROM files").fetchone()[0] or 0 max_id = min(args.max_id if args.max_id is not None else db_max_id, db_max_id) finally: conn.close()
seen_stems: set[str] = set() seen_skeletons: set[str] = set() stats = { "scanned_rows": 0, "video_rows": 0, "duplicate_basenames": 0, "duplicate_digit_skeletons": 0, "written_rows": 0, }
with output_path.open("w", encoding="utf-8", newline="\n") as out: for _, raw_filename in iter_filenames(db_path, args.min_id, max_id): stats["scanned_rows"] += 1 basename = normalize_path_basename(raw_filename) stem, ext = strip_video_extension(basename) if ext not in VIDEO_EXTENSIONS: continue stats["video_rows"] += 1 if stem in seen_stems: stats["duplicate_basenames"] += 1 continue seen_stems.add(stem)
skeleton = digit_skeleton(stem) if skeleton in seen_skeletons: stats["duplicate_digit_skeletons"] += 1 continue seen_skeletons.add(skeleton) out.write(stem + "\n") stats["written_rows"] += 1
manifest = { "created_at": datetime.now(timezone.utc).isoformat(), "source_db": str(db_path), "output": str(output_path), "min_file_id": args.min_id, "last_file_id": max_id, "db_max_file_id_at_export_start": db_max_id, "dedupe_rule": "strip video extension, then replace every contiguous digit run with <NUM>; keep the first row per resulting skeleton", "stats": stats, } manifest_path = output_path.with_suffix(".manifest.json") manifest_path.write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding="utf-8") print(json.dumps(manifest, ensure_ascii=False, indent=2))
def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser(description="Export DMHY filename stems deduplicated by digit skeleton") parser.add_argument("--db", default=r"D:\WorkSpace\Python\dmhy-parser\dmhy_anime.db") parser.add_argument("--output", default=r"datasets\AnimeName\dmhy_list.txt") parser.add_argument("--min-id", type=int, default=1) parser.add_argument("--max-id", type=int, default=None) return parser.parse_args()
if __name__ == "__main__": export_list(parse_args())datasets/AnimeName+1-1
tools/export_dmhy_list.pyAdded+110