Make TransformerDetector a deprecated subclass of EncoderDetector
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
- 54/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend, machine-learning
Direzione di ricerca
Start by reading lettucedetect/detectors/transformer.py and the EncoderDetector implementation, then run the listed pytest command. Check how TransformerDetector construction, prediction, and __new__ callers behave, including the stated golden files and threaded case. Done means the acceptance criteria pass, including the deprecation warning behavior and the documented deprecation note.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Parent: #148 · Epic: #126 · Blocked by: #149, #150, #151
Branch from stateless_core; open the PR against it.
Problem
TransformerDetector and EncoderDetector must be one implementation. Old callers (including HallucinationDetector and an evaluation script that uses __new__) must keep working unchanged.
Current behavior
lettucedetect/detectors/transformer.py:19TransformerDetector(BaseDetector)with constructor:28takingmodel_path, max_length, device, lang, taxonomy_head, include_taxonomy, batch_size, **tok_kwargs.predict(:449),predict_prompt(:489) andpredict_prompt_batch(:528) hold the scoring and conversion logic.- An evaluation script builds one with
__new__and setsmodel,tokenizer,device,max_length,lang,typerby hand.
Steps
- Change
TransformerDetectorto subclassEncoderDetector; its constructor callsfrom_pretrainedlogic and keeps attributesmodel,tokenizer,device,max_length,lang,batch_size,typerand the private method names (_predict_single,_predict_batch,_predict_chunked, …) that existing tests patch. - Mark it deprecated (helper from #135) naming
EncoderDetector.from_pretrained; in-package calls stay silent. predictandpredict_promptdelegate throughdetect;predict_prompt_batchstays as is until #178.- Keep
**tok_kwargs. TransformerDetectorexposesdetectandadetectby inheriting them fromEncoderDetector; they take the same arguments, supportinclude_tokens, and return the sameDetectionas anEncoderDetectorbuilt from the same model. Calling them emits no deprecation warning (the warning is on construction). Itsmodel_idismodel_path.
Acceptance criteria
-
TransformerDetector(model_path=...)from a test warnsLettuceDetectDeprecationWarning; from inside the package it doesn't. -
predict/predict_promptoutput equals the #128 golden files. -
detectandadetecton aTransformerDetectorreturn a result equal to anEncoderDetectorbuilt from the same stub model, withinclude_tokens=Trueworking, and calling them adds no warning beyond the one from construction. - A
TransformerDetectormade with__new__and only the six attributes set still answerspredictwith spans. - A
TransformerDetectormade with__new__answerspredictfrom several threads at once with the right results (the lock from #149 is created on first use). - Existing tests pass unchanged; docstring has the
.. deprecated::note.
Start here
uv run --extra dev pytest tests/test_inference_pytest.py tests/test_custom_taxonomy_pytest.py tests/test_golden_transformer_pytest.py -q
- Lingua principale
- Python
- Stelle
- 615
- Fork
- 60
- Merge medio
- 1g 8h
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di KRLabsOrg/LettuceDetect
-
Stop-hook --min-confidence drops every --llm-model span (missing confidence treated as 0.0), reporting hallucinated answers as cleanForse già presa @Clannad47 l’ha presa 17 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
KRLabsOrg/LettuceDetect#117 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
KRLabsOrg/LettuceDetect#108 ·
I maintainer di solito rispondono entro 1 giorno
-
Add AGENTS.md: one entry file for coding agents and new contributorsForse già presa @ShryukGrandhi l’ha presa 18 giorni fa. Apertadocumentation
Difficoltà 2/5 Mezza giornata Idoneità per principianti 70/100
KRLabsOrg/LettuceDetect#104 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
KRLabsOrg/LettuceDetect#181 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
KRLabsOrg/LettuceDetect#180 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di KRLabsOrg/LettuceDetect
Issue simili
-
[BUG]: Compliance rules never see Unity Catalog views as viewsForse già presa @wagnercsantos l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
databrickslabs/ontos#1348 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ibm-granite/granite.build#649 ·
I maintainer di solito rispondono entro 1 giorno
-
`forum_pr_poster` action will always return `none` when checking for pre-existing feedback threads, even if a feedback thread already exists.Forse già presa @pgmzeta l’ha presa oggi. ApertaE-Verified P-Major
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
goonstation/goonstation#28259 ·
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
woonstadrotterdam/monumenten#70 ·
I maintainer di solito rispondono entro 15 giorni
-
binding:python bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno