MCPcopy
hub / github.com/appvision-ai/fast-bert / predict_batch

Method predict_batch

container/bert/predictor.py:72–89  ·  view source on GitHub ↗

For the input, do the predictions and return them. Args: input (a pandas dataframe): The data on which to do the predictions. There will be one prediction per row in the dataframe

(cls, texts)

Source from the content-addressed store, hash-verified

70
71 @classmethod
72 def predict_batch(cls, texts):
73 """For the input, do the predictions and return them.
74 Args:
75 input (a pandas dataframe): The data on which to do the predictions. There will be
76 one prediction per row in the dataframe"""
77 predictor_model = cls.get_predictor_model()
78 output_labels_count = int(
79 os.environ.get(
80 "OUTPUT_LABELS_COUNT", len(predictor_model.learner.data.labels)
81 )
82 )
83
84 print("output_labels_count", output_labels_count)
85
86 predictions = predictor_model.predict_batch(texts)
87 return cls.process_batch_results(
88 texts, predictions, labels_count=output_labels_count
89 )
90
91 @classmethod
92 def searching_all_files(cls, directory: Path):

Callers 1

transformationFunction · 0.45

Calls 2

get_predictor_modelMethod · 0.45
process_batch_resultsMethod · 0.45

Tested by

no test coverage detected