3ce15cf0b1b83503d0a35a0077cb93322c2cc710,finetune/base.py,BaseModel,_inference,#BaseModel#Any#Any#,239

Before Change


                yield "" // placeholder to fill batch up

    def _inference(self, Xs, mode=None):
        self._data = list(self.input_pipeline._format_for_inference(Xs))
        self._closed = False
        n = len(self._data)

        if not getattr(self, "estimator", None):
            self.estimator = self.get_estimator()
            self._input_fn = lambda: self.input_pipeline._dataset_without_targets(
                self._data_generator, train=None
            ).batch(self.config.batch_size)
            self._predictions = self.estimator.predict(input_fn=self._input_fn)

        predictions = [None] * n
        for i in range(n):
            y = next(self._predictions)
            y = y[mode] if mode else y
            predictions[i] = y

After Change


            length = len(Xs) if not callable(Xs) else None

            predictions = tqdm.tqdm(
                estimator.predict(
                    input_fn=input_fn, predict_keys=mode
                ),
                total=length,
                desc="Inference"
            )
            return [pred[mode] if mode else pred for pred in predictions]
        
    def fit(self, *args, **kwargs):
         An alias for finetune. 
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: IndicoDataSolutions/finetune
Commit Name: 3ce15cf0b1b83503d0a35a0077cb93322c2cc710
Time: 2018-11-13
Author: madison@indico.io
File Name: finetune/base.py
Class Name: BaseModel
Method Name: _inference


Project Name: philipperemy/deep-speaker
Commit Name: d14ad44d0f425c04be5a6cdca13fc513fba53843
Time: 2017-06-12
Author: premy@reactive.co.jp
File Name: test_models_train.py
Class Name:
Method Name:


Project Name: IndicoDataSolutions/finetune
Commit Name: 2028dffb2a29570c72f10bcb3e35e33fa7fb1c03
Time: 2018-11-13
Author: madison@indico.io
File Name: finetune/base.py
Class Name: BaseModel
Method Name: _inference