-
Notifications
You must be signed in to change notification settings - Fork 33.6k
[i18n-ar] Translated file : docs/source/ar/attention.md into Arabic
#33021
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
Closed
AhmedAlmaghz
wants to merge
11
commits into
huggingface:main
from
AhmedAlmaghz:Add_docs_source_ar_attention.md
Closed
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0bba17a
Add docs/source/ar/attention.md to Add_docs_source_ar_attention.md
AhmedAlmaghz 1ca6764
Create _toctree.yml
AhmedAlmaghz 1a94839
Update _toctree.yml
AhmedAlmaghz 41d72ef
Update _toctree.yml - tasks_explained
AhmedAlmaghz 7765d6c
Update _toctree.yml - tokenizer_summary
AhmedAlmaghz 5ccdf41
Update _toctree.yml - model_summary
AhmedAlmaghz 9c81fd1
Update docs/source/ar/attention.md
AhmedAlmaghz af90106
Update docs/source/ar/attention.md
AhmedAlmaghz 78e168c
Update docs/source/ar/attention.md
AhmedAlmaghz 75a5f60
Update _toctree.yml - attention
AhmedAlmaghz 549eaff
Merge pull request #25 from AhmedAlmaghz/Update_toctree_yml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # آليات الانتباه | ||
|
|
||
| تستخدم معظم نماذج المحول (Transformer) الانتباه الكامل بحيث تكون مصفوفة الانتباه مربعة. ويمكن أن يمثل ذلك عنق زجاجة حسابيًا كبيرًا عندما تكون لديك نصوص طويلة. ويعد Longformer وReformer من النماذج التي تحاول أن تكون أكثر كفاءة وتستخدم نسخة مبعثرة من مصفوفة الانتباه لتسريع التدريب. | ||
|
|
||
| ## انتباه LSH | ||
|
|
||
| يستخدم [Reformer](model_doc/reformer) انتباه LSH. في الدالة softmax(QK^t)، فإن أكبر العناصر فقط (في بعد softmax) من المصفوفة QK^t هي التي ستعطي مساهمات مفيدة. لذلك، بالنسبة لكل استعلام q في Q، يمكننا أن نأخذ في الاعتبار فقط المفاتيح k في K القريبة من q. وتُستخدم دالة هاش لتحديد ما إذا كان q وk قريبين. ويتم تعديل قناع الانتباه لحجب الرمز الحالي (باستثناء الموضع الأول)، لأنه سيعطي استعلامًا ومفتاحًا متساويين (لذلك متشابهين للغاية). نظرًا لأن الهاش يمكن أن يكون عشوائيًا بعض الشيء، يتم في الممارسة العملية استخدام عدة دوال هاش (يحددها معامل n_rounds) ثم يتم حساب المتوسط معًا. | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## الانتباه المحلي | ||
|
|
||
| يستخدم [Longformer](model_doc/longformer) الانتباه المحلي: غالبًا ما يكون السياق المحلي (على سبيل المثال، ما هما الرمزان إلى اليسار واليمين؟) كافيًا لاتخاذ إجراء بالنسبة للرمز المعطى. أيضًا، عن طريق تكديس طبقات الانتباه التي لها نافذة صغيرة، سيكون للطبقة الأخيرة مجال استقبال أكبر من مجرد الرموز في النافذة، مما يسمح لها ببناء تمثيل للجملة بأكملها. | ||
|
|
||
| كما يتم منح بعض رموز الإدخال المختارة مسبقًا انتباهًا عالميًا: بالنسبة لهذه الرموز القليلة، يمكن لمصفوفة الانتباه الوصول إلى جميع الرموز وتكون هذه العملية متماثلة: فلجميع الرموز الأخرى إمكانية الوصول إلى تلك الرموز المحددة (بالإضافة إلى تلك الموجودة في نافذتهم المحلية). وهذا موضح في الشكل 2d من الورقة، انظر أدناه لمثال على قناع الانتباه: | ||
|
|
||
| <div class="flex justify-center"> | ||
| <img scale="50 %" align="center" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/local_attention_mask.png"/> | ||
| </div> | ||
|
|
||
| وباستخدام مصفوفات الانتباه هذه التي تحتوي على معلمات أقل، يسمح النموذج بإدخالات ذات طول تسلسل أكبر. | ||
|
AhmedAlmaghz marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## حيل أخرى | ||
|
|
||
| ### الترميزات الموضعية المحورية | ||
|
|
||
| يستخدم [Reformer](model_doc/reformer) ترميزات موضعية محورية: في نماذج المحول التقليدية، يكون الترميز الموضعي E مصفوفة بحجم \\(l\\) في \\(d\\)، حيث \\(l\\) هو طول التسلسل و\\(d\\) هو بعد الحالة المخفية. إذا كان لديك نصوص طويلة جدًا، فقد تكون هذه المصفوفة ضخمة وتستهلك مساحة كبيرة جدًا على وحدة معالجة الرسوميات (GPU). وللتخفيف من ذلك، تتكون الترميزات الموضعية المحورية من تحليل تلك المصفوفة الكبيرة E إلى مصفوفتين أصغر E1 وE2، بأبعاد \\(l_{1} \times d_{1}\\) و \\(l_{2} \times d_{2}\\)، بحيث \\(l_{1} \times l_{2} = l\\) و\\(d_{1} + d_{2} = d\\) (مع حاصل ضرب الأطوال، ينتهي الأمر بكونه أصغر بكثير). ويتم الحصول على الترميز للخطوة الزمنية \\(j\\) في E عن طريق ربط الترميزات للخطوة الزمنية \\(j \% l1\\) في E1 و \\(j // l1\\) في E2. | ||
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.