From c7869750eea60b2901b16e34aa0b6abd50a52afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danie=CC=88l=20de=20Kok?= Date: Fri, 13 Jan 2023 16:28:37 +0100 Subject: [PATCH] Add comment to explain `is_distillable` --- spacy/pipeline/trainable_pipe.pyx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spacy/pipeline/trainable_pipe.pyx b/spacy/pipeline/trainable_pipe.pyx index f0260c7c0..77259fc0b 100644 --- a/spacy/pipeline/trainable_pipe.pyx +++ b/spacy/pipeline/trainable_pipe.pyx @@ -267,6 +267,10 @@ cdef class TrainablePipe(Pipe): @property def is_distillable(self) -> bool: + # Normally a pipe overrides `get_teacher_student_loss` to implement + # distillation. In more exceptional cases, a pipe can provide its + # own `distill` implementation. If neither of these methods is + # overridden, the pipe does not implement distillation. return not (self.__class__.distill is TrainablePipe.distill and self.__class__.get_teacher_student_loss is TrainablePipe.get_teacher_student_loss) @property