Adds type checking to PreTrainedConfig. (#20926)

This commit is contained in:
Matthew McDermott 2022-12-30 02:35:01 -05:00 committed by GitHub
parent 8637316e5e
commit 491a33d138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -732,7 +732,7 @@ class PretrainedConfig(PushToHubMixin):
return json.loads(text)
def __eq__(self, other):
return self.__dict__ == other.__dict__
return isinstance(other, PretrainedConfig) and (self.__dict__ == other.__dict__)
def __repr__(self):
return f"{self.__class__.__name__} {self.to_json_string()}"