-
Notifications
You must be signed in to change notification settings - Fork 33.3k
[i18n-ar] Translated file : docs/source/ar/fast_tokenizers.md into Arabic
#33034
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
Merged
stevhliu
merged 15 commits into
huggingface:main
from
AhmedAlmaghz:Add_docs_source_ar_fast_tokenizers.md
Oct 28, 2024
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8126a5e
Add docs/source/ar/fast_tokenizers.md to Add_docs_source_ar_fast_toke…
AhmedAlmaghz e892197
Merge branch 'huggingface:main' into Add_docs_source_ar_fast_tokenize…
AhmedAlmaghz 3981041
Update _toctree.yml
AhmedAlmaghz a5ef29e
Update _toctree.yml
AhmedAlmaghz fb3e970
Update docs/source/ar/_toctree.yml
AhmedAlmaghz 283beef
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz 23bd8d4
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz 8368ff1
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz da75b0d
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz 752cf05
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz 3212235
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz 267ac7d
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz 791c924
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz 0ea6f48
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz 5b10d2e
Update docs/source/ar/fast_tokenizers.md
AhmedAlmaghz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # استخدام المحللون اللغويون من 🤗 Tokenizers | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| يعتمد [`PreTrainedTokenizerFast`] على مكتبة [🤗 Tokenizers](https://huggingface.co/docs/tokenizers). يمكن تحميل المحللين اللغويين الذين تم الحصول عليهم من مكتبة 🤗 Tokenizers ببساطة شديدة في 🤗 Transformers. | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| قبل الدخول في التفاصيل، دعونا نبدأ أولاً بإنشاء محلل لغوي وهمي في بضع سطور: | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```python | ||
| >>> from tokenizers import Tokenizer | ||
| >>> from tokenizers.models import BPE | ||
| >>> from tokenizers.trainers import BpeTrainer | ||
| >>> from tokenizers.pre_tokenizers import Whitespace | ||
|
|
||
| >>> tokenizer = Tokenizer(BPE(unk_token="[UNK]")) | ||
| >>> trainer = BpeTrainer(special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"]) | ||
|
|
||
| >>> tokenizer.pre_tokenizer = Whitespace() | ||
| >>> files = [...] | ||
| >>> tokenizer.train(files, trainer) | ||
| ``` | ||
|
|
||
| الآن لدينا محلل لغوي مدرب على الملفات التي حددناها. يمكننا إما الاستمرار في استخدامه في وقت التشغيل هذا، أو حفظه في ملف JSON لإعادة استخدامه لاحقًا. | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## التحميل مباشرة من كائن المحلل اللغوي | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| دعونا نرى كيف يمكننا الاستفادة من كائن المحلل اللغوي هذا في مكتبة 🤗 Transformers. تسمح فئة [`PreTrainedTokenizerFast`] بالتشغيل الفوري، من خلال قبول كائن *المحلل اللغوي* الذي تم إنشاؤه كحجة: | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```python | ||
| >>> from transformers import PreTrainedTokenizerFast | ||
|
|
||
| >>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_object=tokenizer) | ||
| ``` | ||
|
|
||
| يمكن الآن استخدام هذا الكائن مع جميع الطرق التي تشترك فيها المحللات اللغوية لـ 🤗 Transformers! انتقل إلى [صفحة المحلل اللغوي](main_classes/tokenizer) لمزيد من المعلومات. | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## التحميل من ملف JSON | ||
|
|
||
| لتحميل محلل لغوي من ملف JSON، دعونا نبدأ أولاً بحفظ محللنا اللغوي: | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```python | ||
| >>> tokenizer.save("tokenizer.json") | ||
| ``` | ||
|
|
||
| يمكن تمرير المسار الذي حفظنا به هذا الملف إلى طريقة تهيئة [`PreTrainedTokenizerFast`] باستخدام معلمة `tokenizer_file`: | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```python | ||
| >>> from transformers import PreTrainedTokenizerFast | ||
|
|
||
| >>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_file="tokenizer.json") | ||
| ``` | ||
|
|
||
| يمكن الآن استخدام هذا الكائن مع جميع الطرق التي تشترك فيها المحللات اللغوية لـ 🤗 Transformers! انتقل إلى [صفحة المحلل اللغوي](main_classes/tokenizer) لمزيد من المعلومات. | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.