Comments (5)
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.
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.
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.
不知道我的这几段代码有没有回答你的问题
from guwenbert.
好的,我明白了,谢谢
from guwenbert.
Related Issues (17)
- 关于新建词表 HOT 2
- 输入两个句子导致索引越界 HOT 26
- 请问能否公开一下古联杯的训练数据呢 HOT 1
- 运行时报错:输入两个句子导致索引越界 HOT 5
- 预训练载入方式咨询 HOT 5
- 预训练代码 HOT 3
- 请问从huggingface下载的模型怎么使用 HOT 6
- 预训练模型的问题 HOT 5
- 感觉效果不太好 HOT 3
- 你好,“古联杯”评测数据集可以公开吗? HOT 1
- 能建一个交流讨论群么 HOT 1
- 关于未来的工作计划 HOT 6
- 预训练语料 HOT 1
- 想请教一下模型结构的问题,为什么模型权重从pooler层之后就没有了 HOT 4
- 请问古文的训练数据方便公开吗? HOT 1
- 请问评估指标是如何确定的呢? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guwenbert.