huggingface-llm-trainer
ما الذي تفعله
تدرّب هذه المهارة نماذج اللغة الذكاء الاصطناعي أو تضبطها دقيقاً على وحدات معالجة رسوميات سحابية. وهي لمن يريد تخصيص نموذج لاستخدامه دون إعداد وحدة معالجة رسوميات محلية.
متى تستخدمها
- ✓عندما تريد ضبط نموذج لغوي دقيقاً على مجموعة بياناتك.
- ✓عندما تريد التدريب بطريقة مثل SFT أو DPO أو GRPO أو نمذجة المكافأة.
- ✓عندما تريد تحويل نموذج مدرّب إلى صيغة GGUF للاستخدام المحلي.
رابط المهارة
https://github.com/huggingface/skills/blob/main/skills/huggingface-llm-trainer/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“اضبط نموذجاً لغوياً صغيراً دقيقاً على أمثلة دعم العملاء لدي، واحفظ النتيجة في حسابي على Hugging Face.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يجهّز الذكاء الاصطناعي مجموعة البيانات ويتحقق منها، ويختار العتاد ويقدّر التكلفة. ثم يكتب نص التدريب ويشغّله على Hugging Face Jobs، ويحفظ النموذج المدرّب في Hub عند الانتهاء.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
TRL Training on Hugging Face Jobs
Overview
Train language models using TRL (Transformer Reinforcement Learning) on fully managed Hugging Face infrastructure. No local GPU setup required—models train on cloud GPUs and results are automatically saved to the Hugging Face Hub.
TRL provides multiple training methods:
- SFT (Supervised Fine-Tuning) - Standard instruction tuning
- DPO (Direct Preference Optimization) - Alignment from preference data
- GRPO (Group Relative Policy Optimization) - Online RL training
- Reward Modeling - Train reward models for RLHF
For detailed TRL method documentation:
hf_doc_search("your query", product="trl")
hf_doc_fetch("https://huggingface.co/docs/trl/sft_trainer") # SFT
hf_doc_fetch("https://huggingface.co/docs/trl/dpo_trainer") # DPO
# etc.
See also: references/training_methods.md for method overviews and selection guidance
When to Use This Skill
Use this skill when users want to:
- Fine-tune language models on cloud GPUs without local infrastructure
- Train with TRL methods (SFT, DPO, GRPO, etc.)
- Run training jobs on Hugging Face Jobs infrastructure
- Convert trained models to GGUF for local deployment (Ollama, LM Studio, llama.cpp)
- Ensure trained models are permanently saved to the Hub
- Use modern workflows with optimized defaults
When to Use Unsloth
Use Unsloth (references/unsloth.md) instead of standard TRL when:
- Limited GPU memory - Unsloth uses ~60% less VRAM
- Speed matters - Unsloth is ~2x faster
- Training large models (>13B) - memory efficiency is critical
- Training Vision-Language Models (VLMs) - Unsloth has
FastVisionModelsupport
See references/unsloth.md for complete Unsloth documentation and scripts/unsloth_sft_example.py for a production-ready training script.
Key Directives
When assisting with training jobs:
ALWAYS use
hf_jobs()MCP tool - Submit jobs usinghf_jobs("uv", {...}), NOT bashtrl-jobscommands. Thescriptparameter accepts Python code directly. Do NOT save to local files unless the user explicitly requests it. Pass the script content as a string tohf_jobs(). If user asks to "train a model", "fine-tune", or similar requests, you MUST create the training script AND submit the job immediately usinghf_jobs().Always include Trackio - Every training script should include Trackio for real-time monitoring. Use example scripts in
scripts/as templates.Provide job details after submission - After submitting, provide job ID, monitoring URL, estimated time, and note that the user can request status checks later.
Use example scripts as templates - Reference
scripts/train_sft_example.py,scripts/train_dpo_example.py, etc. as starting points.
Local Script Execution
Repository scripts use PEP 723 inline dependencies. Run them with uv run:
uv run scripts/estimate_cost.py --help
uv run scripts/dataset_inspector.py --help
Prerequisites Checklist
Before starting any training job, verify:
✅ Account & Authentication
- Hugging Face Account with Pro, Team, or Enterprise plan (Jobs require paid plan)
- Authenticated login: Check with
hf_whoami() - HF_TOKEN for Hub Push ⚠️ CRITICAL - Training environment is ephemeral, must push to Hub or ALL training results are lost
- Token must have write permissions
- MUST pass
secrets={"HF_TOKEN": "$HF_TOKEN"}in job config to make token available (the$HF_TOKENsyntax references your actual token value)
✅ Dataset Requirements
- Dataset must exist on Hub or be loadable via
datasets.load_dataset() - Format must match training method (SFT: "messages"/text/prompt-completion; DPO: chosen/rejected; GRPO: prompt-only)
- ALWAYS validate unknown datasets before GPU training to prevent format failures (see Dataset Validation section below)
- Size appropriate for hardware (Demo: 50-100 examples on t4-small; Production: 1K-10K+ on a10g-large/a100-large)
⚠️ Critical Settings
- Timeout must exceed expected training time - Default 30min is TOO SHORT for most training. Minimum recommended: 1-2 hours. Job fails and loses all progress if timeout is exceeded.
- Hub push must be enabled - Config:
push_to_hub=True,hub_model_id="username/model-name"; Job:secrets={"HF_TOKEN": "$HF_TOKEN"}
Asynchronous Job Guidelines
**⚠️ IMPORTANT: Traini
الأسئلة الشائعة
هل أحتاج إلى وحدة معالجة رسوميات محلية؟
لا. يعمل التدريب على وحدات معالجة رسوميات سحابية مُدارة، فلا تحتاج إلى إعداد محلي.
هل يُحفظ النموذج المدرّب؟
نعم. تُحفظ النتائج في Hugging Face Hub تلقائياً.
هل تقدّر التكلفة؟
نعم. تقدير التكلفة جزء من اختيار العتاد لمهمة التدريب.
التفاصيل
الوصف الأصلي من المؤلف
Train or fine-tune language and vision models using TRL (Transformer Reinforcement Learning) or Unsloth with Hugging Face Jobs infrastructure. Covers SFT, DPO, GRPO and reward modeling training methods, plus GGUF conversion for local deployment. Includes guidance on the TRL Jobs package, UV scripts with PEP 723 format, dataset preparation and validation, hardware selection, cost estimation, Trackio monitoring, Hub authentication, model selection/leaderboards and model persistence. Use for tasks involving cloud GPU training, GGUF conversion, or when users mention training on Hugging Face Jobs w
repo: huggingface/skills
الشعبية
- نجوم GitHub
- 11k
- الترتيب
- #11774
- الترخيص
- Apache-2.0
- آخر تحديث
- 30/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
hf-cli
11kيساعد وكيلك على استخدام أداة Hugging Face في سطر الأوامر لتنزيل النماذج ومجموعات البيانات والـ Spaces والمستودعات ورفعها وإدارة الذاكرة المؤقتة المحلية.
hf-cloud-aws-context-discovery
11kيساعد وكيلك على معرفة ملف تعريف AWS والمنطقة وتفاصيل الحساب قبل أي عمل سحابي، حتى لا يخمّن أي حساب يستخدم.
hf-cloud-python-env-setup
11kيساعد وكيلك على إعداد بيئة Python نظيفة بإصدار مناسب ومكتبات حديثة، قبل تشغيل أتمتة SageMaker أو AWS.
hf-cloud-sagemaker-deployment-planner
11kيساعد وكيلك على التخطيط لنشر نموذج على Amazon SageMaker، فيختار الاستضافة الفورية أو بلا خادم أو غير المتزامنة أو الدفعية بإعدادات افتراضية مناسبة.
مهارات مشابهة
pytorch-patterns
280kيساعد وكيلك على استخدام PyTorch في نماذج تعلم الآلة. يطبّق أفضل الممارسات لتدريب النماذج بكفاءة ويضمن نتائج قابلة للتكرار.
evm-token-decimals
280kيساعد وكيلك على تجنب أخطاء الأعداد العشرية عبر شبكات البلوكتشين المختلفة. يضمن دقة قيم الرموز في المعاملات والحسابات.
ito-inference
280kيتيح لوكيلك التحقق من توفر نماذج الذكاء الاصطناعي للاستخدام. يربط طلب الحوسبة بخدمة النموذج الجاهزة.