Sync from GitHub via hub-sync
Browse files- GLINER2-NOTES.md +15 -0
- classify-gliner2.py +1 -1
- train-gliner2.py +3 -3
GLINER2-NOTES.md
CHANGED
|
@@ -15,6 +15,18 @@ Each README command was run from the branch before merge (`t4-small`, 2026-09-23
|
|
| 15 |
| classify zero-shot, `fancyzhx/ag_news` test, 4 labels | 7,600 rows labelled | 96 s | ~$0.02 |
|
| 16 |
| train, `fancyzhx/ag_news`, `--max-train-samples 2000 --epochs 2` | 0.733 → 0.873 (2,000 test rows) | 137 s training, 298 s whole Job | ~$0.03 |
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
The ag_news README row (0.718 → 0.852) and this run (0.733 → 0.873) differ because the 2,000
|
| 19 |
scored test rows are a different random sample. Expect roughly 0.72 → 0.85–0.87.
|
| 20 |
|
|
@@ -83,6 +95,9 @@ column names and first row (the worked example in the README).
|
|
| 83 |
- Development top-1 in the owner's tags: base 0.695 / 0.686 (two seeds), small 0.653, zero-shot
|
| 84 |
0.102. Always answering "text-generation" scores 0.320, so zero-shot is below a constant guess.
|
| 85 |
- `--label-augmentation upstream` (gliner2's default) scored 0.664: turning it off added 2–3 points.
|
|
|
|
|
|
|
|
|
|
| 86 |
- The two seeds differ by about 1 point, almost all of it on one owner's 33 near-identical
|
| 87 |
datasets that the model labels tabular-regression or tabular-classification depending on the seed.
|
| 88 |
- Owner tags are noisy: in a hand-checked sample, about 1 in 10 datasets was missing a tag that fits.
|
|
|
|
| 15 |
| classify zero-shot, `fancyzhx/ag_news` test, 4 labels | 7,600 rows labelled | 96 s | ~$0.02 |
|
| 16 |
| train, `fancyzhx/ag_news`, `--max-train-samples 2000 --epochs 2` | 0.733 → 0.873 (2,000 test rows) | 137 s training, 298 s whole Job | ~$0.03 |
|
| 17 |
|
| 18 |
+
Re-run after the bump to `gliner2` 2.1.0 (`t4-small`, seed 42, 2026-10-22), same BL books command:
|
| 19 |
+
|
| 20 |
+
| Run | Fine-tuned (174 rows) | Training |
|
| 21 |
+
|---|---|---|
|
| 22 |
+
| 2.1.0, defaults | 0.902 | 145 s |
|
| 23 |
+
| 2.1.0, `--label-augmentation off` | 0.937 | 135 s |
|
| 24 |
+
| 2.0.0, `--label-augmentation off` | 0.931 | 135 s |
|
| 25 |
+
| classify with an existing fine-tuned model, 2.1.0 | 500 rows in 13 s | – |
|
| 26 |
+
|
| 27 |
+
Zero-shot is 0.793 in all three. One seed each, and five 2.0.0 seeds on this split ranged
|
| 28 |
+
0.897–0.925, so these differences are within the noise.
|
| 29 |
+
|
| 30 |
The ag_news README row (0.718 → 0.852) and this run (0.733 → 0.873) differ because the 2,000
|
| 31 |
scored test rows are a different random sample. Expect roughly 0.72 → 0.85–0.87.
|
| 32 |
|
|
|
|
| 95 |
- Development top-1 in the owner's tags: base 0.695 / 0.686 (two seeds), small 0.653, zero-shot
|
| 96 |
0.102. Always answering "text-generation" scores 0.320, so zero-shot is below a constant guess.
|
| 97 |
- `--label-augmentation upstream` (gliner2's default) scored 0.664: turning it off added 2–3 points.
|
| 98 |
+
This was measured on `gliner2` 2.0.0. In that version, label augmentation sometimes trained the
|
| 99 |
+
real label as a negative (fixed in 2.1.0, [GLiNER2#187](https://github.com/fastino-ai/GLiNER2/pull/187)),
|
| 100 |
+
so the gap may be smaller on 2.1.0. Not re-measured; `off` is still the right choice for a fixed label set.
|
| 101 |
- The two seeds differ by about 1 point, almost all of it on one owner's 33 near-identical
|
| 102 |
datasets that the model labels tabular-regression or tabular-classification depending on the seed.
|
| 103 |
- Owner tags are noisy: in a hand-checked sample, about 1 in 10 datasets was missing a tag that fits.
|
classify-gliner2.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11,<3.14"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "gliner2[local]==2.
|
| 5 |
# "protobuf",
|
| 6 |
# "sentencepiece",
|
| 7 |
# "datasets>=4.0.0,<6",
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11,<3.14"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "gliner2[local]==2.1.0",
|
| 5 |
# "protobuf",
|
| 6 |
# "sentencepiece",
|
| 7 |
# "datasets>=4.0.0,<6",
|
train-gliner2.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11,<3.14"
|
| 3 |
# dependencies = [
|
| 4 |
-
# "gliner2[train]==2.
|
| 5 |
# "protobuf",
|
| 6 |
# "sentencepiece",
|
| 7 |
# "datasets>=4.0.0,<6",
|
|
@@ -528,8 +528,8 @@ def resolve_precision(requested: str) -> str:
|
|
| 528 |
def resolve_sampling_config(mode: str) -> SamplingConfig:
|
| 529 |
"""Pick the gliner2 training-time label augmentation.
|
| 530 |
|
| 531 |
-
"upstream" is gliner2 2.0.0
|
| 532 |
-
training row, it replaces the real label names with "label 1", "label 2", ... half of the
|
| 533 |
time (synthetic_label_prob=0.5), and drops a random share of up to half of the labels
|
| 534 |
(remove_classification_label_prob=0.5; the true label is then put back only half of the
|
| 535 |
time). That teaches a general zero-shot model to cope with unseen label sets.
|
|
|
|
| 1 |
# /// script
|
| 2 |
# requires-python = ">=3.11,<3.14"
|
| 3 |
# dependencies = [
|
| 4 |
+
# "gliner2[train]==2.1.0",
|
| 5 |
# "protobuf",
|
| 6 |
# "sentencepiece",
|
| 7 |
# "datasets>=4.0.0,<6",
|
|
|
|
| 528 |
def resolve_sampling_config(mode: str) -> SamplingConfig:
|
| 529 |
"""Pick the gliner2 training-time label augmentation.
|
| 530 |
|
| 531 |
+
"upstream" is gliner2's default SamplingConfig (unchanged from 2.0.0 to 2.1.0). For each
|
| 532 |
+
classification task in each training row, it replaces the real label names with "label 1", "label 2", ... half of the
|
| 533 |
time (synthetic_label_prob=0.5), and drops a random share of up to half of the labels
|
| 534 |
(remove_classification_label_prob=0.5; the true label is then put back only half of the
|
| 535 |
time). That teaches a general zero-shot model to cope with unseen label sets.
|