Skip to content

Spanish Chapter 3: sections 1 & 2#162

Merged
lewtun merged 5 commits into
huggingface:mainfrom
fordaz:main
May 16, 2022
Merged

Spanish Chapter 3: sections 1 & 2#162
lewtun merged 5 commits into
huggingface:mainfrom
fordaz:main

Conversation

@fordaz

@fordaz fordaz commented May 6, 2022

Copy link
Copy Markdown
Contributor

Related to #38

@lewtun lewtun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for working on the Spanish translation @fordaz 🚀 !

To build the website, we'll need to add these section the _toctree.yml file, e.g.

- title: 3. Ajuste de un modelo preentrenado # I'm not 100% sure if we should keep "Fine-tuning" in English 🤔
  sections:
  - local: chapter3/1
    title: Introducción
  - local: chapter3/2
    title: Procesamiento de los datos

Once you've added that we can test it works on the website :)

@lgesuellip

Copy link
Copy Markdown

Hi,

I have been working in these sections so, If it is ok with you, I could review that and check if we have any differences.

Thanks,

@fordaz

fordaz commented May 6, 2022

Copy link
Copy Markdown
Contributor Author

@lewtun thanks for pointing this out, I'll update the _toctree.yml as well.
Regarding the translation of Fine-tuning, I considered both "Ajustar" y "Entonar", but I can see how preserving the original term in English might be better in this case. I can use that and see how other reviewers see it.

@fordaz

fordaz commented May 6, 2022

Copy link
Copy Markdown
Contributor Author

@lgesuellip I'd be glad to collaborate with you. Please check and compare this with your translation, and feel free to suggest updates/improvements in the PR. Thanks !

@lewtun

lewtun commented May 6, 2022

Copy link
Copy Markdown
Member

Regarding the translation of Fine-tuning, I considered both "Ajustar" y "Entonar", but I can see how preserving the original term in English might be better in this case. I can use that and see how other reviewers see it.

Using the English term for these technical words sounds good to me!

@fordaz

fordaz commented May 6, 2022

Copy link
Copy Markdown
Contributor Author

@lewtun I noticed few things:

  • Translations of chapter 1 (sections 1,3,4,8) are using "Ajustar". It might be nice to have a consistent translations of these terms.

  • The Spanglish of statements like this "Como usar la API de alto nivel del entrenador para fine-tune un modelo." did not feel right, just a personal impression.

At this point, I'm open to ideas, but personally I'm leaning towards using "Ajustar". I'm also using an extra hint in the toc "Ajuste (fine-tuning) de un modelo preentrenado" so folks have a reference of what "ajustar" means.

@lewtun

lewtun commented May 6, 2022

Copy link
Copy Markdown
Member

At this point, I'm open to ideas, but personally I'm leaning towards using "Ajustar".

Hehe, yes translation is hard 😅. Since we already have "ajustar" in the previous chapters, let's keep that format for now. I like your idea to include the English phrase, so one idea would be to create a glossary chapter that provides a vocabulary table - this is what has been done in e.g. the Persian and German translations: https://github.com/huggingface/course/blob/main/chapters/de/glossary/1.mdx

Similarly one could have a TRANSLATING.txt file that provides a guide to other translators. Again the Persian team have created a template that was adapted to the German case here: https://github.com/huggingface/course/blob/main/chapters/de/TRANSLATING.txt

No need to handle these issues in this PR - just an idea for the future if you have time / interest :)

@fordaz

fordaz commented May 6, 2022

Copy link
Copy Markdown
Contributor Author

@lewtun I was actually thinking about a glossary, I really like the idea of both files, this will help the translators to be consistent. I'll work on it on a separate PR. Thanks for your input.

@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented May 6, 2022

Copy link
Copy Markdown

The documentation is not available anymore as the PR was closed or merged.

@fordaz

fordaz commented May 10, 2022

Copy link
Copy Markdown
Contributor Author

Hi @lewtun, I have a first version of es/TRANSLATING.txt and es/glossary/1.mdx (an adaptation of the German files). Do you suggest to add them as part of this PR or a separate one ? Thanks.

Comment thread chapters/es/chapter3/1.mdx Outdated

# Introducción

En el [Capítulo 2](/course/chapter2) exploramos como usar los tokenizadores y modelos preentrenados para hacer predicciones. Pero qué tal si deseas ajustar un modelo preentrenado con tu propio conjunto de datos ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

En el Capítulo 2 exploramos como usar los tokenizadores y modelos preentrenados para realizar predicciones.

I think "realizar" fits better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

got it.

