Skip to content

Commit

Permalink
Add missing __hash__ implementation to TransformerTokenizer
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonwillard committed Oct 9, 2024
1 parent 32aadce commit 7cdbba4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions benchmarks/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import List, Tuple, Union

import torch
from datasets.fingerprint import Hasher
from transformers import AutoTokenizer, PreTrainedTokenizer


Expand Down Expand Up @@ -90,6 +91,9 @@ def convert_token_to_string(self, token: str) -> str:

return string

def __hash__(self):
return hash(Hasher.hash(self.tokenizer))

def __eq__(self, other):
if isinstance(other, type(self)):
if hasattr(self, "model_name") and hasattr(self, "kwargs"):
Expand Down

0 comments on commit 7cdbba4

Please sign in to comment.