Skip to content

Commit

Permalink
Fixes "'float' object cannot be interpreted as an integer" in Python …
Browse files Browse the repository at this point in the history
…3.12

PiperOrigin-RevId: 718392316
  • Loading branch information
tensorflower-gardener committed Jan 27, 2025
1 parent ad06941 commit 61647ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tf_keras/preprocessing/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def skipgrams(
random.shuffle(words)

couples += [
[words[i % len(words)], random.randint(1, vocabulary_size - 1)]
[words[i % len(words)], random.randint(1, int(vocabulary_size - 1))]
for i in range(num_negative_samples)
]
if categorical:
Expand All @@ -375,7 +375,7 @@ def skipgrams(

if shuffle:
if seed is None:
seed = random.randint(0, 10e6)
seed = random.randint(0, int(10e6))
random.seed(seed)
random.shuffle(couples)
random.seed(seed)
Expand Down
2 changes: 1 addition & 1 deletion tf_keras/utils/text_dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _prepare_directory(
):
# Get a unique temp directory
temp_dir = os.path.join(
self.get_temp_dir(), str(random.randint(0, 1e6))
self.get_temp_dir(), str(random.randint(0, int(1e6)))
)
os.mkdir(temp_dir)
self.addCleanup(shutil.rmtree, temp_dir)
Expand Down

0 comments on commit 61647ab

Please sign in to comment.