Views
No views yet
BertForTokenClassificationTITLE, SEASON, EPISODE, GROUP, RESOLUTION, SOURCE, and SPECIALtokenizer.pyBertForTokenClassification.from_pretrained("ModerRAS/AniFileBERT") can load the weights. Use inference.py for end-to-end parsing because the tokenizer is custom rather than a standard WordPiece tokenizer.ModerRAS/AnimeName, and this repository includes it as a nested git submodule at datasets/AnimeName.datasets/AnimeName):files.id: 1675184--min-id 1675185632002732002vocab.json at the
repository root is the deployed tokenizer vocab, and vocab.char.json is kept
as a mirrored explicit copy for training/data maintenance. The full DMHY weak
dataset has 6195 unique characters, so the complete character vocab is only
6199 entries including special tokens and reaches 100% token coverage.datasets/AnimeName/vocab.json for
dataset relabeling and diagnostics, but the root checkpoint loads as char.632002 DMHY rows, 2 epochs, batch size 256,
seed 52):| Metric | Value |
|---|---|
| Eval loss | 0.0058 |
| Entity precision | 0.9922 |
| Entity recall | 0.9946 |
| Entity F1 | 0.9934 |
| Token accuracy | 0.9981 |
| Held-out parse full match | 2029/2048 (0.9907) |
| Fixed regression full match | 22/22 (1.0000) |
Ni,
Ni no Sara, 貳, and 弐ノ章, plus GM-Team bilingual Chinese animation
bracket layouts, long-running episode IDs, and dense meta blocks.uv syncpython inference.py --model-dir . "Witch.Hat.Atelier.S01E07.1080p.NF.WEB-DL.JPN.AAC2.0.H.264.MSubs-ToonsHub"1from transformers import BertForTokenClassification
2
3model = BertForTokenClassification.from_pretrained("ModerRAS/AniFileBERT")load_tokenizer from tokenizer.py or the CLI in inference.py.1git clone --recursive https://huggingface.co/ModerRAS/AniFileBERT
2# or, after a normal clone:
3git submodule update --init --recursive1uv run python convert_to_char_dataset.py \
2 --input datasets/AnimeName/dmhy_weak.jsonl \
3 --output datasets/AnimeName/dmhy_weak_char.jsonl \
4 --vocab-output datasets/AnimeName/vocab.char.json \
5 --manifest-output datasets/AnimeName/dmhy_weak_char.manifest.json
6
7uv run python train.py --tokenizer char \
8 --data-file datasets/AnimeName/dmhy_weak_char.jsonl \
9 --vocab-file datasets/AnimeName/vocab.char.json \
10 --save-dir checkpoints/dmhy-char-guoman-relabel \
11 --init-model-dir . \
12 --epochs 2 --batch-size 256 \
13 --learning-rate 0.00008 --warmup-steps 300 \
14 --checkpoint-steps 1000 --save-total-limit 3 \
15 --parse-eval-limit 2048 \
16 --max-seq-length 128 --seed 52tokenizer_variant, source token
count, and character token count fields to each record. The char dataset's
p99 length is 107 characters, so --max-seq-length 128 covers almost all rows
while leaving room for [CLS] and [SEP].1uv run python relabel_dataset_from_filenames.py \
2 --input datasets/AnimeName/dmhy_weak.jsonl \
3 --output datasets/AnimeName/dmhy_weak.relabel.jsonl \
4 --manifest-output datasets/AnimeName/dmhy_weak.relabel.manifest.json \
5 --vocab-output datasets/AnimeName/vocab.relabel.json \
6 --base-vocab datasets/AnimeName/vocab.json \
7 --max-vocab-size 8000
8
9Move-Item datasets/AnimeName/dmhy_weak.relabel.jsonl datasets/AnimeName/dmhy_weak.jsonl -Force
10Move-Item datasets/AnimeName/vocab.relabel.json datasets/AnimeName/vocab.json -Force
11Copy-Item datasets/AnimeName/dmhy_weak.relabel.manifest.json datasets/AnimeName/dmhy_weak.manifest.json -Force
12Remove-Item datasets/AnimeName/dmhy_weak.relabel.manifest.json -Force1python -c "
2import json, collections
3tokens = collections.Counter()
4[ tokens.update(item['tokens']) for item in [json.loads(l) for l in open('datasets/AnimeName/dmhy_weak.jsonl')] if item ]
5vocab = {t:i for i,t in enumerate(['[PAD]','[UNK]','[CLS]','[SEP]'] + [t for t,_ in tokens.most_common(7996)])}
6json.dump(vocab, open('vocab.json','w'), ensure_ascii=False, indent=2)
7"uv run python export_onnx.py --model-dir . --output exports/anime_filename_parser.onnx --max-length 128colab/README.md.
Free Colab still has to be started manually, but once colab_worker.py is
running Codex can submit jobs through colab_client.py, tail logs, and inspect
status. Checkpoints live on Google Drive and default profiles resume from the
latest checkpoint automatically.python colab_train.py --profile dmhy_regex_finetunemodel.safetensors, config.json, vocab.json: default published modeltrain.py, dataset.py, tokenizer.py, model.py: training pipelinedmhy_dataset.py, mix_datasets.py: weak-label export and dataset mixingconvert_to_char_dataset.py: full character-token projection for weak labelsinference.py: end-to-end filename parser CLIexport_onnx.py: ONNX export for Android integrationexports/: exported ONNX model and metadatadatasets/AnimeName/: nested dataset submoduletools/anime_parser, and this repository
tracks ModerRAS/AnimeName as datasets/AnimeName. After updating either
repo, remember to commit the submodule pointer in the parent repo.docs/anifilebert-maintenance.md.