MCPcopy Create free account
hub / github.com/PAIR-code/lit / _warm_start

Method _warm_start

lit_nlp/app.py:811–829  ·  view source on GitHub ↗

Warm-up the predictions cache by making some model calls.

(self,
                  rate: float,
                  progress_indicator: Optional[ProgressIndicator] = None)

Source from the content-addressed store, hash-verified

809 self._models[model], datasets_to_validate[dataset], report_all)
810
811 def _warm_start(self,
812 rate: float,
813 progress_indicator: Optional[ProgressIndicator] = None):
814 """Warm-up the predictions cache by making some model calls."""
815 assert rate >= 0 and rate <= 1
816 for model, model_info in self._info['models'].items():
817 for dataset_name in model_info['datasets']:
818 logging.info("Warm-start of model '%s' on dataset '%s'", model,
819 dataset_name)
820 all_examples: list[IndexedInput] = self._get_dataset([], dataset_name)
821 if rate < 1:
822 examples = random.sample(all_examples, int(len(all_examples) * rate))
823 logging.info('Partial warm-start: running on %d/%d examples.',
824 len(examples), len(all_examples))
825 else:
826 examples = all_examples
827 _ = self._get_preds(data={'inputs': examples},
828 model=model,
829 progress_indicator=progress_indicator)
830
831 def _warm_projections(self, interpreters: list[str]):
832 """Pre-compute UMAP/PCA projections with default arguments."""

Callers 1

__init__Method · 0.95

Calls 4

_get_datasetMethod · 0.95
_get_predsMethod · 0.95
infoMethod · 0.80
sampleMethod · 0.80

Tested by

no test coverage detected