GithubHelp home page GithubHelp logo

Comments (6)

ArthurZucker avatar ArthurZucker commented on July 20, 2024

Thanks!
Probably because the new tokenizer does not use the normalizer / uses only a pre-tokenizer? Not super sure but thanks for sharing! 🤗

from tokenizers.

purefall avatar purefall commented on July 20, 2024

Hi, I am also having a similar issue while training a tokenizer using on Refined Web Dataset.

Similar to issue, I am using the train_from_iterator() function and training a SentencePieceBPETokenizer(), and during the Pre-processing sequences I ran out-of-memory.

I don't believe switching to another tokenizer serves my needs and, it would be great if you could provide some insights on what I can do if I want to train on large datasets.

from tokenizers.

morphpiece avatar morphpiece commented on July 20, 2024

Can you give a short script to reproduce the problem?

from tokenizers.

purefall avatar purefall commented on July 20, 2024

Sure the code below throws a out-of-memory error, process_files is the path list of arrow files downloaded from HF of RefinedWeb Dataset:

from datasets import load_dataset
data_files = {"train": process_files}

dataset = load_dataset("arrow", data_files=data_files, split="train", streaming=True)

# Build an iterator over this dataset
def batch_iterator(input_sentence_size=None, batch_size=1000):
    for elem in dataset.iter(batch_size=batch_size):
        yield elem["content"]


tokenizer = SentencePieceBPETokenizer()
tokenizer.train_from_iterator(
    iterator=batch_iterator(),
    vocab_size=30_000,
    min_frequency=5,
    show_progress=True,
    limit_alphabet=500,
)

from tokenizers.

morphpiece avatar morphpiece commented on July 20, 2024

I just ran the script and didn't observe any OOM.

I used a 30 vCPU/240 GB AMD-Epyc server. The memory consumption increased linearly during count_pairs stage and the max was about 60%.

Caveats : I used FineWeb-Edu-10BT sample, saved as parquet files instead of arrow.

Hope that helps.

from tokenizers.

ArthurZucker avatar ArthurZucker commented on July 20, 2024

There is an ongoing PR for arrow support, if that helps we should def merge it!

from tokenizers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.