Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop dropping samples every batch #15

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
cleanup
Lewington-pitsos committed Jul 18, 2024
commit 9e43ce3e39dcba003df96af8c9449bc5b5937b83
2 changes: 0 additions & 2 deletions sae/data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Tools for tokenizing and manipulating text datasets."""

import os
import math
from multiprocessing import cpu_count
from typing import TypeVar, Union
@@ -93,7 +92,6 @@ def _tokenize_fn(x: dict[str, list], leftovers: list=[]):
output = {k: v[:len(output['input_ids'])] for k, v in output.items()}



output_batch_size = len(output["input_ids"])

if output_batch_size == 0:
2 changes: 1 addition & 1 deletion tests/test_chunk_and_tokenize.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from transformers import GPT2TokenizerFast
from datasets import Dataset
from sae.data import chunk_and_tokenize # Replace 'mymodule' with the actual module name
from sae.data import chunk_and_tokenize

@pytest.fixture
def setup_data():