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 Pi RPC title-boundary reviewer backend
Browse filesFiles changed (2)
52 unmodified lines5354555657585657585960617 unmodified lines697071727374757677787980818283848552 unmodified lines --audit-max-count 50```
Review ambiguous title-boundary decisions with a local LM Studio model. This isan optional final-pass reviewer: it writes a decision cache JSONL and does notmodify recipes or training data directly.Review ambiguous title-boundary decisions with a local LM Studio model or withPi RPC mode. This is an optional final-pass reviewer: it writes a decision cacheJSONL and does not modify recipes or training data directly.
```powershellcargo run --release --manifest-path tools\rust_dmhy_template_apply\Cargo.toml -- `7 unmodified lines --limit 50```
```powershellcargo run --release --manifest-path tools\rust_dmhy_template_apply\Cargo.toml -- ` --review-title-boundaries-pi-rpc ` --recipes reports\dmhy_template_recipes.full_top5000.seed.jsonl ` --title-boundary-decisions-output reports\dmhy_title_boundary_pi_rpc_decisions.jsonl ` --pi-rpc-model openai/gpt-5.5 ` --title-boundary-min-similarity 0.25 ` --title-boundary-max-similarity 0.85 ` --limit 50```
Optional controls:
```powershell9 unmodified lines101112131415169 unmodified lines262728293031323345 unmodified lines7980818283848586247 unmodified lines334335336332333337338339340341834 unmodified lines1176117711781174117911801181118210 unmodified lines11931194119511961197119811991200120112021203120412051206120712081209121028 unmodified lines12391240124112291230123112321233123412351236123712381242124312441245124612471248124912501251125212531254125512561257124012411242124312441245124612471248124912581259126012611262126312641265126612671268126912701271127212 unmodified lines12851286128712681269128812891290129112927 unmodified lines1300130113021283128413031304130513061307130881 unmodified lines139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715389 unmodified linesuse std::fs::{self, File};use std::io::{BufRead, BufReader, BufWriter, Read, Write};use std::path::PathBuf;use std::process::{Child, ChildStdin, Command, Stdio};use std::sync::atomic::{AtomicUsize, Ordering};
#[derive(Parser, Debug)]9 unmodified lines rich_annotations: bool, #[arg(long)] review_title_boundaries_lmstudio: bool, #[arg(long)] review_title_boundaries_pi_rpc: bool, #[arg(long, default_value = "datasets/AnimeName/dmhy_list.jsonl")] input: PathBuf, #[arg(long, default_value = "reports/dmhy_template_recipes.seed.jsonl")]45 unmodified lines lmstudio_temperature: f64, #[arg(long, default_value_t = 120)] lmstudio_timeout_seconds: u64, #[arg(long)] pi_rpc_model: Option<String>, #[arg(long, default_value_t = 50)] audit_max_count: u64, #[arg(long)]247 unmodified lines if args.rich_annotations { return run_rich_annotations(&args); } if args.review_title_boundaries_lmstudio { return run_review_title_boundaries_lmstudio(&args); if args.review_title_boundaries_lmstudio || args.review_title_boundaries_pi_rpc { return run_review_title_boundaries(&args); } if args.expand != "all" && args.expand != "sample" { bail!("--expand must be all or sample");834 unmodified lines Ok(())}
fn run_review_title_boundaries_lmstudio(args: &Args) -> Result<()> {fn run_review_title_boundaries(args: &Args) -> Result<()> { if !(0.0..=1.0).contains(&args.title_boundary_min_similarity) || !(0.0..=1.0).contains(&args.title_boundary_max_similarity) || args.title_boundary_min_similarity > args.title_boundary_max_similarity10 unmodified lines let mut writer = BufWriter::new(File::create(&args.title_boundary_decisions_output)?); let mut reviewed = 0usize; let mut skipped = 0usize; if args.review_title_boundaries_lmstudio && args.review_title_boundaries_pi_rpc { bail!("choose only one title-boundary review backend: LM Studio or Pi RPC"); } let endpoint = format!( "{}/chat/completions", args.lmstudio_base_url.trim_end_matches('/') ); let mut pi_rpc = if args.review_title_boundaries_pi_rpc { Some(PiRpcClient::start(args.pi_rpc_model.as_deref())?) } else { None };
for recipe in recipes { let template_id = recipe28 unmodified lines } } let prompt = title_boundary_review_prompt(&recipe, &decision); let response = call_lmstudio_title_boundary( &endpoint, &args.lmstudio_model, args.lmstudio_temperature, args.lmstudio_timeout_seconds, &prompt, ) .with_context(|| { format!( "LM Studio title-boundary review failed for template {template_id} via {endpoint}" let content = if let Some(client) = pi_rpc.as_mut() { client.review(&prompt).with_context(|| { format!("Pi RPC title-boundary review failed for template {template_id}") })? } else { let response = call_lmstudio_title_boundary( &endpoint, &args.lmstudio_model, args.lmstudio_temperature, args.lmstudio_timeout_seconds, &prompt, ) .with_context(|| { format!( "LM Studio title-boundary review failed for template {template_id} via {endpoint}" ) })?; let content = response .get("choices") .and_then(Value::as_array) .and_then(|choices| choices.first()) .and_then(|choice| choice.get("message")) .and_then(|message| message.get("content")) .and_then(Value::as_str) .unwrap_or(""); let parsed = parse_lmstudio_json_object(content).unwrap_or_else(|| { })?; response .get("choices") .and_then(Value::as_array) .and_then(|choices| choices.first()) .and_then(|choice| choice.get("message")) .and_then(|message| message.get("content")) .and_then(Value::as_str) .unwrap_or("") .to_string() }; let parsed = parse_lmstudio_json_object(&content).unwrap_or_else(|| { json!({ "decision": "skip", "kind": "parse_error",12 unmodified lines "model_kind": parsed.get("kind").cloned().unwrap_or(Value::Null), "confidence": parsed.get("confidence").cloned().unwrap_or(Value::Null), "reason": parsed.get("reason").cloned().unwrap_or(Value::Null), "source": "lmstudio", "model": args.lmstudio_model, "source": if args.review_title_boundaries_pi_rpc { "pi-rpc" } else { "lmstudio" }, "model": if args.review_title_boundaries_pi_rpc { args.pi_rpc_model.as_deref().unwrap_or("pi-default") } else { args.lmstudio_model.as_str() }, "reviewed_at": Utc::now().to_rfc3339(), }); serde_json::to_writer(&mut writer, &output)?;7 unmodified lines "output": args.title_boundary_decisions_output.to_string_lossy(), "reviewed": reviewed, "skipped": skipped, "model": args.lmstudio_model, "base_url": args.lmstudio_base_url, "model": if args.review_title_boundaries_pi_rpc { args.pi_rpc_model.as_deref().unwrap_or("pi-default") } else { args.lmstudio_model.as_str() }, "backend": if args.review_title_boundaries_pi_rpc { "pi-rpc" } else { "lmstudio" }, "base_url": if args.review_title_boundaries_pi_rpc { "pi --mode rpc" } else { args.lmstudio_base_url.as_str() }, "similarity_range": [args.title_boundary_min_similarity, args.title_boundary_max_similarity], "generated_at": Utc::now().to_rfc3339(), });81 unmodified lines )}
struct PiRpcClient { child: Child, stdin: Option<ChildStdin>, stdout: BufReader<std::process::ChildStdout>, next_id: usize,}
impl PiRpcClient { fn start(model: Option<&str>) -> Result<Self> { let mut command = Command::new("pi"); command.args(["--mode", "rpc", "--no-session"]); if let Some(model) = model { command.args(["--model", model]); } let mut child = command .stdin(Stdio::piped()) .stdout(Stdio::piped()) .stderr(Stdio::inherit()) .spawn() .context("failed to start pi --mode rpc")?; let stdin = child .stdin .take() .ok_or_else(|| anyhow::anyhow!("failed to open Pi RPC stdin"))?; let stdout = child .stdout .take() .ok_or_else(|| anyhow::anyhow!("failed to open Pi RPC stdout"))?; Ok(Self { child, stdin: Some(stdin), stdout: BufReader::new(stdout), next_id: 0, }) }
fn review(&mut self, prompt: &str) -> Result<String> { let prompt_id = self.next_request_id("prompt"); self.send(json!({"id": prompt_id, "type": "prompt", "message": prompt}))?; let mut accepted = false; loop { let event = self.read_event()?; if event.get("type").and_then(Value::as_str) == Some("response") && event.get("id").and_then(Value::as_str) == Some(prompt_id.as_str()) { if !event .get("success") .and_then(Value::as_bool) .unwrap_or(false) { bail!("Pi RPC prompt rejected: {event}"); } accepted = true; continue; } if event.get("type").and_then(Value::as_str) == Some("agent_end") && accepted { break; } } let text = self.get_last_assistant_text()?; self.new_session()?; Ok(text) }
fn get_last_assistant_text(&mut self) -> Result<String> { let id = self.next_request_id("last"); self.send(json!({"id": id, "type": "get_last_assistant_text"}))?; loop { let event = self.read_event()?; if event.get("type").and_then(Value::as_str) == Some("response") && event.get("id").and_then(Value::as_str) == Some(id.as_str()) { if !event .get("success") .and_then(Value::as_bool) .unwrap_or(false) { bail!("Pi RPC get_last_assistant_text failed: {event}"); } return Ok(event .get("data") .and_then(|data| data.get("text")) .and_then(Value::as_str) .unwrap_or("") .to_string()); } } }
fn new_session(&mut self) -> Result<()> { let id = self.next_request_id("new"); self.send(json!({"id": id, "type": "new_session"}))?; loop { let event = self.read_event()?; if event.get("type").and_then(Value::as_str) == Some("response") && event.get("id").and_then(Value::as_str) == Some(id.as_str()) { if !event .get("success") .and_then(Value::as_bool) .unwrap_or(false) { bail!("Pi RPC new_session failed: {event}"); } return Ok(()); } } }
fn next_request_id(&mut self, prefix: &str) -> String { self.next_id += 1; format!("{prefix}-{}", self.next_id) }
fn send(&mut self, value: Value) -> Result<()> { let stdin = self .stdin .as_mut() .ok_or_else(|| anyhow::anyhow!("Pi RPC stdin is closed"))?; serde_json::to_writer(&mut *stdin, &value)?; stdin.write_all(b"\n")?; stdin.flush()?; Ok(()) }
fn read_event(&mut self) -> Result<Value> { let mut line = String::new(); let bytes = self.stdout.read_line(&mut line)?; if bytes == 0 { bail!("Pi RPC process exited"); } let line = line.trim_end_matches(['\r', '\n']); serde_json::from_str(line).with_context(|| format!("invalid Pi RPC JSON line: {line}")) }}
impl Drop for PiRpcClient { fn drop(&mut self) { let _ = self.stdin.take(); let _ = self.child.wait(); }}
fn call_lmstudio_title_boundary( endpoint: &str, model: &str,tools/rust_dmhy_template_apply/README.md+14-3
tools/rust_dmhy_template_apply/src/main.rs+191-27