MCPcopy Create free account
hub / github.com/SooLab/CGFormer / to_json_string

Method to_json_string

bert/configuration_utils.py:369–384  ·  view source on GitHub ↗

Serializes this instance to a JSON string. Args: use_diff (:obj:`bool`): If set to True, only the difference between the config instance and the default PretrainedConfig() is serialized to JSON string. Returns: :obj:`string`: String

(self, use_diff=True)

Source from the content-addressed store, hash-verified

367 return output
368
369 def to_json_string(self, use_diff=True):
370 """
371 Serializes this instance to a JSON string.
372
373 Args:
374 use_diff (:obj:`bool`):
375 If set to True, only the difference between the config instance and the default PretrainedConfig() is serialized to JSON string.
376
377 Returns:
378 :obj:`string`: String containing all the attributes that make up this configuration instance in JSON format.
379 """
380 if use_diff is True:
381 config_dict = self.to_diff_dict()
382 else:
383 config_dict = self.to_dict()
384 return json.dumps(config_dict, indent=2, sort_keys=True) + "\n"
385
386 def to_json_file(self, json_file_path, use_diff=True):
387 """

Callers 2

__repr__Method · 0.95
to_json_fileMethod · 0.95

Calls 2

to_diff_dictMethod · 0.95
to_dictMethod · 0.95

Tested by

no test coverage detected