# Data-prep for new portuguese RoBERTa from scratch

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdata-prep-for-new-portuguese-roberta-from-scratch%2F2421%3E%5C
**Category:** Models\
**Created:** [December 2, 2020, 1:49pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdata-prep-for-new-portuguese-roberta-from-scratch%2F2421 "2020-12-02T13:49:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thiagolira](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@thiagolira](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fthiagolira)%5C
**Post date:** [December 2, 2020, 1:49pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdata-prep-for-new-portuguese-roberta-from-scratch%2F2421%2F1 "2020-12-02T13:49:25Z")

</div>

I’m a NLP researcher from Brazil and our team is training RoBERTa base from scratch with around ~60GB Portuguese dataset. We plan on releasing it on HF model hub. Regarding data-prep, we have two options for documents longer than 512 tokens (maxlen):

1. Truncate the data point and discard the rest

2. Break long data points into smaller chunks of 512 tokens (generating new data points)

What are your opinions on these approaches?

---

<div class="post-metadata">

**Author:** ![rgwatwormhill](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@rgwatwormhill](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frgwatwormhill)%5C
**Post date:** [December 3, 2020, 1:44pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdata-prep-for-new-portuguese-roberta-from-scratch%2F2421%2F2 "2020-12-03T13:44:11Z")

</div>

My opinion is that you should break long data into smaller chunks.

One of the advantages of RoBERTa over BERT comes from the fact that it uses more data. if you throw away all but your first 512 tokens in each document, you will lose the “more data” advantage.

Liu et al created English RoBERTa using DOC-SENTENCES or FULL-SENTENCES regimes, either of which uses most of the words in each document, not just the first 512 tokens.

> FULL-SENTENCES: each input is packed with full sentences sampled contiguously from one or more documents […] inputs may cross document boundaries.
> 
> DOC-SENTENCES: Inputs are constructed similarly to FULL-SENTENCES, except that they may not cross document boundaries.

I am not an expert, but I’m pretty sure that is correct.

The next two ideas are only speculation:

It might be even better if you could align the start of each chunk with the start of a sentence (but I don’t actually know whether that would make any difference).

Liu et al used 160GB of data. Since you have only 60GB, you might consider sampling your data several times with the splits in different positions. Maybe you could wrap each document into itself (ie once you reach the end of that document, if you haven’t reached a 512-token boundary, start again from the beginning of it.)

---

<div class="post-metadata">

**Author:** ![thiagolira](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@thiagolira](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fthiagolira)%5C
**Post date:** [February 10, 2021, 11:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdata-prep-for-new-portuguese-roberta-from-scratch%2F2421%2F3 "2021-02-10T11:52:16Z")

</div>

Sorry for taking so long to reply. Your answer was very helpful to me and to my team. Thank you very much! We have trained RoBERTa from scratch on a portuguese corpora and plan to release it for the public eventually.

---

<div class="post-metadata">

**Author:** ![vitali](https://avatars.discourse-cdn.com/v4/letter/v/bc8723/32.png) [@vitali](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvitali)%5C
**Post date:** [May 20, 2021, 5:56pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdata-prep-for-new-portuguese-roberta-from-scratch%2F2421%2F4 "2021-05-20T17:56:35Z")

</div>

Are there any good examples of datasets for Roberta training available on the Hub?

---

<div class="post-metadata">

**Author:** ![vitali](https://avatars.discourse-cdn.com/v4/letter/v/bc8723/32.png) [@vitali](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvitali)%5C
**Post date:** [May 20, 2021, 5:57pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdata-prep-for-new-portuguese-roberta-from-scratch%2F2421%2F5 "2021-05-20T17:57:49Z")

</div>

Could you share steps your have taken to create the dataset? I have the same task, need to prepare text data for training Roberta from scratch.
