Coder Social home page Coder Social logo

Mask值 about guwenbert HOT 5 CLOSED

ethan-yt avatar ethan-yt commented on July 30, 2024
Mask值

from guwenbert.

Comments (5)

Ethan-yt avatar Ethan-yt commented on July 30, 2024
from transformers import BertTokenizer
tokenizer = BertTokenizer.from_pretrained("ethanyt/guwenbert-base")
tokenizer('言下法未[PAD]')
>>>  {'input_ids': [0, 55, 34, 76, 89, 1, 2], 'token_type_ids': [0, 0, 0, 0, 0, 0, 0], 'attention_mask': [1, 1, 1, 1, 1, 1, 1]}

from guwenbert.

Ethan-yt avatar Ethan-yt commented on July 30, 2024
In [8]: tokenizer(['言下法未', '言下'], padding=True)
Out[8]: {'input_ids': [[0, 55, 34, 76, 89, 2], [0, 55, 34, 2, 1, 1]], 'token_type_ids': [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]], 'attention_mask': [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0]]}

from guwenbert.

Ethan-yt avatar Ethan-yt commented on July 30, 2024
In [16]: tokenizer.get_special_tokens_mask([0, 55, 34, 76, 89, 1, 1, 1, 1], already_has_special_tokens=True)
Out[16]: [1, 0, 0, 0, 0, 1, 1, 1, 1]

from guwenbert.

Ethan-yt avatar Ethan-yt commented on July 30, 2024

不知道我的这几段代码有没有回答你的问题

from guwenbert.

YangHan-Morningstar avatar YangHan-Morningstar commented on July 30, 2024

好的,我明白了,谢谢

from guwenbert.

Related Issues (17)

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.