Code Monkey home page Code Monkey logo

Comments (5)

lucaslingle avatar lucaslingle commented on June 15, 2024 1

In case anyone else was wondering about this:

The preprocessing script prep_enwik8.py used by Transformer-XL keeps newlines intact when it writes the characters back out to a separate file. Then, when vocab.encode_file is used, the code here reads in the preprocessed data line-by-line, keeping the ending \n appended to each line. Tokenization subsequently treats \n as a separate token.

Thus, \n tokens are not dropped by the Transformer-XL preprocessing, and no <eos> character is needed.

from adaptive-span.

ajoulin avatar ajoulin commented on June 15, 2024

Hi,

enwik8 and text8 were introduced in the context of data compression, where every character must be considered, including the end of line (\n replaced by <eos> in our code).

Example of a previous dataloader used for character level language modeling on enwik8:
https://github.com/salesforce/awd-lstm-lm/blob/master/data.py

from adaptive-span.

yzh119 avatar yzh119 commented on June 15, 2024

Thanks for your justification, it's weird to see Transformer-XL not add eos for these two datasets, considering you use exactly the same prep_enwik8.py to preprocess data.

from adaptive-span.

ajoulin avatar ajoulin commented on June 15, 2024

Note that pre_enwik8.py originally comes from the repository I linked in my previous message:

https://github.com/salesforce/awd-lstm-lm/tree/master/data/enwik8

from adaptive-span.

yzh119 avatar yzh119 commented on June 15, 2024

Right, I mean though using the same script, the way Transformer-XL load data is still different from yours and awd-lstm.
It seems including eos is the right way in the context of compression.

from adaptive-span.

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.