Comment thread chapters/es/chapter3/1.mdx Outdated
{#if fw === 'pt'}
* Como preparar un conjunto de datos grande desde el Hub.
* Como usar la API de alto nivel del entrenador para ajustar un modelo.
* Como usar un lazo personalizado de entrenamiento.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When I talk about loop I always use the word "bucle".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

got it.

Comment thread chapters/es/chapter3/1.mdx Outdated
* Como preparar un conjunto de datos grande desde el Hub.
* Como usar la API de alto nivel del entrenador para ajustar un modelo.
* Como usar un lazo personalizado de entrenamiento.
* Como aprovechar la libreria acelerada 🤗 para fácilmente ejecutar el lazo personalizado de entrenamiento en cualquier configuración distribuida.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would keep the name of the library in English (Accelerate library).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point. I'll update it as la Accelerate library 🤗 .

Comment thread chapters/es/chapter3/2.mdx Outdated
{/if}

{#if fw === 'pt'}
Continuando con el ejemplo del [capítulo anterior](/course/chapter2), aquí mostramos como podríamos entrenar un clasificador secuencial en un lote en PyTorch:

@lgesuellip lgesuellip May 10, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looking at the original text, I think the meaning is different.

English: Continuing with the example from the previous chapter, here is how we would train a sequence classifier on one batch in PyTorch:
Spanish: Continuando con el ejemplo del capitulo anterior, aquí mostraremos como podríamos entrenar un clasificador de oraciones/sentencias en PyTorch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch !!

Comment thread chapters/es/chapter3/2.mdx Outdated
```
{/if}

Por supuesto, entrenando el modelo con solo dos oraciones no va a producir muy buenos resultados. Para obtener mejores resultados, debes preparar un conjunto de datos mas grande.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Por supuesto que, entrenando el modelo con solo dos oraciones no va a producir muy buenos resultados. Para obtener mejores resultados, debes preparar un conjunto de datos más grande.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it.

Comment thread chapters/es/chapter3/2.mdx Outdated

Como puedes ver, obtenemos un objeto `DatasetDict` que contiene los conjuntos de datos de entrenamiento, de validación y de pruebas. Cada uno de estos contiene varias columnas (`sentence1`, `sentence2`, `label`, and `idx`) y un número variable de filas, que son el número de elementos en cada conjunto (asi, que hay 3,668 pares de oraciones en el conjunto de entrenamiento, 408 en el de validación, y 1,725 en el pruebas)

Este comando descarga y memoriza el conjunto de datos, por defecto en *~/.cache/huggingface/dataset*. Recuerda del Capítulo 2 que puedes personalizar tu carpeta mediante la configuración de la variable de ambiente `HF_HOME`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

variable de entorno is more common, I think ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Like it.

Comment thread chapters/es/chapter3/2.mdx Outdated

Este comando descarga y memoriza el conjunto de datos, por defecto en *~/.cache/huggingface/dataset*. Recuerda del Capítulo 2 que puedes personalizar tu carpeta mediante la configuración de la variable de ambiente `HF_HOME`.

Podemos acceder cada par de oraciones en nuestro objeto `raw_datasets` usando indexación, como con un diccionario.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Podemos acceder a cada par ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

got it.

Comment thread chapters/es/chapter3/2.mdx Outdated
'sentence2': 'Referring to him as only " the witness " , Amrozi accused his brother of deliberately distorting his evidence .'}
```

Podemos ver que las etiquetas ya son números enteros, así que no es necesario hacer ningún preprocesamiento. Para saber cual valor corresponde con cual etiqueta, podemos inspeccionar el campo `features` de nuestro `raw_train_dataset`. Esto indicara el tipo de cada column:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Esto indicara el tipo de dato de cada columna:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it.

Comment thread chapters/es/chapter3/2.mdx Outdated
'sentence2': 'Referring to him as only " the witness " , Amrozi accused his brother of deliberately distorting his evidence .'}
```

Podemos ver que las etiquetas ya son números enteros, así que no es necesario hacer ningún preprocesamiento. Para saber cual valor corresponde con cual etiqueta, podemos inspeccionar el campo `features` de nuestro `raw_train_dataset`. Esto indicara el tipo de cada column:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To be more precise: atributo features

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it.

Comment thread chapters/es/chapter3/2.mdx Outdated
'idx': Value(dtype='int32', id=None)}
```

Internamente, `label` es de tipo `ClassLabel`, y la asociación de valores enteros y sus etiquetas esta almacenado en la carpeta *names*. `0` corresponde con `not_equivalent`, y `1` corresponde con `equivalent`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

es del tipo de dato

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got it.

Comment thread chapters/es/chapter3/2.mdx Outdated
<Youtube id="P-rZWqcB6CE"/>
{/if}

Para preprocesar el conjunto de datos, necesitamos convertir el texto en números que puedan ser entendidos por el modelo. Como viste en el [capítulo anterior](/course/chapter2), esto se hace con el toquenizador. Podemos darle al tokenizador una oración o una lista de oraciones, así podemos tokenizar directamente todas las primeras oraciones y todas segundas oraciones de cada par de la siquiente manera:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Para preprocesar el conjunto de datos, necesitamos convertir el texto en números que puedan ser entendidos por el modelo. Como viste en el capítulo anterior, esto se hace con el tokenizador. Podemos darle al tokenizador una oración o una lista de oraciones, así podemos tokenizar directamente todas las primeras y las segundas oraciones de cada par de la siguiente manera.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch !

Comment thread chapters/es/chapter3/2.mdx Outdated
```

Sin embargo, no podemos simplemente pasar dos secuencias al modelo y obtener una predicción indicando si estas son parafrases o no. Necesitamos manipular las dos secuencias como un par y aplicar el preprocesamiento apropiado.
Afortunadamente, el tonenizador también puede tomar un par de secuencias y preparalo de la manera como nuestro modelo BERT lo espera:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I wrote: Afortunadamente, el tokenizador puede recibir también un par de oraciones y preparar las misma de una forma que nuestro modelo BERT espera.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Like it.

@fordaz

fordaz commented May 10, 2022

Copy link
Copy Markdown
Contributor Author

Great feedback @lgesuellip ! Thanks a lot !

@lgesuellip

Copy link
Copy Markdown

Excellent work @forda, the translation looks fluently and nice to read 📖✨