Skip to content

Commit b9a768b

Browse files
authored
Enable doc in Spanish (huggingface#16518)
* Reorganize doc for multilingual support * Fix style * Style * Toc trees * Adapt templates
1 parent 3951b9f commit b9a768b

File tree

206 files changed

+71
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+71
-30
lines changed

.github/workflows/build_documentation.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ jobs:
1515
commit_sha: ${{ github.sha }}
1616
package: transformers
1717
notebook_folder: transformers_doc
18+
languages: en es
1819
secrets:
1920
token: ${{ secrets.HUGGINGFACE_PUSH }}

.github/workflows/build_pr_documentation.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ jobs:
1414
commit_sha: ${{ github.event.pull_request.head.sha }}
1515
pr_number: ${{ github.event.number }}
1616
package: transformers
17+
languages: en es

docs/source/contributing.md

-1
This file was deleted.

docs/source/en/_config.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# docstyle-ignore
2+
INSTALL_CONTENT = """
3+
# Transformers installation
4+
! pip install transformers datasets
5+
# To install from source instead of the last release, comment the command above and uncomment the following one.
6+
# ! pip install git+https://github.com/huggingface/transformers.git
7+
"""
8+
9+
notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
10+
black_avoid_patterns = {
11+
"{processor_class}": "FakeProcessorClass",
12+
"{model_class}": "FakeModelClass",
13+
"{object_class}": "FakeObjectClass",
14+
}
File renamed without changes.

docs/source/en/contributing.md

+1

docs/source/en/notebooks.md

+1

docs/source/es/_config.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# docstyle-ignore
2+
INSTALL_CONTENT = """
3+
# Transformers installation
4+
! pip install transformers datasets
5+
# To install from source instead of the last release, comment the command above and uncomment the following one.
6+
# ! pip install git+https://github.com/huggingface/transformers.git
7+
"""
8+
9+
notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
10+
black_avoid_patterns = {
11+
"{processor_class}": "FakeProcessorClass",
12+
"{model_class}": "FakeModelClass",
13+
"{object_class}": "FakeObjectClass",
14+
}

docs/source/es/_toctree.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- sections:
2+
- local: quicktour
3+
title: Quick tour
4+
- local: installation
5+
title: Instalación
6+
title: Get started
7+
- sections:
8+
- local: pipeline_tutorial
9+
title: Pipelines para inferencia
10+
- local: training
11+
title: Fine-tuning a un modelo pre-entrenado
12+
- local: accelerate
13+
title: Entrenamiento distribuido con 🤗 Accelerate
14+
title: Tutorials
15+
- sections:
16+
- local: multilingual
17+
title: Modelos multilingües para inferencia

docs/source_es/installation.mdx renamed to docs/source/es/installation.mdx

+16-22

docs/source/notebooks.md

-1
This file was deleted.

src/transformers/commands/add_new_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def remove_copy_lines(path):
178178

179179
shutil.move(
180180
f"{directory}/{lowercase_model_name}.mdx",
181-
f"{path_to_transformer_root}/docs/source/model_doc/{lowercase_model_name}.mdx",
181+
f"{path_to_transformer_root}/docs/source/en/model_doc/{lowercase_model_name}.mdx",
182182
)
183183

184184
shutil.move(

src/transformers/commands/add_new_model_like.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def get_model_files(model_type: str, frameworks: Optional[List[str]] = None) ->
541541
model_files = list(model_module.glob("*.py"))
542542
model_files = filter_framework_files(model_files, frameworks=frameworks)
543543

544-
doc_file = REPO_PATH / "docs" / "source" / "model_doc" / f"{model_type}.mdx"
544+
doc_file = REPO_PATH / "docs" / "source" / "en" / "model_doc" / f"{model_type}.mdx"
545545

546546
# Basic pattern for test files
547547
test_files = [
@@ -1256,7 +1256,7 @@ def disable_fx_test(filename: Path) -> bool:
12561256
add_model_to_auto_classes(old_model_patterns, new_model_patterns, model_classes)
12571257

12581258
# 5. Add doc file
1259-
doc_file = REPO_PATH / "docs" / "source" / "model_doc" / f"{old_model_patterns.model_type}.mdx"
1259+
doc_file = REPO_PATH / "docs" / "source" / "en" / "model_doc" / f"{old_model_patterns.model_type}.mdx"
12601260
duplicate_doc_file(doc_file, old_model_patterns, new_model_patterns, frameworks=frameworks)
12611261

12621262
# 6. Warn the user for duplicate patterns

utils/check_copies.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# All paths are set with the intent you should run this script from the root of the repo with the command
2626
# python utils/check_copies.py
2727
TRANSFORMERS_PATH = "src/transformers"
28-
PATH_TO_DOCS = "docs/source"
28+
PATH_TO_DOCS = "docs/source/en"
2929
REPO_PATH = "."
3030

3131
# Mapping for files that are full copies of others (keys are copies, values the file to keep them up to data with)

utils/check_repo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# python utils/check_repo.py
3232
PATH_TO_TRANSFORMERS = "src/transformers"
3333
PATH_TO_TESTS = "tests"
34-
PATH_TO_DOC = "docs/source"
34+
PATH_TO_DOC = "docs/source/en"
3535

3636
# Update this list with models that are supposed to be private.
3737
PRIVATE_MODELS = [

utils/check_table.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# All paths are set with the intent you should run this script from the root of the repo with the command
2424
# python utils/check_table.py
2525
TRANSFORMERS_PATH = "src/transformers"
26-
PATH_TO_DOCS = "docs/source"
26+
PATH_TO_DOCS = "docs/source/en"
2727
REPO_PATH = "."
2828

2929

0 commit comments

Comments
 (0)