Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gpt2-medium-chinese model card #8402

Merged
merged 2 commits into from
Nov 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions model_cards/mymusise/gpt2-medium-chinese/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
language: zh
---

# gpt2-medium-chinese


# Overview

- **Language model**: GPT2-Medium
- **Model size**: 1.2GiB
- **Language**: Chinese
- **Training data**: [wiki2019zh_corpus](https://github.com/brightmart/nlp_chinese_corpus)
- **Source code**: [gpt2-quickly](https://github.com/mymusise/gpt2-quickly)

# Example

```python
from transformers import BertTokenizer, TFGPT2LMHeadModel
from transformers import TextGenerationPipeline

tokenizer = BertTokenizer.from_pretrained("mymusise/EasternFantasyNoval")
model = TFGPT2LMHeadModel.from_pretrained("mymusise/EasternFantasyNoval")

text_generator = TextGenerationPipeline(model, tokenizer)
print(text_generator("今日", max_length=64, do_sample=True, top_k=10))
print(text_generator("跨越山丘", max_length=64, do_sample=True, top_k=10))
```
输出
```text
[{'generated_text': '今日 , 他 的 作 品 也 在 各 种 报 刊 发 表 。 201 1 年 , 他 开 设 了 他 的 网 页 版 《 the dear 》 。 此 外 , 他 还 在 各 种 电 视 节 目 中 出 现 过 。 2017 年 1 月 , 他 被 任'}]
[{'generated_text': '跨越山丘 , 其 中 有 三 分 之 二 的 地 区 被 划 入 山 区 。 最 高 峰 是 位 于 山 脚 上 的 大 岩 ( ) 。 其 中 的 山 脚 下 有 一 处 有 名 为 的 河 谷 , 因 其 高 度 在 其 中 , 而 得 名 。'}]
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if needed you can specify sample inputs (right now you'll get the defaults on your model page), see https://huggingface.co/docs#how-can-i-control-my-models-widgets-example-inputs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks


[Try it on colab](https://colab.research.google.com/github/mymusise/gpt2-quickly/blob/main/examples/gpt2_medium_chinese.ipynb)