Spaces:
Running
Running
Rename to SIMPLE Score (simple-score)
Browse filesFiles changed (5)
- README.md+12-12
- demo.js+1-1
- index.html+13-13
- model/manifest.json+1-1
- simple.py → simple-score.pyRenamed+18-18
123456 unmodified lines1213141516171819202122232425262 unmodified lines293031323334354 unmodified lines40414243444546474849505152535455565758596 unmodified lines66676869707172---title: SIMPLEemoji: 🧩colorFrom: bluecolorTo: green6 unmodified lines- metric- text-simplificationdescription: >-SIMPLE: a reference-free learned metric for text simplification that also reports itsown uncertainty.---# Metric Card for SIMPLE## Metric descriptionSIMPLE (SImplicity Metric via Preference LEarning) scores a candidate simplificationagainst its source sentence, without references. It returns:- **score** `mu` in (-1, 1): +1 = highly successful simplification, 0 = verbatim copy of2 unmodified lines- **uncertainty** `sigma` (> 0.05): the model's confidence in that score; lower = moreconfident. Predictions with low sigma agree more often with human judgements.SIMPLE is a DeBERTa-v3 cross-encoder trained with a Thurstone pairwise preference loss andcalibrated on human quality ratings with a Gaussian likelihood. Three sizes are available.This Space's page runs an in-browser demo (SIMPLE-small with 8-bit weights, via ONNX Runtime4 unmodified lines```pythonimport evaluatesimple = evaluate.load("mpapucci/simple") # SIMPLE-large (default)# simple = evaluate.load("mpapucci/simple", "base") # or "small"out = simple.compute(sources=["The feline perched upon the mat in a state of repose."],predictions=["The cat sat on the mat."],)print(out["simple"], out["scores"], out["sigmas"])```This needs `pip install simple-metric`. The package can also be used directly, which avoidsthe `evaluate` dependency:```pythonfrom simple_metric import SIMPLEmetric = SIMPLE.from_pretrained("large")metric.score(sources, predictions)```6 unmodified lines### Output values- `simple` (float): mean score.- `scores` (list of float): per-example score `mu`.- `sigmas` (list of float): per-example uncertainty `sigma`.123456 unmodified lines1213141516171819202122232425262 unmodified lines293031323334354 unmodified lines40414243444546474849505152535455565758596 unmodified lines66676869707172---title: SIMPLE Scoreemoji: 🧩colorFrom: bluecolorTo: green6 unmodified lines- metric- text-simplificationdescription: >-SIMPLE Score: a reference-free learned metric for text simplification that also reports itsown uncertainty.---# Metric Card for SIMPLE Score## Metric descriptionSIMPLE Score (SImplicity Metric via Preference LEarning) scores a candidate simplificationagainst its source sentence, without references. It returns:- **score** `mu` in (-1, 1): +1 = highly successful simplification, 0 = verbatim copy of2 unmodified lines- **uncertainty** `sigma` (> 0.05): the model's confidence in that score; lower = moreconfident. Predictions with low sigma agree more often with human judgements.SIMPLE Score is a DeBERTa-v3 cross-encoder trained with a Thurstone pairwise preference loss andcalibrated on human quality ratings with a Gaussian likelihood. Three sizes are available.This Space's page runs an in-browser demo (SIMPLE-small with 8-bit weights, via ONNX Runtime4 unmodified lines```pythonimport evaluatesimple_score = evaluate.load("mpapucci/simple-score") # SIMPLE-large (default)# simple_score = evaluate.load("mpapucci/simple-score", "base") # or "small"out = simple_score.compute(sources=["The feline perched upon the mat in a state of repose."],predictions=["The cat sat on the mat."],)print(out["simple_score"], out["scores"], out["sigmas"])```This needs `pip install simple-score`. The package can also be used directly, which avoidsthe `evaluate` dependency:```pythonfrom simple_score import SIMPLEmetric = SIMPLE.from_pretrained("large")metric.score(sources, predictions)```6 unmodified lines### Output values- `simple_score` (float): mean score.- `scores` (list of float): per-example score `mu`.- `sigmas` (list of float): per-example uncertainty `sigma`.
6 unmodified lines789101112136 unmodified linesconst ORT_BASE = `https://cdn.jsdelivr.net/npm/onnxruntime-web@${ORT_VERSION}/dist/`;const TOKENIZERS_URL = `https://cdn.jsdelivr.net/npm/@huggingface/tokenizers@${TOKENIZERS_VERSION}/dist/tokenizers.min.mjs`;const MANIFEST_URL = "model/manifest.json";const CACHE_PREFIX = "simple-metric-demo-";const MAX_TOKENS = 512;const $ = (id) => document.getElementById(id);6 unmodified lines789101112136 unmodified linesconst ORT_BASE = `https://cdn.jsdelivr.net/npm/onnxruntime-web@${ORT_VERSION}/dist/`;const TOKENIZERS_URL = `https://cdn.jsdelivr.net/npm/@huggingface/tokenizers@${TOKENIZERS_VERSION}/dist/tokenizers.min.mjs`;const MANIFEST_URL = "model/manifest.json";const CACHE_PREFIX = "simple-score-demo-";const MAX_TOKENS = 512;const $ = (id) => document.getElementById(id);
2 unmodified lines34567891011134 unmodified lines1461471481491501511526 unmodified lines15916016116216316416557 unmodified lines2232242252262272282292301 unmodified line2322332342352362372382392402412422432442452462472 unmodified lines<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>SIMPLE metric</title><link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%232457c5'/%3E%3Cpath d='M8 21h16M8 15h11M8 9h16' stroke='white' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"><meta name="description" content="SIMPLE: a reference-free metric for sentence simplification that also reports its own uncertainty. Try it in your browser."><script>// Apply the saved theme before the page is drawn (no flash of the wrong theme).try {134 unmodified lines<main><header><div class="top"><h1>SIMPLE</h1><div class="theme" role="group" aria-label="Colour theme"><button type="button" data-theme-choice="auto">Auto</button><button type="button" data-theme-choice="light">Light</button>6 unmodified lines<section aria-labelledby="read-title"><h2 id="read-title">Reading the score</h2><p>SIMPLE returns a score <strong>μ</strong> between −1 and +1 for each (source, simplification) pair:</p><div class="scale" aria-hidden="true"></div><div class="scale-labels"><span>−1 unrelated, degenerate text or complexification</span><span>0 copy of the source</span><span>+1 successful simplification</span></div><p class="small muted" style="margin-top:12px">Negative scores flag unsuccessful simplifications, including57 unmodified lines<section aria-labelledby="use-title"><h2 id="use-title">Use it in Python</h2><pre><code>pip install simple-metric</code></pre><pre><code>from simple_metric import SIMPLEmetric = SIMPLE.from_pretrained("large") # or "small", "base"out = metric.score(sources, simplifications)1 unmodified line<p>With 🤗 Evaluate:</p><pre><code>import evaluatesimple = evaluate.load("mpapucci/simple", "large")simple.compute(sources=sources, predictions=simplifications)</code></pre><p class="small muted">Models: <a href="https://huggingface.co/mpapucci/simple-metric-small" target="_blank" rel="noopener noreferrer">small</a>,<a href="https://huggingface.co/mpapucci/simple-metric-base" target="_blank" rel="noopener noreferrer">base</a>,<a href="https://huggingface.co/mpapucci/simple-metric-large" target="_blank" rel="noopener noreferrer">large</a>.Code and training: <a href="https://github.com/michelepapucci/simple-metric" target="_blank" rel="noopener noreferrer">github.com/michelepapucci/simple-metric</a>.Paper: <em>Rethinking Text Simplification Evaluation as Preference Learning</em> (link coming soon).</p></section><footer>SIMPLE · MIT License ·<a href="http://www.italianlp.it/" target="_blank" rel="noopener noreferrer">ItaliaNLP Lab @ CNR-ILC</a> ·<a href="https://michelepapucci.github.io/" target="_blank" rel="noopener noreferrer">Michele Papucci</a></footer></main>2 unmodified lines34567891011134 unmodified lines1461471481491501511526 unmodified lines15916016116216316416557 unmodified lines2232242252262272282292301 unmodified line2322332342352362372382392402412422432442452462472 unmodified lines<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>SIMPLE Score</title><link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%232457c5'/%3E%3Cpath d='M8 21h16M8 15h11M8 9h16' stroke='white' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"><meta name="description" content="SIMPLE Score: a reference-free metric for sentence simplification that also reports its own uncertainty. Try it in your browser."><script>// Apply the saved theme before the page is drawn (no flash of the wrong theme).try {134 unmodified lines<main><header><div class="top"><h1>SIMPLE Score</h1><div class="theme" role="group" aria-label="Colour theme"><button type="button" data-theme-choice="auto">Auto</button><button type="button" data-theme-choice="light">Light</button>6 unmodified lines<section aria-labelledby="read-title"><h2 id="read-title">Reading the score</h2><p>SIMPLE Score returns a score <strong>μ</strong> between −1 and +1 for each (source, simplification) pair:</p><div class="scale" aria-hidden="true"></div><div class="scale-labels"><span>−1 unrelated, degenerate text or complexification</span><span>0 copy of the source</span><span>+1 successful simplification</span></div><p class="small muted" style="margin-top:12px">Negative scores flag unsuccessful simplifications, including57 unmodified lines<section aria-labelledby="use-title"><h2 id="use-title">Use it in Python</h2><pre><code>pip install simple-score</code></pre><pre><code>from simple_score import SIMPLEmetric = SIMPLE.from_pretrained("large") # or "small", "base"out = metric.score(sources, simplifications)1 unmodified line<p>With 🤗 Evaluate:</p><pre><code>import evaluatesimple_score = evaluate.load("mpapucci/simple-score", "large")simple_score.compute(sources=sources, predictions=simplifications)</code></pre><p class="small muted">Models: <a href="https://huggingface.co/mpapucci/simple-score-small" target="_blank" rel="noopener noreferrer">small</a>,<a href="https://huggingface.co/mpapucci/simple-score-base" target="_blank" rel="noopener noreferrer">base</a>,<a href="https://huggingface.co/mpapucci/simple-score-large" target="_blank" rel="noopener noreferrer">large</a>.Code and training: <a href="https://github.com/michelepapucci/simple-score" target="_blank" rel="noopener noreferrer">github.com/michelepapucci/simple-score</a>.Paper: <em>Rethinking Text Simplification Evaluation as Preference Learning</em> (link coming soon).</p></section><footer>SIMPLE Score · MIT License ·<a href="http://www.italianlp.it/" target="_blank" rel="noopener noreferrer">ItaliaNLP Lab @ CNR-ILC</a> ·<a href="https://michelepapucci.github.io/" target="_blank" rel="noopener noreferrer">Michele Papucci</a></footer></main>
13 unmodified lines1415161718192013 unmodified lines"version": "small-int8-e2dbc3d43fa5","runtime_bytes": 14848852,"export_report": {"model": "/tmp/claude-1006/-home-mpapucci-SimRM/02346888-ac69-4314-bd7b-2417b261b6ab/scratchpad/hfcache/models--mpapucci--simple-metric-small/snapshots/da4a27472fda25177e4122ea6f50bffd425249c9","sizes_mb": {"model.onnx": 539.5,"model_quantized.onnx": 157.613 unmodified lines1415161718192013 unmodified lines"version": "small-int8-e2dbc3d43fa5","runtime_bytes": 14848852,"export_report": {"model": "mpapucci/simple-score-small","sizes_mb": {"model.onnx": 539.5,"model_quantized.onnx": 157.6
123456789101112131415161718192021222324252627282930315 unmodified lines37383940414243444546474849505152535455565758592 unmodified lines62636465666768696 unmodified lines7677787980818283848586"""SIMPLE as a Hugging Face `evaluate` metric.import evaluatesimple = evaluate.load("mpapucci/simple") # SIMPLE-largesimple = evaluate.load("mpapucci/simple", "base") # or "small"out = simple.compute(sources=[...], predictions=[...])This module is a thin wrapper around the `simple-metric` package(`pip install simple-metric`), which can also be used directly."""import datasetsimport evaluate_CITATION = """\@misc{simple-metric,title = {Rethinking Text Simplification Evaluation as Preference Learning},note = {Citation will be added upon publication},}"""_DESCRIPTION = """\SIMPLE (SImplicity Metric via Preference LEarning) is a reference-free learned metric forsentence simplification. Given a source sentence and a candidate simplification it returns aquality score in (-1, 1): +1 for a highly successful simplification, 0 for a verbatim copy ofthe source, and -1 for unrelated or degenerate text; negative scores flag unsuccessfulsimplifications, including complexifications. With every score it also reports sigma, themodel's own uncertainty (lower = more confident). SIMPLE is a DeBERTa-v3 cross-encoder trainedon pairwise preferences between simplifications (Thurstone model) and calibrated on humanquality ratings. No reference simplifications are needed."""5 unmodified linesbatch_size (int, optional): batch size for scoring. Defaults to 32.device (str, optional): e.g. "cuda", "cuda:1" or "cpu". Defaults to CUDA when available.Returns:simple (float): mean SIMPLE score over all examples, in (-1, 1).scores (list of float): per-example scores (mu).sigmas (list of float): per-example uncertainty (sigma > 0.05; lower = more confident).Examples:>>> simple = evaluate.load("mpapucci/simple")>>> out = simple.compute(... sources=["The feline perched upon the mat in a state of repose."],... predictions=["The cat sat on the mat."])>>> sorted(out)['scores', 'sigmas', 'simple']"""_SIZES = ("small", "base", "large")@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)class Simple(evaluate.Metric):def _info(self):return evaluate.MetricInfo(description=_DESCRIPTION,2 unmodified linesfeatures=datasets.Features({"sources": datasets.Value("string"), "predictions": datasets.Value("string")}),codebase_urls=["https://github.com/michelepapucci/simple-metric"],reference_urls=["https://huggingface.co/mpapucci/simple-metric-large"],)def _download_and_prepare(self, dl_manager):6 unmodified linesdef _scorer(self, device):key = str(device)if key not in self._scorers:from simple_metric import SIMPLEself._scorers[key] = SIMPLE.from_pretrained(self._model_name, device=device)return self._scorers[key]def _compute(self, sources, predictions, batch_size=32, device=None):out = self._scorer(device).score(sources, predictions, batch_size=batch_size)return {"simple": out.mean, "scores": out.mu, "sigmas": out.sigma}123456789101112131415161718192021222324252627282930315 unmodified lines37383940414243444546474849505152535455565758592 unmodified lines62636465666768696 unmodified lines7677787980818283848586"""SIMPLE Score as a Hugging Face `evaluate` metric.import evaluatesimple_score = evaluate.load("mpapucci/simple-score") # SIMPLE-largesimple_score = evaluate.load("mpapucci/simple-score", "base") # or "small"out = simple_score.compute(sources=[...], predictions=[...])This module is a thin wrapper around the `simple-score` package(`pip install simple-score`), which can also be used directly."""import datasetsimport evaluate_CITATION = """\@misc{simple-score,title = {Rethinking Text Simplification Evaluation as Preference Learning},note = {Citation will be added upon publication},}"""_DESCRIPTION = """\SIMPLE Score (SImplicity Metric via Preference LEarning) is a reference-free learned metric forsentence simplification. Given a source sentence and a candidate simplification it returns aquality score in (-1, 1): +1 for a highly successful simplification, 0 for a verbatim copy ofthe source, and -1 for unrelated or degenerate text; negative scores flag unsuccessfulsimplifications, including complexifications. With every score it also reports sigma, themodel's own uncertainty (lower = more confident). SIMPLE Score is a DeBERTa-v3 cross-encoder trainedon pairwise preferences between simplifications (Thurstone model) and calibrated on humanquality ratings. No reference simplifications are needed."""5 unmodified linesbatch_size (int, optional): batch size for scoring. Defaults to 32.device (str, optional): e.g. "cuda", "cuda:1" or "cpu". Defaults to CUDA when available.Returns:simple_score (float): mean SIMPLE Score over all examples, in (-1, 1).scores (list of float): per-example scores (mu).sigmas (list of float): per-example uncertainty (sigma > 0.05; lower = more confident).Examples:>>> simple_score = evaluate.load("mpapucci/simple-score")>>> out = simple_score.compute(... sources=["The feline perched upon the mat in a state of repose."],... predictions=["The cat sat on the mat."])>>> sorted(out)['scores', 'sigmas', 'simple_score']"""_SIZES = ("small", "base", "large")@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)class SimpleScore(evaluate.Metric):def _info(self):return evaluate.MetricInfo(description=_DESCRIPTION,2 unmodified linesfeatures=datasets.Features({"sources": datasets.Value("string"), "predictions": datasets.Value("string")}),codebase_urls=["https://github.com/michelepapucci/simple-score"],reference_urls=["https://huggingface.co/mpapucci/simple-score-large"],)def _download_and_prepare(self, dl_manager):6 unmodified linesdef _scorer(self, device):key = str(device)if key not in self._scorers:from simple_score import SIMPLEself._scorers[key] = SIMPLE.from_pretrained(self._model_name, device=device)return self._scorers[key]def _compute(self, sources, predictions, batch_size=32, device=None):out = self._scorer(device).score(sources, predictions, batch_size=batch_size)return {"simple_score": out.mean, "scores": out.mu, "sigmas": out.sigma}
README.md+12-12
demo.js+1-1
index.html+13-13
model/manifest.json+1-1
simple.py → simple-score.pyRenamed+18-18