Giter VIP home page Giter VIP logo

Comments (5)

brightmart avatar brightmart commented on May 18, 2024

hi, we used vocabulary from bert, it is a single word for Chinese.

you can check bert or xlnet for reference.

from albert_zh.

008karan avatar 008karan commented on May 18, 2024

I have seen bert's vocab. They used Wordpiece for it. Which generates subwords like ##word but in sentencepiece thats not the case. Any suggestions?

from albert_zh.

brightmart avatar brightmart commented on May 18, 2024

in xlnet, it is using sentence piece. you can easily generate vocabulary based on your corpus. check here: xlnet, and then you will have to take a look of tokenizer

you can also check non-english support from bert: https://github.com/google-research/bert/blob/master/multilingual.md

from albert_zh.

lonePatient avatar lonePatient commented on May 18, 2024

@008karan SentencePiece does quite the opposite to WordPiece. From the documentation. SentencePiece first escapes the whitespace with a meta-symbol "▁" (U+2581) as follows:

Hello▁World.

Then, this text is segmented into small pieces, for example:

[Hello] [▁Wor] [ld] [.]

Subwords which occur after whitespace (which are also those that most words begin with) are prepended with '▁', while others are unchanged. This excludes subwords which only occur at the beginning of sentences and nowhere else. These cases should be quite rare, however.

So, in order to obtain a vocabulary analogous to WordPiece, we need to perform a simple conversion, removing "▁" from the tokens that contain it and adding "##" to the ones that don't.

def parse_sentencepiece_token(token):
    if token.startswith("▁"):
        return token[1:]
    else:
        return "##" + token

from albert_zh.

brightmart avatar brightmart commented on May 18, 2024

good job

from albert_zh.

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.