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

[ Docs] translated peft (ES) and toctree.yml add #30554

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

njackman-2344
Copy link
Contributor

Add the Spanish version of peft.md to transformers/docs/source/es

#28936

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@stevhliu @aaronjimv If you don't mind reviewing, thanks!! :)

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

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

Thanks for adding! 🤗

@@ -96,6 +96,8 @@
title: Mecanismos de atención
- local: pad_truncation
title: Relleno y truncamiento
local: peft
Copy link
Member

Choose a reason for hiding this comment

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

This should be in the "Tutorial" section.

Suggested change
local: peft
- local: peft


<div class="flex flex-col justify-center">
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/peft/PEFT-hub-screenshot.png"/>
<figcaption class="text-center">The adapter weights for a OPTForCausalLM model stored on the Hub are only ~6MB compared to the full size of the model weights, which can be ~700MB.</figcaption>
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to also translate the caption 🙂

## Cargar en 8bit o 4bit

La integración de `bitsandbytes` apoya los tipos de datos precisos que son utilizados para cargar modelos grandes porque
guarda memoria (mira la [guia](./quantization#bitsandbytes-integration) de `bitsandbytes` para aprender mas). Agrega el parametro `load_in_8bit` o el parametro `load_in_4bit` al [`~PreTrainedModel.from_pretrained`] y coloca `device_map="auto"` para effectivamente distribuir el modelo tu hardware:
Copy link
Member

Choose a reason for hiding this comment

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

The "Quantization" doc doesn't exist in Spanish yet so let's link to the English one for now

Suggested change
guarda memoria (mira la [guia](./quantization#bitsandbytes-integration) de `bitsandbytes` para aprender mas). Agrega el parametro `load_in_8bit` o el parametro `load_in_4bit` al [`~PreTrainedModel.from_pretrained`] y coloca `device_map="auto"` para effectivamente distribuir el modelo tu hardware:
guarda memoria (mira la [guia](https://huggingface.co/docs/transformers/quantization#bitsandbyes) de `bitsandbytes` para aprender mas). Agrega el parametro `load_in_8bit` o el parametro `load_in_4bit` al [`~PreTrainedModel.from_pretrained`] y coloca `device_map="auto"` para effectivamente distribuir el modelo tu hardware:

Copy link
Contributor

@aaronjimv aaronjimv left a comment

Choose a reason for hiding this comment

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

Hi, thanks for adding! The translation in general is good, but I have to point out that it presents several issues with fluency (making it sound natural) and coherence (making it reflect the original content).

Copy link
Contributor

@aaronjimv aaronjimv left a comment

Choose a reason for hiding this comment

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

Hi @njackman-2344, I appreciate you asking me to review again. However, I still have some concerns about the fluency and coherence of the translation. Would you mind taking another look at all the comments made here and addressing those issues? I think it would really make a big difference. Additionally, I wanted to suggest you to use tools like HuggingChat to assist you in the translations and improving their fluency and coherence. Once you've made the necessary changes, I'll be happy to review again.


[[open-in-colab]]

[Parameter-Efficient Fine Tuning (PEFT)](https://huggingface.co/blog/peft) métodos congelan los parámetros del modelo preentrenado durante el afinamiento y agregan un pequeño número de parámetros entrenables (los adaptadores) encima de eso. Varios parámetros entrenables (los adaptadores) están entrenados para aprender la tarea específica. Está manera a sido comprobada en ser eficiente con la memoria y con menos uso de computar mientras produciendo resultados comparable a un modelo completamente afinado.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[Parameter-Efficient Fine Tuning (PEFT)](https://huggingface.co/blog/peft) métodos congelan los parámetros del modelo preentrenado durante el afinamiento y agregan un pequeño número de parámetros entrenables (los adaptadores) encima de eso. Varios parámetros entrenables (los adaptadores) están entrenados para aprender la tarea específica. Está manera a sido comprobada en ser eficiente con la memoria y con menos uso de computar mientras produciendo resultados comparable a un modelo completamente afinado.
Los métodos PEFT [Parameter-Efficient Fine Tuning (PEFT)](https://huggingface.co/blog/peft) congelan los parámetros del modelo preentrenado durante el afinamiento y agregan un pequeño número de parámetros entrenables (los adaptadores) encima. Los adaptadores están entrenados para aprender información específica de una tarea. Se ha demostrado que este enfoque es muy eficiente en memoria con un menor uso de cómputo y al mismo tiempo produce resultados comparables a un modelo completamente ajustado.


[Parameter-Efficient Fine Tuning (PEFT)](https://huggingface.co/blog/peft) métodos congelan los parámetros del modelo preentrenado durante el afinamiento y agregan un pequeño número de parámetros entrenables (los adaptadores) encima de eso. Varios parámetros entrenables (los adaptadores) están entrenados para aprender la tarea específica. Está manera a sido comprobada en ser eficiente con la memoria y con menos uso de computar mientras produciendo resultados comparable a un modelo completamente afinado.

Adaptadores entrenados con PEFT también son usualmente un orden de magnitud más pequeños que los modelos enteros, haciéndolos más convenientes para compartir, archivar, y cargar.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Adaptadores entrenados con PEFT también son usualmente un orden de magnitud más pequeños que los modelos enteros, haciéndolos más convenientes para compartir, archivar, y cargar.
Los adaptadores entrenados con PEFT también suelen ser un orden de magnitud más pequeños que el modelo completo, lo que hace que sea conveniente para compartirlos, almacenarlos y cargarlos.


## Configuración

Empezar por instalar 🤗 PEFT:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Empezar por instalar 🤗 PEFT:
Vamos a empezar instalando 🤗 PEFT:

pip install peft
```

Si quieres tratar las nuevas características, instala la librería de la fuente:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Si quieres tratar las nuevas características, instala la librería de la fuente:
Si quieres probar las nuevas características, es posible que te interese instalar la biblioteca desde la fuente:


## Los modelos de PEFT apoyados

Los 🤗 Transformers nativamente apoyan algunos métodos de PEFT. De esta manera puedes cargar los pesos del adaptador archivados localmente o archivados en el Hub y fácilmente ejecutar o entrenar los pesos con unas cuantas líneas de código. Los siguientes métodos están apoyados:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Los 🤗 Transformers nativamente apoyan algunos métodos de PEFT. De esta manera puedes cargar los pesos del adaptador archivados localmente o archivados en el Hub y fácilmente ejecutar o entrenar los pesos con unas cuantas líneas de código. Los siguientes métodos están apoyados:
🤗 Transformers admite nativamente algunos métodos de PEFT. De esta manera puedes cargar los pesos del adaptador almacenados localmente o almacenados en el Hub y fácilmente ejecutar o entrenar los pesos con unas cuantas líneas de código. Se cuenta con soporte para los siguientes métodos:


</Tip>

1. Define tu configuraciôn de adaptador con el tipo de tarea y hiperparámetros (lee [`~peft.LoraConfig`] sobre más detalles de lo que
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
1. Define tu configuraciôn de adaptador con el tipo de tarea y hiperparámetros (lee [`~peft.LoraConfig`] sobre más detalles de lo que
1. Define la configuración de su adaptador con el tipo de tarea y los hiperparámetros (consulte [`~peft.LoraConfig`] para obtener más detalles sobre lo que hacen los hiperparámetros).

</Tip>

1. Define tu configuraciôn de adaptador con el tipo de tarea y hiperparámetros (lee [`~peft.LoraConfig`] sobre más detalles de lo que
hacen los hiperparámetros).
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this line

trainer.train()
```

Para archivar tu adaptador entrenado y volver a cargarlo:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Para archivar tu adaptador entrenado y volver a cargarlo:
Para guardar tu adaptador entrenado y volver a cargarlo:

model = AutoModelForCausalLM.from_pretrained(save_dir)
```

## Agrega capas entrenables adicionales a un PEFT adaptador
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Agrega capas entrenables adicionales a un PEFT adaptador
## Agrega capas entrenables adicionales a un adaptador PEFT


## Agrega capas entrenables adicionales a un PEFT adaptador

Tambien puedes afinar adaptadores entrenables adicionales en encima de un modelo que tiene adaptadores ajustados por pasar a `modules_to_save` en tu config PEFT. Por ejemplo, si tu quieres también afinar el lm_head encima de un modelo con un adaptador de LoRA:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Tambien puedes afinar adaptadores entrenables adicionales en encima de un modelo que tiene adaptadores ajustados por pasar a `modules_to_save` en tu config PEFT. Por ejemplo, si tu quieres también afinar el lm_head encima de un modelo con un adaptador de LoRA:
También puedes ajustar adaptadores entrenables adicionales sobre un modelo que tiene adaptadores conectados pasando `modules_to_save` en su configuración PEFT. Por ejemplo, si también quieres ajustar el `lm_head` encima de un modelo con un adaptador LoRA:

@njackman-2344
Copy link
Contributor Author

Hi @njackman-2344, I appreciate you asking me to review again. However, I still have some concerns about the fluency and coherence of the translation. Would you mind taking another look at all the comments made here and addressing those issues? I think it would really make a big difference. Additionally, I wanted to suggest you to use tools like HuggingChat to assist you in the translations and improving their fluency and coherence. Once you've made the necessary changes, I'll be happy to review again.

Ok! Thank you! I didn't see the corrections. I will do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants