Add the model registry and load_detector

Aperta
#173 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, pytorch

Direzione di ricerca

Start with lettucedetect/detectors/factory.py, llm.py, and tests/test_factory_pytest.py; run the issue's pytest command to see the current factory behavior. Check the detector constructors and config handling before adding the private model registry and load_detector. Done means the registered ids resolve to the expected classes, the specified errors and option routing are tested, and the tests pass without network access.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ready-for-agent

Parent: #172 · Epic: #126 · Blocked by: #152, #155, #165
Branch from stateless_core; open the PR against it.

Problem

Detectors are chosen by method string and, inside LLMDetector, by looking for substrings in the model name. A typo silently falls through, and a model that needs a client fails late.

Current behavior

  • lettucedetect/detectors/factory.py:10-32 make_detector(method, **kwargs) passes kwargs through.
  • llm.py:26 _looks_native guesses judge vs generative from the name.

Steps

  1. Add lettucedetect/detectors/registry.py with a private mapping from KR Labs model id to detector class: encoders KRLabsOrg/lettucedect-base-modernbert-en-v1, ...-large-modernbert-en-v1, lettucedect-v2-mmbert-base, lettucedect-mmbert-base-hu-v1, lettucedect-210m-eurobert-{de,pl,it,fr,es,cn}-v1, lettucedect-610m-eurobert-de-v1, tinylettuce-ettin-17m-en; generative KRLabsOrg/lettucedect-v2-qwen-2b. Confirm each id on the Hugging Face Hub before merging and say so in the PR.
  2. load_detector(model_id, *, client=None, device=None, model_version=None, **options): encoders → EncoderDetector.from_pretrained; generative → GenerativeDetector (requires client). options go to the config or from_pretrained.
  3. Unknown id → InvalidInputError (unknown_model_id, param model_id) listing the known ids, no default fallback. Generative id without client → ConfigurationError (client_required). An argument the entry doesn't accept (e.g. client for an encoder, device for a generative id) → ConfigurationError (invalid_config).
  4. No public registration function; RAGFactCheckerDetector is not in the registry. Export load_detector.

Acceptance criteria

  • A test resolves every registered id with fakes in place of loading and checks the class.
  • The three error cases tested; options reach the right place (taxonomy_head, include_taxonomy, include_reasoning).
  • No code outside LLMDetector decides judge vs generative by model name.
  • Network-free; existing tests pass; follows CONTRIBUTING "Errors and logging".

Start here

uv run --extra dev pytest tests/test_factory_pytest.py -q
Lingua principale
Python
Stelle
615
Fork
60
Merge medio
1g 8h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di KRLabsOrg/LettuceDetect

Tutte le issue di KRLabsOrg/LettuceDetect

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.