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
Refine DMHY template labeling rules
Browse filesFiles changed (2)
16 unmodified lines1718192021222316 unmodified lines--recipe-top 5000 `--review-top 5000 `--min-count 2 `--recipe-min-count 10 `--threads 24```16 unmodified lines1718192021222316 unmodified lines--recipe-top 5000 `--review-top 5000 `--min-count 2 `--recipe-min-count 25 `--threads 24```
60 unmodified lines6162636465666787 unmodified lines1551561571581591601196 unmodified lines135713581359136013611362128 unmodified lines149114921493149414951496229 unmodified lines1726172717281729173017312 unmodified lines173417351736173717381739139 unmodified lines1879188018811882188318846 unmodified lines18911892189318941895189621 unmodified lines191819191920192119221923192460 unmodified linesreview_top: usize,#[arg(long, default_value_t = 8)]examples: usize,#[arg(long, default_value_t = 10)]recipe_min_count: usize,#[arg(long, default_value = "high")]confidence: String,87 unmodified linesstatic SXE_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)^S\d{1,2}E\d{1,4}(?:v\d+)?$").unwrap());static SXE_VALUE_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"(?i)^S(\d{1,2})E(\d{1,4})(?:v(\d+))?$").unwrap());static SEASON_RE: Lazy<Regex> = Lazy::new(|| {Regex::new(r"(?i)^(?:S\d{1,2}|Season\s*\d{1,2}|第[一二三四五六七八九十\d]+[季期部])$").unwrap()});1196 unmodified linesSome((pieces, labels))}fn split_season_token(token: &str) -> Option<(Vec<String>, Vec<String>)> {let caps = SEASON_VALUE_RE.captures(token)?;Some((128 unmodified linescontinue;}}if roles[index] == "TITLE" && is_special_title_phrase(&text) {output[index] = "SPECIAL".to_string();continue;229 unmodified linesoutput_labels.extend(labels);continue;}}for piece in split_refined_token(token) {if matches!(role, "EPISODE" | "EPISODE_VERSION" | "EPISODE_RANGE") {2 unmodified linesoutput_labels.extend(labels);continue;}}let label = label_for_refined_piece(&piece, role, &group.class_name);let (pieces, labels) = normalize_generated_tokens(&[piece], &[label]);139 unmodified lines("02".to_string(), "B-EPISODE".to_string())]);let bracket_sxe = labels_for("[FLsnow.feat.PO][Himitsu_no_Aipri][1080P][S2E01]");assert!(bracket_sxe.contains(&("2".to_string(), "B-SEASON".to_string())));assert!(bracket_sxe.contains(&("01".to_string(), "B-EPISODE".to_string())));6 unmodified linesassert!(!beyblade.contains(&("X".to_string(), "B-SEASON".to_string())));let bang_title = labels_for("[Dymy][Gugure! Kokkuri-san][06][BIG5][1280X720]");assert!(bang_title.contains(&("!".to_string(), "B-TITLE".to_string())));let conan_time = labels_for("【蓝色狂想】名侦探柯南TV版第036集-周一晚上7点半杀人事件");assert!(conan_time.contains(&("036".to_string(), "B-EPISODE".to_string())));21 unmodified lines);let woody = labels_for(&trimmed);assert!(woody.contains(&("4".to_string(), "B-SEASON".to_string())));assert!(woody.contains(&("E07".to_string(), "B-EPISODE".to_string())));assert!(woody.contains(&("The".to_string(), "B-TITLE".to_string())));assert!(woody.contains(&("Show".to_string(), "B-TITLE".to_string())));assert!(!woody.contains(&("1999".to_string(), "B-EPISODE".to_string())));60 unmodified lines6162636465666787 unmodified lines1551561571581591601611621196 unmodified lines1359136013611362136313641365136613671368136913701371137213731374137513761377128 unmodified lines15061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549229 unmodified lines177917801781178217831784178517861787178817892 unmodified lines17921793179417951796179717981799180018011802139 unmodified lines1942194319441945194619471948194919506 unmodified lines1957195819591960196119621963196419651966196721 unmodified lines1989199019911992199319941995199660 unmodified linesreview_top: usize,#[arg(long, default_value_t = 8)]examples: usize,#[arg(long, default_value_t = 25)]recipe_min_count: usize,#[arg(long, default_value = "high")]confidence: String,87 unmodified linesstatic SXE_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"(?i)^S\d{1,2}E\d{1,4}(?:v\d+)?$").unwrap());static SXE_VALUE_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"(?i)^S(\d{1,2})E(\d{1,4})(?:v(\d+))?$").unwrap());static EPISODE_VALUE_RE: Lazy<Regex> =Lazy::new(|| Regex::new(r"(?i)^(EP|E|#)(\d{1,4})(?:v(\d+))?$").unwrap());static SEASON_RE: Lazy<Regex> = Lazy::new(|| {Regex::new(r"(?i)^(?:S\d{1,2}|Season\s*\d{1,2}|第[一二三四五六七八九十\d]+[季期部])$").unwrap()});1196 unmodified linesSome((pieces, labels))}fn split_episode_token(token: &str) -> Option<(Vec<String>, Vec<String>)> {let caps = EPISODE_VALUE_RE.captures(token)?;let mut pieces = vec![caps[1].to_string(), caps[2].to_string()];let mut labels = vec!["O".to_string(), "B-EPISODE".to_string()];if let Some(version) = caps.get(3) {pieces.push("v".to_string());pieces.push(version.as_str().to_string());labels.push("O".to_string());labels.push("O".to_string());}Some((pieces, labels))}fn split_season_token(token: &str) -> Option<(Vec<String>, Vec<String>)> {let caps = SEASON_VALUE_RE.captures(token)?;Some((128 unmodified linescontinue;}}if roles[index].starts_with("EPISODE")&& index >= 2&& output[..index].iter().any(|role| role == "TITLE")&& group_text(tokens, &groups[index]).chars().all(|ch| ch.is_ascii_digit()){let next_episode_word = index + 2 < roles.len()&& groups[index + 1].class_name == "SEP"&& group_text(tokens, &groups[index + 2]).eq_ignore_ascii_case("episode");if next_episode_word {let mut run = Vec::new();let mut cursor = index + 2;while cursor < roles.len() {if groups[cursor].class_name == "SEP" {cursor += 1;continue;}if groups[cursor].class_name == "TEXT" && !roles[cursor].starts_with("EPISODE"){run.push(cursor);cursor += 1;continue;}break;}let later_episode = roles[cursor..].iter().any(|role| role.starts_with("EPISODE"));if run.len() >= 2 && later_episode {output[index] = "TITLE".to_string();for item in run {output[item] = "TITLE".to_string();}continue;}}}if roles[index] == "TITLE" && is_special_title_phrase(&text) {output[index] = "SPECIAL".to_string();continue;229 unmodified linesoutput_labels.extend(labels);continue;}if let Some((pieces, labels)) = split_episode_token(&strip_wrapper(token)) {output_tokens.extend(pieces);output_labels.extend(labels);continue;}}for piece in split_refined_token(token) {if matches!(role, "EPISODE" | "EPISODE_VERSION" | "EPISODE_RANGE") {2 unmodified linesoutput_labels.extend(labels);continue;}if let Some((pieces, labels)) = split_episode_token(&piece) {output_tokens.extend(pieces);output_labels.extend(labels);continue;}}let label = label_for_refined_piece(&piece, role, &group.class_name);let (pieces, labels) = normalize_generated_tokens(&[piece], &[label]);139 unmodified lines("02".to_string(), "B-EPISODE".to_string())]);let ep_prefix = labels_for("Toradora! EP01 [BD 1080p]");assert!(ep_prefix.contains(&("EP".to_string(), "O".to_string())));assert!(ep_prefix.contains(&("01".to_string(), "B-EPISODE".to_string())));let bracket_sxe = labels_for("[FLsnow.feat.PO][Himitsu_no_Aipri][1080P][S2E01]");assert!(bracket_sxe.contains(&("2".to_string(), "B-SEASON".to_string())));assert!(bracket_sxe.contains(&("01".to_string(), "B-EPISODE".to_string())));6 unmodified linesassert!(!beyblade.contains(&("X".to_string(), "B-SEASON".to_string())));let bang_title = labels_for("[Dymy][Gugure! Kokkuri-san][06][BIG5][1280X720]");assert!(bang_title.contains(&("!".to_string(), "B-TITLE".to_string())));let pso2 = labels_for("[Lilith-Raws] Phantasy Star Online 2 Episode Oracle - 01 [1080p]");assert!(pso2.contains(&("2".to_string(), "B-TITLE".to_string())));assert!(pso2.contains(&("Episode".to_string(), "B-TITLE".to_string())));assert!(pso2.contains(&("Oracle".to_string(), "B-TITLE".to_string())));assert!(pso2.contains(&("01".to_string(), "B-EPISODE".to_string())));let conan_time = labels_for("【蓝色狂想】名侦探柯南TV版第036集-周一晚上7点半杀人事件");assert!(conan_time.contains(&("036".to_string(), "B-EPISODE".to_string())));21 unmodified lines);let woody = labels_for(&trimmed);assert!(woody.contains(&("4".to_string(), "B-SEASON".to_string())));assert!(woody.contains(&("E".to_string(), "O".to_string())));assert!(woody.contains(&("07".to_string(), "B-EPISODE".to_string())));assert!(woody.contains(&("The".to_string(), "B-TITLE".to_string())));assert!(woody.contains(&("Show".to_string(), "B-TITLE".to_string())));assert!(!woody.contains(&("1999".to_string(), "B-EPISODE".to_string())));
tools/rust_dmhy_template_apply/README.md+1-1
tools/rust_dmhy_template_apply/src/main.rs+74-2