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
Export DMHY metadata list
Browse filesFiles changed (2)
1Subproject commit 7a09918c1f1190ca0e26b580f932831292b4f01a1Subproject commit 2ea069cd2c6f4c8b085bdfaddc5659781623cf45
12342 unmodified lines7891011121314151617181920212223242526272829303119 unmodified lines5152535455565758596061626364656667686970717273747576777879808182838485862 unmodified lines899091929394952 unmodified lines9899100101102103104105106"""Export a digit-skeleton deduplicated DMHY filename list."""from __future__ import annotations2 unmodified linesimport osimport reimport sqlite3from datetime import datetime, timezonefrom pathlib import Pathfrom tools.dmhy_dataset import VIDEO_EXTENSIONS, normalize_path_basenameDIGIT_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")19 unmodified linesfinally: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"] += 1basename = normalize_path_basename(raw_filename)stem, ext = strip_video_extension(basename)if ext not in VIDEO_EXTENSIONS:continuestats["video_rows"] += 1if stem in seen_stems:stats["duplicate_basenames"] += 1continueseen_stems.add(stem)skeleton = digit_skeleton(stem)if skeleton in seen_skeletons:stats["duplicate_digit_skeletons"] += 1continueseen_skeletons.add(skeleton)out.write(stem + "\n")stats["written_rows"] += 1manifest = {"created_at": datetime.now(timezone.utc).isoformat(),2 unmodified lines"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")2 unmodified linesdef 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()12342 unmodified lines7891011121314151617181920212223242526272829303132333435363738394041424344454647484919 unmodified lines697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211222 unmodified lines1251261271281291301311321331341351361371381391402 unmodified lines143144145146147148149150151152153"""Export a status-annotated DMHY filename metadata list."""from __future__ import annotations2 unmodified linesimport osimport reimport sqlite3from collections import Counterfrom datetime import datetime, timezonefrom pathlib import Pathfrom tools.dmhy_dataset import VIDEO_EXTENSIONSDIGIT_RE = re.compile(r"\d+")TRAILING_HASH_RE = re.compile(r"\s*[\[(][A-Fa-f0-9]{8,}[\])]\s*$")def normalize_db_path(filename: str) -> str:return filename.replace("\\", "/").strip()def strip_video_extension(filename: str) -> tuple[str, str]:stem, ext = os.path.splitext(filename)return stem.strip(), ext.lower()def is_bdmv_stream_path(filename: str) -> bool:return "/BDMV/STREAM/" in filename.upper()def digit_skeleton(text: str) -> str:"""Return a key where only same-position non-digits must match."""return DIGIT_RE.sub("<NUM>", text)def strip_trailing_hash(text: str) -> str:return TRAILING_HASH_RE.sub("", text).rstrip()def has_trailing_hash(text: str) -> bool:return TRAILING_HASH_RE.search(text) is not Nonedef 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")19 unmodified linesfinally:conn.close()record_counts: Counter[str] = Counter()stats = {"scanned_rows": 0,"video_rows": 0,"skipped_bdmv_stream_paths": 0,"duplicate_exact_strings": 0,"rows_with_path": 0,"rows_with_trailing_hash": 0,"written_rows": 0,}kept_records: list[dict] = []for _, raw_filename in iter_filenames(db_path, args.min_id, max_id):stats["scanned_rows"] += 1normalized_path = normalize_db_path(raw_filename)value, ext = strip_video_extension(normalized_path)if ext not in VIDEO_EXTENSIONS:continuestats["video_rows"] += 1if is_bdmv_stream_path(value):stats["skipped_bdmv_stream_paths"] += 1continueif value in record_counts:stats["duplicate_exact_strings"] += 1record_counts[value] += 1continuerecord_counts[value] = 1record = {"value": value,"uses_path": "/" in value,"has_trailing_hash": has_trailing_hash(value),"has_digits": DIGIT_RE.search(value) is not None,"digit_skeleton": digit_skeleton(value),}kept_records.append(record)if record["uses_path"]:stats["rows_with_path"] += 1if record["has_trailing_hash"]:stats["rows_with_trailing_hash"] += 1kept_records.sort(key=lambda record: record["value"])stats["written_rows"] = len(kept_records)with output_path.open("w", encoding="utf-8", newline="\n") as out:for record in kept_records:record["count"] = record_counts[record["value"]]out.write(json.dumps(record, ensure_ascii=False) + "\n")manifest = {"created_at": datetime.now(timezone.utc).isoformat(),2 unmodified lines"min_file_id": args.min_id,"last_file_id": max_id,"db_max_file_id_at_export_start": db_max_id,"dedupe_rule": "normalize path separators to /, strip video extension, skip BDMV/STREAM internals, and keep the first exact value; numeric and trailing-hash differences are preserved and annotated","record_schema": {"value": "extensionless normalized DB filename/path string","uses_path": "true when value contains / from the original DB path","has_trailing_hash": "true when value ends with a bracketed 8+ hex character hash","has_digits": "true when value contains at least one digit","digit_skeleton": "value with every contiguous digit run replaced by <NUM>","count": "number of exact DB strings collapsed into this row",},"sort_order": "Python default Unicode string order","stats": stats,}manifest_path = output_path.with_suffix(".manifest.json")2 unmodified linesdef parse_args() -> argparse.Namespace:parser = argparse.ArgumentParser(description="Export DMHY filename metadata with exact-string dedupe and numeric/hash status fields")parser.add_argument("--db", default=r"D:\WorkSpace\Python\dmhy-parser\dmhy_anime.db")parser.add_argument("--output", default=r"datasets\AnimeName\dmhy_list.jsonl")parser.add_argument("--min-id", type=int, default=1)parser.add_argument("--max-id", type=int, default=None)return parser.parse_args()
datasets/AnimeName+1-1
tools/export_dmhy_list.py+77-30