🚀 GPT2 Medium 4 Persian
本项目是由 HuggingFace 组织的 Flax/Jax 社区周 的一部分,TPU 使用由 Google 赞助。该项目旨在为波斯语提供一个强大的文本生成模型。
🚀 快速开始
你可以直接使用这个模型通过文本生成管道进行操作。以下是使用 Python 代码的示例:
from transformers import pipeline, AutoTokenizer, GPT2LMHeadModel
tokenizer = AutoTokenizer.from_pretrained('flax-community/gpt2-medium-persian')
model = GPT2LMHeadModel.from_pretrained('flax-community/gpt2-medium-persian')
generator = pipeline('text-generation', model, tokenizer=tokenizer, config={'max_length':100})
generated_text = generator('در یک اتفاق شگفت انگیز، پژوهشگران')
若使用 Tensorflow,需导入 TFGPT2LMHeadModel
而非 GPT2LMHeadModel
。
✨ 主要特性
- 支持波斯语文本生成,为波斯语相关的自然语言处理任务提供了有力支持。
- 基于 Oscar 数据集进行训练,该数据集是一个通过对 Common Crawl 语料库进行语言分类和过滤得到的大型多语言语料库,保证了模型的训练数据质量。
💻 使用示例
基础用法
from transformers import pipeline, AutoTokenizer, GPT2LMHeadModel
tokenizer = AutoTokenizer.from_pretrained('flax-community/gpt2-medium-persian')
model = GPT2LMHeadModel.from_pretrained('flax-community/gpt2-medium-persian')
generator = pipeline('text-generation', model, tokenizer=tokenizer, config={'max_length':100})
generated_text = generator('در یک اتفاق شگفت انگیز، پژوهشگران')
高级用法
若使用 Tensorflow,可按以下代码操作:
from transformers import pipeline, AutoTokenizer, TFGPT2LMHeadModel
tokenizer = AutoTokenizer.from_pretrained('flax-community/gpt2-medium-persian')
model = TFGPT2LMHeadModel.from_pretrained('flax-community/gpt2-medium-persian')
generator = pipeline('text-generation', model, tokenizer=tokenizer, config={'max_length':100})
generated_text = generator('در یک اتفاق شگفت انگیز، پژوهشگران')
📚 详细文档
团队成员
数据集
我们使用了 Oscar 数据集,它是一个通过对 Common Crawl 语料库进行语言分类和过滤得到的大型多语言语料库。
演示
演示即将推出。
评估
评估结果即将公布。
📄 信息表格
属性 |
详情 |
模型类型 |
GPT2 Medium 4 Persian |
训练数据 |
Oscar 数据集,一个通过对 Common Crawl 语料库进行语言分类和过滤得到的大型多语言语料库 |