初始化项目,由ModelHub XC社区提供模型
Model: antoinelouis/belgpt2 Source: Original Platform
This commit is contained in:
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
80
README.md
Normal file
80
README.md
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
language:
|
||||
- fr
|
||||
license:
|
||||
- mit
|
||||
widget:
|
||||
- text: Hier, Elon Musk a
|
||||
- text: Pourquoi a-t-il
|
||||
- text: Tout à coup, elle
|
||||
metrics:
|
||||
- perplexity
|
||||
library_name: transformers
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# BelGPT-2
|
||||
|
||||
**The 1st GPT-2 model pre-trained on a very large and heterogeneous French corpus (~60Gb).**
|
||||
|
||||
## Usage
|
||||
|
||||
You can use BelGPT-2 with [🤗 transformers](https://github.com/huggingface/transformers):
|
||||
|
||||
```python
|
||||
import torch
|
||||
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
||||
|
||||
# Load pretrained model and tokenizer
|
||||
model = GPT2LMHeadModel.from_pretrained("antoiloui/belgpt2")
|
||||
tokenizer = GPT2Tokenizer.from_pretrained("antoiloui/belgpt2")
|
||||
|
||||
# Generate a sample of text
|
||||
model.eval()
|
||||
output = model.generate(
|
||||
bos_token_id=random.randint(1,50000),
|
||||
do_sample=True,
|
||||
top_k=50,
|
||||
max_length=100,
|
||||
top_p=0.95,
|
||||
num_return_sequences=1
|
||||
)
|
||||
|
||||
# Decode it
|
||||
decoded_output = []
|
||||
for sample in output:
|
||||
decoded_output.append(tokenizer.decode(sample, skip_special_tokens=True))
|
||||
print(decoded_output)
|
||||
```
|
||||
|
||||
## Data
|
||||
|
||||
Below is the list of all French copora used to pre-trained the model:
|
||||
|
||||
| Dataset | `$corpus_name` | Raw size | Cleaned size |
|
||||
| :------| :--- | :---: | :---: |
|
||||
| CommonCrawl | `common_crawl` | 200.2 GB | 40.4 GB |
|
||||
| NewsCrawl | `news_crawl` | 10.4 GB | 9.8 GB |
|
||||
| Wikipedia | `wiki` | 19.4 GB | 4.1 GB |
|
||||
| Wikisource | `wikisource` | 4.6 GB | 2.3 GB |
|
||||
| Project Gutenberg | `gutenberg` | 1.3 GB | 1.1 GB |
|
||||
| EuroParl | `europarl` | 289.9 MB | 278.7 MB |
|
||||
| NewsCommentary | `news_commentary` | 61.4 MB | 58.1 MB |
|
||||
| **Total** | | **236.3 GB** | **57.9 GB** |
|
||||
|
||||
## Documentation
|
||||
|
||||
Detailed documentation on the pre-trained model, its implementation, and the data can be found [here](https://github.com/ant-louis/belgpt2/blob/master/docs/index.md).
|
||||
|
||||
## Citation
|
||||
|
||||
For attribution in academic contexts, please cite this work as:
|
||||
|
||||
```
|
||||
@misc{louis2020belgpt2,
|
||||
author = {Louis, Antoine},
|
||||
title = {{BelGPT-2: A GPT-2 Model Pre-trained on French Corpora}},
|
||||
year = {2020},
|
||||
howpublished = {\url{https://github.com/ant-louis/belgpt2}},
|
||||
}
|
||||
```
|
||||
59
config.json
Normal file
59
config.json
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"_num_labels": 2,
|
||||
"activation_function": "gelu_new",
|
||||
"architectures": [
|
||||
"GPT2LMHeadModel"
|
||||
],
|
||||
"attn_pdrop": 0.1,
|
||||
"bos_token_id": 50256,
|
||||
"decoder_start_token_id": null,
|
||||
"do_sample": false,
|
||||
"early_stopping": false,
|
||||
"embd_pdrop": 0.1,
|
||||
"eos_token_id": 50256,
|
||||
"finetuning_task": null,
|
||||
"id2label": {
|
||||
"0": "LABEL_0",
|
||||
"1": "LABEL_1"
|
||||
},
|
||||
"initializer_range": 0.02,
|
||||
"is_decoder": false,
|
||||
"is_encoder_decoder": false,
|
||||
"label2id": {
|
||||
"LABEL_0": 0,
|
||||
"LABEL_1": 1
|
||||
},
|
||||
"layer_norm_epsilon": 1e-05,
|
||||
"length_penalty": 1.0,
|
||||
"max_length": 20,
|
||||
"min_length": 0,
|
||||
"model_type": "gpt2",
|
||||
"n_ctx": 1024,
|
||||
"n_embd": 768,
|
||||
"n_head": 12,
|
||||
"n_layer": 12,
|
||||
"n_positions": 1024,
|
||||
"no_repeat_ngram_size": 0,
|
||||
"num_beams": 1,
|
||||
"num_return_sequences": 1,
|
||||
"output_attentions": false,
|
||||
"output_hidden_states": false,
|
||||
"output_past": true,
|
||||
"pad_token_id": null,
|
||||
"prefix": null,
|
||||
"pruned_heads": {},
|
||||
"repetition_penalty": 1.0,
|
||||
"resid_pdrop": 0.1,
|
||||
"summary_activation": null,
|
||||
"summary_first_dropout": 0.1,
|
||||
"summary_proj_to_labels": true,
|
||||
"summary_type": "cls_index",
|
||||
"summary_use_proj": true,
|
||||
"task_specific_params": null,
|
||||
"temperature": 1.0,
|
||||
"top_k": 50,
|
||||
"top_p": 1.0,
|
||||
"torchscript": false,
|
||||
"use_bfloat16": false,
|
||||
"vocab_size": 50257
|
||||
}
|
||||
3
flax_model.msgpack
Normal file
3
flax_model.msgpack
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5eccdcf32717efa8112947a1b17e262eb1584d5a773ccc3a057c56e1c5401536
|
||||
size 497764120
|
||||
49999
merges.txt
Normal file
49999
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a5cc1540d9fed84e067b4a52a911a9b5581ee0623a001e234584e9392251b281
|
||||
size 548107150
|
||||
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5d0e186366621cb2e8f786c9191fe1051645b18a33bb53f3fc5c20d96f9fdb68
|
||||
size 548125486
|
||||
1
special_tokens_map.json
Normal file
1
special_tokens_map.json
Normal file
@@ -0,0 +1 @@
|
||||
{"bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "unk_token": "<|endoftext|>"}
|
||||
3
tf_model.h5
Normal file
3
tf_model.h5
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e3f09d00894da58795745632fea649219594b74ab680a016c21f9302be1ce6c6
|
||||
size 497933648
|
||||
1
tokenizer_config.json
Normal file
1
tokenizer_config.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user