Token Classification
Transformers
ONNX
Safetensors
English
Japanese
Chinese
bert
anime
filename-parsing
Eval Results (legacy)
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")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("ModerRAS/AniFileBERT") model = AutoModelForTokenClassification.from_pretrained("ModerRAS/AniFileBERT") - Notebooks
- Google Colab
- Kaggle
colab: onnx导出改为非阻塞+补全onnxscript
Browse files- colab_train.py +11 -8
colab_train.py
CHANGED
|
@@ -76,7 +76,7 @@ print("\n" + "=" * 60)
|
|
| 76 |
print("STEP 3: Install dependencies")
|
| 77 |
print("=" * 60)
|
| 78 |
# Colab comes with PyTorch + CUDA pre-installed. Just install the extras.
|
| 79 |
-
run("pip install transformers accelerate seqeval onnx onnxruntime")
|
| 80 |
|
| 81 |
# ── 4. Verify GPU ──────────────────────────────────────────────
|
| 82 |
print("\n" + "=" * 60)
|
|
@@ -113,16 +113,19 @@ run(
|
|
| 113 |
f"--no-shuffle"
|
| 114 |
)
|
| 115 |
|
| 116 |
-
# ── 7. Export ONNX ──────────────────────────────────
|
| 117 |
print("\n" + "=" * 60)
|
| 118 |
-
print("STEP 7: Export ONNX (optional)")
|
| 119 |
print("=" * 60)
|
| 120 |
ONNX_OUT = os.path.join(SAVE_DIR, "..", "anime_filename_parser.onnx")
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
# ── 8. Summary ─────────────────────────────────────────────────
|
| 128 |
print("\n" + "=" * 60)
|
|
|
|
| 76 |
print("STEP 3: Install dependencies")
|
| 77 |
print("=" * 60)
|
| 78 |
# Colab comes with PyTorch + CUDA pre-installed. Just install the extras.
|
| 79 |
+
run("pip install transformers accelerate seqeval onnx onnxruntime onnxscript")
|
| 80 |
|
| 81 |
# ── 4. Verify GPU ──────────────────────────────────────────────
|
| 82 |
print("\n" + "=" * 60)
|
|
|
|
| 113 |
f"--no-shuffle"
|
| 114 |
)
|
| 115 |
|
| 116 |
+
# ── 7. Export ONNX (optional) ──────────────────────────────────
|
| 117 |
print("\n" + "=" * 60)
|
| 118 |
+
print("STEP 7: Export ONNX (optional — skip if it fails)")
|
| 119 |
print("=" * 60)
|
| 120 |
ONNX_OUT = os.path.join(SAVE_DIR, "..", "anime_filename_parser.onnx")
|
| 121 |
+
try:
|
| 122 |
+
run(
|
| 123 |
+
f"python export_onnx.py "
|
| 124 |
+
f"--model-dir {SAVE_DIR}/final "
|
| 125 |
+
f"--output {ONNX_OUT}"
|
| 126 |
+
)
|
| 127 |
+
except Exception as e:
|
| 128 |
+
print(f"[WARN] ONNX export skipped: {e}")
|
| 129 |
|
| 130 |
# ── 8. Summary ─────────────────────────────────────────────────
|
| 131 |
print("\n" + "=" * 60)
|