MCPcopy Create free account
hub / github.com/huggingface/transformers / save_binary

Method save_binary

src/transformers/pipelines.py:197–209  ·  view source on GitHub ↗

Save the provided data object as a pickle-formatted binary data on the disk. :param data: data to store :return: (str) Path where the data has been saved

(self, data: Union[dict, List[dict]])

Source from the content-addressed store, hash-verified

195 raise NotImplementedError()
196
197 def save_binary(self, data: Union[dict, List[dict]]) -> str:
198 """
199 Save the provided data object as a pickle-formatted binary data on the disk.
200 :param data: data to store
201 :return: (str) Path where the data has been saved
202 """
203 path, _ = os.path.splitext(self.output_path)
204 binary_path = os.path.extsep.join((path, "pickle"))
205
206 with open(binary_path, "wb+") as f_output:
207 pickle.dump(data, f_output)
208
209 return binary_path
210
211 @staticmethod
212 def from_str(

Callers 2

save_binaryMethod · 0.45
runMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected