Buckets:

download
raw
76 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;درک منحنی‌های یادگیری&quot;,&quot;local&quot;:&quot;understanding-learning-curves&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;منحنی‌های یادگیری چیستند؟&quot;,&quot;local&quot;:&quot;what-are-learning-curves&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;منحنی‌های هزینه&quot;,&quot;local&quot;:&quot;loss-curves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;منحنی‌های دقت&quot;,&quot;local&quot;:&quot;accuracy-curves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;همگرایی&quot;,&quot;local&quot;:&quot;convergence&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;تفسیر الگوهای منحنی یادگیری&quot;,&quot;local&quot;:&quot;interpreting-learning-curve-patterns&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;منحنی‌های یادگیری سالم&quot;,&quot;local&quot;:&quot;healthy-learning-curves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;نمونه‌های عملی&quot;,&quot;local&quot;:&quot;practical-examples&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;هنگام تعلیم&quot;,&quot;local&quot;:&quot;during-training&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;پس از تعلیم&quot;,&quot;local&quot;:&quot;after-training&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;بیش‌برازش&quot;,&quot;local&quot;:&quot;overfitting&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;۲. کم‌برازش&quot;,&quot;local&quot;:&quot;underfitting&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;۳. منحنی‌های یادگیری نوسانی&quot;,&quot;local&quot;:&quot;erratic-learning-curves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4}],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;نکات کلیدی&quot;,&quot;local&quot;:&quot;key-takeaways&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;آزمون بخش&quot;,&quot;local&quot;:&quot;section-quiz&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;۱. وقتی هزینه‌ی تعلیم کاهش می‌یابد اما هزینه‌ی اعتبارسنجی شروع به افزایش می‌کند، معمولاً چه معنایی دارد؟&quot;,&quot;local&quot;:&quot;۱-وقتی-هزینهی-تعلیم-کاهش-مییابد-اما-هزینهی-اعتبارسنجی-شروع-به-افزایش-میکند-معمولا-چه-معنایی-دارد&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;۲. چرا منحنی‌های دقت اغلب به‌جای افزایش هموار، الگویی «پله‌ای» یا شبیه سکون نشان می‌دهند؟&quot;,&quot;local&quot;:&quot;۲-چرا-منحنیهای-دقت-اغلب-بهجای-افزایش-هموار-الگویی-پلهای-یا-شبیه-سکون-نشان-میدهند&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;۳. وقتی منحنی‌های یادگیری نوسانی و بسیار متغیر می‌بینید، بهترین رویکرد چیست؟&quot;,&quot;local&quot;:&quot;۳-وقتی-منحنیهای-یادگیری-نوسانی-و-بسیار-متغیر-میبینید-بهترین-رویکرد-چیست&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;۴. چه زمانی باید استفاده از توقف زودهنگام را در نظر بگیرید؟&quot;,&quot;local&quot;:&quot;۴-چه-زمانی-باید-استفاده-از-توقف-زودهنگام-را-در-نظر-بگیرید&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;۵. چه چیزی نشان می‌دهد مدل شما ممکن است کم‌برازش باشد؟&quot;,&quot;local&quot;:&quot;۵-چه-چیزی-نشان-میدهد-مدل-شما-ممکن-است-کمبرازش-باشد&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/>
<link href="/docs/course/pr_1364/fa/_app/immutable/entry/start.CqZXmSrv.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/oyrVqMhC.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/B3UUDp28.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/entry/app.B4UvgX5H.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/BioDZtGL.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/NIl2lQjl.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/DN6uzRQe.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/nodes/0.DcFj1eGj.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/u5kFQ1Zb.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/nodes/50.BACONeF3.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/BjCHz3cj.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/B8VBSgkq.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/DFIrGYWg.js" rel="modulepreload">
<link href="/docs/course/pr_1364/fa/_app/immutable/chunks/NA1Q7nSg.js" rel="modulepreload">
<!--1p4o2dj--><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;درک منحنی‌های یادگیری&quot;,&quot;local&quot;:&quot;understanding-learning-curves&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;منحنی‌های یادگیری چیستند؟&quot;,&quot;local&quot;:&quot;what-are-learning-curves&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;منحنی‌های هزینه&quot;,&quot;local&quot;:&quot;loss-curves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;منحنی‌های دقت&quot;,&quot;local&quot;:&quot;accuracy-curves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;همگرایی&quot;,&quot;local&quot;:&quot;convergence&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;تفسیر الگوهای منحنی یادگیری&quot;,&quot;local&quot;:&quot;interpreting-learning-curve-patterns&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;منحنی‌های یادگیری سالم&quot;,&quot;local&quot;:&quot;healthy-learning-curves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;نمونه‌های عملی&quot;,&quot;local&quot;:&quot;practical-examples&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;هنگام تعلیم&quot;,&quot;local&quot;:&quot;during-training&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;پس از تعلیم&quot;,&quot;local&quot;:&quot;after-training&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;بیش‌برازش&quot;,&quot;local&quot;:&quot;overfitting&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;۲. کم‌برازش&quot;,&quot;local&quot;:&quot;underfitting&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4},{&quot;title&quot;:&quot;۳. منحنی‌های یادگیری نوسانی&quot;,&quot;local&quot;:&quot;erratic-learning-curves&quot;,&quot;sections&quot;:[],&quot;depth&quot;:4}],&quot;depth&quot;:3}],&quot;depth&quot;:2},{&quot;title&quot;:&quot;نکات کلیدی&quot;,&quot;local&quot;:&quot;key-takeaways&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;آزمون بخش&quot;,&quot;local&quot;:&quot;section-quiz&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;۱. وقتی هزینه‌ی تعلیم کاهش می‌یابد اما هزینه‌ی اعتبارسنجی شروع به افزایش می‌کند، معمولاً چه معنایی دارد؟&quot;,&quot;local&quot;:&quot;۱-وقتی-هزینهی-تعلیم-کاهش-مییابد-اما-هزینهی-اعتبارسنجی-شروع-به-افزایش-میکند-معمولا-چه-معنایی-دارد&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;۲. چرا منحنی‌های دقت اغلب به‌جای افزایش هموار، الگویی «پله‌ای» یا شبیه سکون نشان می‌دهند؟&quot;,&quot;local&quot;:&quot;۲-چرا-منحنیهای-دقت-اغلب-بهجای-افزایش-هموار-الگویی-پلهای-یا-شبیه-سکون-نشان-میدهند&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;۳. وقتی منحنی‌های یادگیری نوسانی و بسیار متغیر می‌بینید، بهترین رویکرد چیست؟&quot;,&quot;local&quot;:&quot;۳-وقتی-منحنیهای-یادگیری-نوسانی-و-بسیار-متغیر-میبینید-بهترین-رویکرد-چیست&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;۴. چه زمانی باید استفاده از توقف زودهنگام را در نظر بگیرید؟&quot;,&quot;local&quot;:&quot;۴-چه-زمانی-باید-استفاده-از-توقف-زودهنگام-را-در-نظر-بگیرید&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3},{&quot;title&quot;:&quot;۵. چه چیزی نشان می‌دهد مدل شما ممکن است کم‌برازش باشد؟&quot;,&quot;local&quot;:&quot;۵-چه-چیزی-نشان-میدهد-مدل-شما-ممکن-است-کمبرازش-باشد&quot;,&quot;sections&quot;:[],&quot;depth&quot;:3}],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/><!---->
<link href="/docs/course/pr_1364/fa/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div dir="rtl"><div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"><div class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span>Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="understanding-learning-curves" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#understanding-learning-curves"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>درک منحنی‌های یادگیری</span></h1><!--]--><!----> <div class="flex space-x-1 absolute z-10 right-0 top-0"><a href="https://discuss.huggingface.co/t/chapter-3-questions" target="_blank"><img alt="Ask a Question" class="!m-0" src="https://img.shields.io/badge/Ask%20a%20question-ffcb4c.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgLTEgMTA0IDEwNiI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOiMyMzFmMjA7fS5jbHMtMntmaWxsOiNmZmY5YWU7fS5jbHMtM3tmaWxsOiMwMGFlZWY7fS5jbHMtNHtmaWxsOiMwMGE5NGY7fS5jbHMtNXtmaWxsOiNmMTVkMjI7fS5jbHMtNntmaWxsOiNlMzFiMjM7fTwvc3R5bGU+PC9kZWZzPjx0aXRsZT5EaXNjb3Vyc2VfbG9nbzwvdGl0bGU+PGcgaWQ9IkxheWVyXzIiPjxnIGlkPSJMYXllcl8zIj48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik01MS44NywwQzIzLjcxLDAsMCwyMi44MywwLDUxYzAsLjkxLDAsNTIuODEsMCw1Mi44MWw1MS44Ni0uMDVjMjguMTYsMCw1MS0yMy43MSw1MS01MS44N1M4MCwwLDUxLjg3LDBaIi8+PHBhdGggY2xhc3M9ImNscy0yIiBkPSJNNTIuMzcsMTkuNzRBMzEuNjIsMzEuNjIsMCwwLDAsMjQuNTgsNjYuNDFsLTUuNzIsMTguNEwzOS40LDgwLjE3YTMxLjYxLDMxLjYxLDAsMSwwLDEzLTYwLjQzWiIvPjxwYXRoIGNsYXNzPSJjbHMtMyIgZD0iTTc3LjQ1LDMyLjEyYTMxLjYsMzEuNiwwLDAsMS0zOC4wNSw0OEwxOC44Niw4NC44MmwyMC45MS0yLjQ3QTMxLjYsMzEuNiwwLDAsMCw3Ny40NSwzMi4xMloiLz48cGF0aCBjbGFzcz0iY2xzLTQiIGQ9Ik03MS42MywyNi4yOUEzMS42LDMxLjYsMCwwLDEsMzguOCw3OEwxOC44Niw4NC44MiwzOS40LDgwLjE3QTMxLjYsMzEuNiwwLDAsMCw3MS42MywyNi4yOVoiLz48cGF0aCBjbGFzcz0iY2xzLTUiIGQ9Ik0yNi40Nyw2Ny4xMWEzMS42MSwzMS42MSwwLDAsMSw1MS0zNUEzMS42MSwzMS42MSwwLDAsMCwyNC41OCw2Ni40MWwtNS43MiwxOC40WiIvPjxwYXRoIGNsYXNzPSJjbHMtNiIgZD0iTTI0LjU4LDY2LjQxQTMxLjYxLDMxLjYxLDAsMCwxLDcxLjYzLDI2LjI5YTMxLjYxLDMxLjYxLDAsMCwwLTQ5LDM5LjYzbC0zLjc2LDE4LjlaIi8+PC9nPjwvZz48L3N2Zz4="/></a><!----> <!--[0--><a href="https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/en/chapter3/section7.ipynb" target="_blank"><img alt="Open In Colab" class="!m-0" src="https://colab.research.google.com/assets/colab-badge.svg"/></a><!--]--> <!--[0--><a href="https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter3/section7.ipynb" target="_blank"><img alt="Open In Studio Lab" class="!m-0" src="https://studiolab.sagemaker.aws/studiolab.svg"/></a><!--]--></div><!----> <p>حالا که یاد گرفته‌اید با استفاده از API <code>Trainer</code> و حلقه‌های تعلیم سفارشی، مدل را کوک کنید، درک نحوه‌ی تفسیر نتایج اهمیت زیادی دارد. منحنی‌های یادگیری ابزارهای ارزشمندی هستند که به شما کمک می‌کنند عملکرد مدل را هنگام تعلیم ارزیابی کنید و پیش از آنکه مشکلات عملکرد را کاهش دهند، آن‌ها را شناسایی کنید.</p> <p>در این بخش بررسی می‌کنیم چگونه منحنی‌های دقت و هزینه را بخوانیم و تفسیر کنیم، شکل‌های مختلف منحنی‌ها درباره‌ی رفتار مدل چه می‌گویند و چگونه مشکلات رایج تعلیم را برطرف کنیم.</p> <!--[1--><h2 class="relative group"><a id="what-are-learning-curves" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#what-are-learning-curves"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>منحنی‌های یادگیری چیستند؟</span></h2><!--]--><!----> <p>منحنی‌های یادگیری نمایش‌های بصری معیارهای عملکرد مدل شما در طول زمان و هنگام تعلیم هستند. دو منحنی مهمی که باید پایش شوند عبارت‌اند از:</p> <div dir="rtl"><ul><li><strong>منحنی‌های هزینه</strong>: نشان می‌دهند خطای مدل (هزینه) در طول گام‌ها یا دوره‌های تعلیم چگونه تغییر می‌کند</li> <li><strong>منحنی‌های دقت</strong>: درصد پیش‌بینی‌های درست را در طول گام‌ها یا دوره‌های تعلیم نشان می‌دهند</li></ul></div> <p>این منحنی‌ها به ما کمک می‌کنند بفهمیم آیا مدل به‌طور مؤثر یاد می‌گیرد یا نه و می‌توانند برای ایجاد تغییرات و بهبود عملکرد راهنمای ما باشند. در ترنسفورمرها، این معیارها برای هر بتچ به‌صورت جداگانه محاسبه و سپس روی دیسک ثبت می‌شوند. پس از آن می‌توانیم از کتابخانه‌هایی مانند <a href="https://wandb.ai/" rel="nofollow">Weights &amp; Biases</a> برای نمایش این منحنی‌ها و دنبال کردن عملکرد مدل در طول زمان استفاده کنیم.</p> <!--[2--><h3 class="relative group"><a id="loss-curves" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#loss-curves"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>منحنی‌های هزینه</span></h3><!--]--><!----> <p>منحنی هزینه نشان می‌دهد خطای مدل در طول زمان چگونه کاهش می‌یابد. در یک اجرای تعلیم موفق معمولاً منحنی‌ای مشابه نمونه‌ی زیر می‌بینید:</p> <p><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter3/1.png" alt="منحنی هزینه"/></p> <div dir="rtl"><ul><li><strong>هزینه‌ی اولیه‌ی زیاد</strong>: مدل بدون بهینه‌سازی شروع می‌کند، بنابراین پیش‌بینی‌های اولیه ضعیف هستند</li> <li><strong>کاهش هزینه</strong>: با پیشرفت تعلیم، هزینه معمولاً باید کاهش یابد</li> <li><strong>همگرایی</strong>: در نهایت هزینه روی مقداری کم ثابت می‌شود و نشان می‌دهد مدل الگوهای موجود در داده‌ها را یاد گرفته است</li></ul></div> <p>مانند فصل‌های قبل، می‌توانیم از API <code>Trainer</code> برای دنبال کردن این معیارها و نمایش آن‌ها در یک داشبورد استفاده کنیم. در نمونه‌ی زیر نحوه‌ی انجام این کار با Weights &amp; Biases را می‌بینید.</p> <div dir="ltr"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-comment"># Example of tracking loss during training with the Trainer</span>
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Trainer, TrainingArguments
<span class="hljs-keyword">import</span> wandb
<span class="hljs-comment"># Initialize Weights &amp; Biases for experiment tracking</span>
wandb.init(project=<span class="hljs-string">&quot;transformer-fine-tuning&quot;</span>, name=<span class="hljs-string">&quot;bert-mrpc-analysis&quot;</span>)
training_args = TrainingArguments(
output_dir=<span class="hljs-string">&quot;./results&quot;</span>,
eval_strategy=<span class="hljs-string">&quot;steps&quot;</span>,
eval_steps=<span class="hljs-number">50</span>,
save_steps=<span class="hljs-number">100</span>,
logging_steps=<span class="hljs-number">10</span>, <span class="hljs-comment"># Log metrics every 10 steps</span>
num_train_epochs=<span class="hljs-number">3</span>,
per_device_train_batch_size=<span class="hljs-number">16</span>,
per_device_eval_batch_size=<span class="hljs-number">16</span>,
report_to=<span class="hljs-string">&quot;wandb&quot;</span>, <span class="hljs-comment"># Send logs to Weights &amp; Biases</span>
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>],
eval_dataset=tokenized_datasets[<span class="hljs-string">&quot;validation&quot;</span>],
data_collator=data_collator,
processing_class=tokenizer,
compute_metrics=compute_metrics,
)
<span class="hljs-comment"># Train and automatically log metrics</span>
trainer.train()<!----></pre></div><!----></div> <!--[2--><h3 class="relative group"><a id="accuracy-curves" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#accuracy-curves"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>منحنی‌های دقت</span></h3><!--]--><!----> <p>منحنی دقت درصد پیش‌بینی‌های درست را در طول زمان نشان می‌دهد. برخلاف منحنی‌های هزینه، منحنی‌های دقت معمولاً با یادگیری مدل افزایش می‌یابند و معمولاً می‌توانند گام‌های بیشتری از منحنی هزینه داشته باشند.</p> <p><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter3/2.png" alt="منحنی دقت"/></p> <div dir="rtl"><ul><li><strong>شروع کم</strong>: دقت اولیه باید کم باشد، چون مدل هنوز الگوهای موجود در داده‌ها را یاد نگرفته است</li> <li><strong>افزایش با تعلیم</strong>: اگر مدل بتواند الگوهای داده‌ها را یاد بگیرد، دقت معمولاً با یادگیری مدل بهتر می‌شود</li> <li><strong>امکان وجود سکون</strong>: دقت اغلب به‌صورت جهش‌های گسسته افزایش می‌یابد، نه به‌صورت هموار؛ چون پیش‌بینی‌های مدل به برچسب‌های واقعی نزدیک هستند</li></ul></div> <blockquote class="tip"><p>💡 <strong>چرا منحنی‌های دقت «پله‌ای» هستند؟</strong> برخلاف هزینه که پیوسته است، دقت با مقایسه‌ی پیش‌بینی‌های گسسته با برچسب‌های واقعی محاسبه می‌شود. بهبودهای کوچک در اطمینان مدل ممکن است پیش‌بینی نهایی را تغییر ندهند؛ بنابراین دقت تا عبور از یک آستانه ثابت می‌ماند.</p></blockquote> <!--[2--><h3 class="relative group"><a id="convergence" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#convergence"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>همگرایی</span></h3><!--]--><!----> <p>همگرایی زمانی رخ می‌دهد که عملکرد مدل ثابت شود و منحنی‌های هزینه و دقت به سطحی تقریباً افقی برسند. این نشانه‌ای است که مدل الگوهای موجود در داده‌ها را یاد گرفته و آماده‌ی استفاده است. به زبان ساده، هدف ما این است که مدل هر بار که تعلیم می‌بیند به عملکردی پایدار همگرا شود.</p> <p><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter3/4.png" alt="همگرایی"/></p> <p>پس از همگرایی مدل‌ها، می‌توانیم از آن‌ها برای پیش‌بینی روی داده‌های جدید استفاده کنیم و با مراجعه به معیارهای ارزیابی بفهمیم مدل تا چه اندازه خوب عمل می‌کند.</p> <!--[1--><h2 class="relative group"><a id="interpreting-learning-curve-patterns" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#interpreting-learning-curve-patterns"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>تفسیر الگوهای منحنی یادگیری</span></h2><!--]--><!----> <p>شکل‌های مختلف منحنی جنبه‌های متفاوتی از تعلیم مدل را آشکار می‌کنند. بیایید رایج‌ترین الگوها و معنای آن‌ها را بررسی کنیم.</p> <!--[2--><h3 class="relative group"><a id="healthy-learning-curves" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#healthy-learning-curves"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>منحنی‌های یادگیری سالم</span></h3><!--]--><!----> <p>یک اجرای تعلیم با رفتار مناسب معمولاً منحنی‌هایی مشابه نمونه‌ی زیر نشان می‌دهد:</p> <p><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter3/5.png" alt="منحنی هزینه‌ی سالم"/></p> <p>بیایید به تصویر بالا نگاه کنیم. در سمت چپ منحنی هزینه و در سمت راست منحنی دقت متناظر نمایش داده شده است. این منحنی‌ها ویژگی‌های متمایزی دارند.</p> <p>منحنی هزینه مقدار هزینه‌ی مدل را در طول زمان نشان می‌دهد. در ابتدا هزینه زیاد است و سپس به‌تدریج کاهش می‌یابد که نشان می‌دهد مدل در حال بهتر شدن است. کاهش مقدار هزینه نشان می‌دهد مدل پیش‌بینی‌های بهتری انجام می‌دهد، چون هزینه خطای میان خروجی پیش‌بینی‌شده و خروجی واقعی را نشان می‌دهد.</p> <p>حالا تمرکز خود را به منحنی دقت منتقل کنیم. این منحنی دقت مدل را در طول زمان نشان می‌دهد. منحنی دقت از مقدار کمی شروع می‌شود و با پیشرفت تعلیم افزایش می‌یابد. دقت، نسبت نمونه‌هایی را که درست دسته‌بندی شده‌اند اندازه می‌گیرد. بنابراین افزایش منحنی دقت نشان می‌دهد مدل پیش‌بینی‌های درست بیشتری انجام می‌دهد.</p> <p>یکی از تفاوت‌های قابل‌توجه میان این منحنی‌ها، همواری و وجود «سکون» در منحنی دقت است. در حالی که هزینه به‌صورت هموار کاهش می‌یابد، سکون‌های منحنی دقت نشان‌دهنده‌ی جهش‌های گسسته در دقت هستند، نه افزایش پیوسته. این رفتار به نحوه‌ی اندازه‌گیری دقت مربوط است. اگر خروجی مدل به هدف نزدیک‌تر شود، هزینه می‌تواند بهتر شود، حتی اگر پیش‌بینی نهایی همچنان نادرست باشد. اما دقت فقط زمانی بهتر می‌شود که پیش‌بینی از آستانه عبور کند و درست شود.</p> <p>برای مثال، در یک دسته‌بندی‌کننده‌ی دودویی که گربه‌ها (۰) را از سگ‌ها (۱) متمایز می‌کند، اگر مدل برای تصویر یک سگ (با مقدار واقعی ۱) مقدار ۰٫۳ را پیش‌بینی کند، این مقدار به ۰ گرد می‌شود و دسته‌بندی نادرستی است. اگر در گام بعد مقدار ۰٫۴ را پیش‌بینی کند، باز هم نادرست است. هزینه کاهش می‌یابد، چون ۰٫۴ از ۰٫۳ به ۱ نزدیک‌تر است، اما دقت تغییر نمی‌کند و یک سکون ایجاد می‌شود. دقت فقط زمانی جهش می‌کند که مدل مقداری بزرگ‌تر از ۰٫۵ پیش‌بینی کند که به ۱ گرد شود.</p> <blockquote class="tip"><p><strong>ویژگی‌های منحنی‌های سالم:</strong></p> <ul><li><strong>کاهش هموار هزینه</strong>: هزینه‌ی تعلیم و اعتبارسنجی هر دو به‌طور پیوسته کاهش می‌یابند</li> <li><strong>عملکرد نزدیک تعلیم و اعتبارسنجی</strong>: فاصله‌ی میان معیارهای تعلیم و اعتبارسنجی کم است</li> <li><strong>همگرایی</strong>: منحنی‌ها به سطحی ثابت می‌رسند و نشان می‌دهند مدل الگوها را یاد گرفته است</li></ul></blockquote> <!--[2--><h3 class="relative group"><a id="practical-examples" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#practical-examples"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>نمونه‌های عملی</span></h3><!--]--><!----> <p>بیایید چند نمونه‌ی عملی از منحنی‌های یادگیری را بررسی کنیم. ابتدا چند روش برای پایش منحنی‌های یادگیری هنگام تعلیم معرفی می‌کنیم. سپس الگوهای مختلفی را که ممکن است در منحنی‌های یادگیری دیده شوند، بررسی خواهیم کرد.</p> <!--[3--><h4 class="relative group"><a id="during-training" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#during-training"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>هنگام تعلیم</span></h4><!--]--><!----> <p>در فرایند تعلیم (پس از اجرای <code>trainer.train()</code>)، می‌توانید این شاخص‌های کلیدی را پایش کنید:</p> <ol><li><strong>همگرایی هزینه</strong>: آیا هزینه همچنان در حال کاهش است یا ثابت شده است؟</li> <li><strong>نشانه‌های بیش‌برازش</strong>: آیا هزینه‌ی اعتبارسنجی در حالی که هزینه‌ی تعلیم کاهش می‌یابد، شروع به افزایش کرده است؟</li> <li><strong>نرخ یادگیری</strong>: آیا منحنی‌ها بیش‌ازحد نوسانی هستند (نرخ یادگیری خیلی زیاد) یا بیش‌ازحد تخت هستند (نرخ یادگیری خیلی کم)؟</li> <li><strong>پایداری</strong>: آیا جهش یا افت ناگهانی‌ای وجود دارد که نشان‌دهنده‌ی مشکل باشد؟</li></ol> <!--[3--><h4 class="relative group"><a id="after-training" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#after-training"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>پس از تعلیم</span></h4><!--]--><!----> <p>پس از پایان فرایند تعلیم، می‌توانید منحنی‌های کامل را تحلیل کنید تا عملکرد مدل را بفهمید.</p> <ol><li><strong>عملکرد نهایی</strong>: آیا مدل به سطوح قابل‌قبولی از عملکرد رسیده است؟</li> <li><strong>کارایی</strong>: آیا می‌شد با دوره‌های کمتر به همان عملکرد رسید؟</li> <li><strong>تعمیم‌پذیری</strong>: عملکرد تعلیم و اعتبارسنجی چقدر به هم نزدیک هستند؟</li> <li><strong>روندها</strong>: آیا تعلیم بیشتر احتمالاً عملکرد را بهتر می‌کند؟</li></ol> <blockquote class="tip"><p>🔍 <strong>قابلیت‌های داشبورد W&amp;B</strong>: Weights &amp; Biases به‌صورت خودکار نمودارهای زیبا و تعاملی از منحنی‌های یادگیری ایجاد می‌کند. شما می‌توانید:</p> <ul><li>چند اجرای مختلف را کنار هم مقایسه کنید</li> <li>معیارها و نمایش‌های بصری سفارشی اضافه کنید</li> <li>برای رفتار غیرعادی هشدار تنظیم کنید</li> <li>نتایج را با تیم خود به اشتراک بگذارید</li></ul> <p>در <a href="https://docs.wandb.ai/" rel="nofollow">مستندات Weights &amp; Biases</a> بیشتر بیاموزید.</p></blockquote> <!--[3--><h4 class="relative group"><a id="overfitting" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#overfitting"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>بیش‌برازش</span></h4><!--]--><!----> <p>بیش‌برازش زمانی رخ می‌دهد که مدل بیش‌ازحد از داده‌های تعلیم یاد می‌گیرد و نمی‌تواند به داده‌های متفاوت تعمیم دهد (که با مجموعه‌ی اعتبارسنجی نمایش داده می‌شوند).</p> <p><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter3/10.png" alt="بیش‌برازش"/></p> <p><strong>نشانه‌ها:</strong></p> <div dir="rtl"><ul><li>هزینه‌ی تعلیم همچنان کاهش می‌یابد، در حالی که هزینه‌ی اعتبارسنجی افزایش می‌یابد یا ثابت می‌ماند</li> <li>فاصله‌ی زیاد میان دقت تعلیم و اعتبارسنجی</li> <li>دقت تعلیم بسیار بیشتر از دقت اعتبارسنجی است</li></ul></div> <p><strong>راه‌حل‌های بیش‌برازش:</strong></p> <div dir="rtl"><ul><li><strong>منظم‌سازی</strong>: dropout، کاهش وزن یا تکنیک‌های دیگر منظم‌سازی را اضافه کنید</li> <li><strong>توقف زودهنگام</strong>: وقتی عملکرد اعتبارسنجی دیگر بهتر نمی‌شود، تعلیم را متوقف کنید</li> <li><strong>افزایش داده</strong>: تنوع داده‌های تعلیم را افزایش دهید</li> <li><strong>کاهش پیچیدگی مدل</strong>: از مدل کوچک‌تر یا پارامترهای کمتری استفاده کنید</li></ul></div> <p>در نمونه‌ی زیر برای جلوگیری از بیش‌برازش از توقف زودهنگام استفاده می‌کنیم. <code>early_stopping_patience</code> را روی ۳ تنظیم می‌کنیم؛ یعنی اگر هزینه‌ی اعتبارسنجی برای ۳ دوره‌ی متوالی بهتر نشود، تعلیم متوقف خواهد شد.</p> <div dir="ltr"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-comment"># Example of detecting overfitting with early stopping</span>
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> EarlyStoppingCallback
training_args = TrainingArguments(
output_dir=<span class="hljs-string">&quot;./results&quot;</span>,
eval_strategy=<span class="hljs-string">&quot;steps&quot;</span>,
eval_steps=<span class="hljs-number">100</span>,
save_strategy=<span class="hljs-string">&quot;steps&quot;</span>,
save_steps=<span class="hljs-number">100</span>,
load_best_model_at_end=<span class="hljs-literal">True</span>,
metric_for_best_model=<span class="hljs-string">&quot;eval_loss&quot;</span>,
greater_is_better=<span class="hljs-literal">False</span>,
num_train_epochs=<span class="hljs-number">10</span>, <span class="hljs-comment"># Set high, but we&#x27;ll stop early</span>
)
<span class="hljs-comment"># Add early stopping to prevent overfitting</span>
trainer = Trainer(
model=model,
args=training_args,
train_dataset=tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>],
eval_dataset=tokenized_datasets[<span class="hljs-string">&quot;validation&quot;</span>],
data_collator=data_collator,
processing_class=tokenizer,
compute_metrics=compute_metrics,
callbacks=[EarlyStoppingCallback(early_stopping_patience=<span class="hljs-number">3</span>)],
)<!----></pre></div><!----></div> <!--[3--><h4 class="relative group"><a id="underfitting" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#underfitting"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>۲. کم‌برازش</span></h4><!--]--><!----> <p>کم‌برازش زمانی رخ می‌دهد که مدل برای ثبت الگوهای زیربنایی داده‌ها بیش‌ازحد ساده باشد. این اتفاق می‌تواند به چند دلیل رخ دهد:</p> <div dir="rtl"><ul><li>مدل بیش‌ازحد کوچک است یا ظرفیت لازم برای یادگیری الگوها را ندارد</li> <li>نرخ یادگیری بیش‌ازحد کم است و باعث یادگیری آهسته می‌شود</li> <li>دیتاست بیش‌ازحد کوچک است یا نماینده‌ی مسئله نیست</li> <li>مدل به‌درستی منظم‌سازی نشده است</li></ul></div> <p><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter3/7.png" alt="کم‌برازش"/></p> <p><strong>نشانه‌ها:</strong></p> <div dir="rtl"><ul><li>هزینه‌ی تعلیم و اعتبارسنجی هر دو زیاد باقی می‌مانند</li> <li>عملکرد مدل در ابتدای تعلیم ثابت می‌شود</li> <li>دقت تعلیم کمتر از مقدار مورد انتظار است</li></ul></div> <p><strong>راه‌حل‌های کم‌برازش:</strong></p> <div dir="rtl"><ul><li><strong>افزایش ظرفیت مدل</strong>: از مدل بزرگ‌تر یا پارامترهای بیشتری استفاده کنید</li> <li><strong>تعلیم طولانی‌تر</strong>: تعداد دوره‌ها را افزایش دهید</li> <li><strong>تنظیم نرخ یادگیری</strong>: نرخ‌های یادگیری متفاوتی را امتحان کنید</li> <li><strong>بررسی کیفیت داده</strong>: مطمئن شوید داده‌ها به‌درستی پیش‌پردازش شده‌اند</li></ul></div> <p>در نمونه‌ی زیر برای آنکه ببینیم آیا مدل می‌تواند الگوهای داده‌ها را یاد بگیرد، آن را برای دوره‌های بیشتری تعلیم می‌دهیم.</p> <div dir="ltr"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments
training_args = TrainingArguments(
output_dir=<span class="hljs-string">&quot;./results&quot;</span>,
-num_train_epochs=<span class="hljs-number">5</span>,
+num_train_epochs=<span class="hljs-number">10</span>,
)<!----></pre></div><!----></div> <!--[3--><h4 class="relative group"><a id="erratic-learning-curves" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#erratic-learning-curves"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>۳. منحنی‌های یادگیری نوسانی</span></h4><!--]--><!----> <p>منحنی‌های یادگیری نوسانی زمانی رخ می‌دهند که مدل به‌طور مؤثر یاد نمی‌گیرد. این اتفاق می‌تواند به چند دلیل رخ دهد:</p> <div dir="rtl"><ul><li>نرخ یادگیری بیش‌ازحد زیاد است و باعث می‌شود مدل از پارامترهای بهینه عبور کند</li> <li>اندازه‌ی بتچ بیش‌ازحد کوچک است و باعث یادگیری آهسته‌ی مدل می‌شود</li> <li>مدل به‌درستی منظم‌سازی نشده است و روی داده‌های تعلیم بیش‌برازش می‌کند</li> <li>دیتاست به‌درستی پیش‌پردازش نشده است و باعث می‌شود مدل از نویز یاد بگیرد</li></ul></div> <p><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter3/3.png" alt="منحنی‌های یادگیری نوسانی"/></p> <p><strong>نشانه‌ها:</strong></p> <div dir="rtl"><ul><li>نوسان‌های مکرر در هزینه یا دقت</li> <li>واریانس زیاد یا ناپایداری در منحنی‌ها</li> <li>نوسان عملکرد بدون روند مشخص</li></ul></div> <p>هر دو منحنی تعلیم و اعتبارسنجی رفتار نوسانی نشان می‌دهند.</p> <p><img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter3/9.png" alt="منحنی‌های یادگیری نوسانی"/></p> <p><strong>راه‌حل‌های منحنی‌های نوسانی:</strong></p> <div dir="rtl"><ul><li><strong>کاهش نرخ یادگیری</strong>: اندازه‌ی گام را برای تعلیم پایدارتر کاهش دهید</li> <li><strong>افزایش اندازه‌ی بتچ</strong>: بتچ‌های بزرگ‌تر گرادیان‌های پایدارتر ایجاد می‌کنند</li> <li><strong>بُرش گرادیان</strong>: از انفجار گرادیان‌ها جلوگیری کنید</li> <li><strong>پیش‌پردازش بهتر داده</strong>: از کیفیت یکسان داده‌ها مطمئن شوید</li></ul></div> <p>در نمونه‌ی زیر نرخ یادگیری را کاهش می‌دهیم و اندازه‌ی بتچ را افزایش می‌دهیم.</p> <div dir="ltr"><div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copied</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments
training_args = TrainingArguments(
output_dir=<span class="hljs-string">&quot;./results&quot;</span>,
-learning_rate=<span class="hljs-number">1e-5</span>,
+learning_rate=<span class="hljs-number">1e-4</span>,
-per_device_train_batch_size=<span class="hljs-number">16</span>,
+per_device_train_batch_size=<span class="hljs-number">32</span>,
)<!----></pre></div><!----></div> <!--[1--><h2 class="relative group"><a id="key-takeaways" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#key-takeaways"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>نکات کلیدی</span></h2><!--]--><!----> <p>درک منحنی‌های یادگیری برای تبدیل شدن به یک متخصص کارآمد یادگیری ماشین ضروری است. این ابزارهای بصری بازخوردی فوری درباره‌ی پیشرفت تعلیم مدل ارائه می‌دهند و کمک می‌کنند درباره‌ی زمان توقف تعلیم، تنظیم ابرپارامترها یا امتحان کردن رویکردهای متفاوت تصمیم‌های آگاهانه بگیرید. با تمرین، درک شهودی‌ای از شکل منحنی‌های یادگیری سالم پیدا می‌کنید و یاد می‌گیرید هنگام بروز مشکل چگونه آن را برطرف کنید.</p> <blockquote class="tip"><p>💡 <strong>نکات کلیدی:</strong></p> <ul><li>منحنی‌های یادگیری ابزارهایی ضروری برای درک پیشرفت تعلیم مدل هستند</li> <li>هم منحنی‌های هزینه و هم دقت را پایش کنید، اما به یاد داشته باشید ویژگی‌های متفاوتی دارند</li> <li>بیش‌برازش به‌صورت واگرایی عملکرد تعلیم و اعتبارسنجی دیده می‌شود</li> <li>کم‌برازش به‌صورت عملکرد ضعیف روی داده‌های تعلیم و اعتبارسنجی دیده می‌شود</li> <li>ابزارهایی مانند Weights &amp; Biases دنبال کردن و تحلیل منحنی‌های یادگیری را آسان می‌کنند</li> <li>توقف زودهنگام و منظم‌سازی درست می‌توانند بیشتر مشکلات رایج تعلیم را برطرف کنند</li></ul> <p>🔬 <strong>گام‌های بعدی</strong>: تحلیل منحنی‌های یادگیری را روی آزمایش‌های کوک کردن خود تمرین کنید. ابرپارامترهای مختلف را امتحان کنید و ببینید چگونه بر شکل منحنی‌ها اثر می‌گذارند. این تجربه‌ی عملی بهترین راه برای ایجاد درک شهودی از پیشرفت تعلیم است.</p></blockquote> <!--[1--><h2 class="relative group"><a id="section-quiz" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#section-quiz"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>آزمون بخش</span></h2><!--]--><!----> <p>درک خود را از منحنی‌های یادگیری و تحلیل تعلیم بیازمایید:</p> <!--[2--><h3 class="relative group"><a id="۱-وقتی-هزینهی-تعلیم-کاهش-مییابد-اما-هزینهی-اعتبارسنجی-شروع-به-افزایش-میکند-معمولا-چه-معنایی-دارد" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#۱-وقتی-هزینهی-تعلیم-کاهش-مییابد-اما-هزینهی-اعتبارسنجی-شروع-به-افزایش-میکند-معمولا-چه-معنایی-دارد"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>۱. وقتی هزینه‌ی تعلیم کاهش می‌یابد اما هزینه‌ی اعتبارسنجی شروع به افزایش می‌کند، معمولاً چه معنایی دارد؟</span></h3><!--]--><!----> <div><form><!--[--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="0"/> <!---->مدل با موفقیت در حال یادگیری است و همچنان بهتر خواهد شد.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="1"/> <!---->مدل روی داده‌های تعلیم بیش‌برازش کرده است.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="2"/> <!---->نرخ یادگیری بیش‌ازحد کم است.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="3"/> <!---->دیتاست بیش‌ازحد کوچک است.<!----></label> <!--[-1--><!--]--><!--]--> <div class="flex flex-row items-center mt-3"><button class="btn px-4 mr-4" type="submit" disabled="">Submit</button> <!--[-1--><!--]--></div></form></div><!----> <!--[2--><h3 class="relative group"><a id="۲-چرا-منحنیهای-دقت-اغلب-بهجای-افزایش-هموار-الگویی-پلهای-یا-شبیه-سکون-نشان-میدهند" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#۲-چرا-منحنیهای-دقت-اغلب-بهجای-افزایش-هموار-الگویی-پلهای-یا-شبیه-سکون-نشان-میدهند"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>۲. چرا منحنی‌های دقت اغلب به‌جای افزایش هموار، الگویی «پله‌ای» یا شبیه سکون نشان می‌دهند؟</span></h3><!--]--><!----> <div><form><!--[--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="0"/> <!---->در محاسبه‌ی دقت خطایی وجود دارد.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="1"/> <!---->دقت معیاری گسسته است که فقط هنگام عبور پیش‌بینی‌ها از مرزهای تصمیم تغییر می‌کند.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="2"/> <!---->مدل به‌طور مؤثر یاد نمی‌گیرد.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="3"/> <!---->اندازه‌ی بتچ بیش‌ازحد کوچک است.<!----></label> <!--[-1--><!--]--><!--]--> <div class="flex flex-row items-center mt-3"><button class="btn px-4 mr-4" type="submit" disabled="">Submit</button> <!--[-1--><!--]--></div></form></div><!----> <!--[2--><h3 class="relative group"><a id="۳-وقتی-منحنیهای-یادگیری-نوسانی-و-بسیار-متغیر-میبینید-بهترین-رویکرد-چیست" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#۳-وقتی-منحنیهای-یادگیری-نوسانی-و-بسیار-متغیر-میبینید-بهترین-رویکرد-چیست"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>۳. وقتی منحنی‌های یادگیری نوسانی و بسیار متغیر می‌بینید، بهترین رویکرد چیست؟</span></h3><!--]--><!----> <div><form><!--[--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="0"/> <!---->نرخ یادگیری را افزایش دهید تا همگرایی سریع‌تر شود.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="1"/> <!---->نرخ یادگیری را کاهش دهید و احتمالاً اندازه‌ی بتچ را افزایش دهید.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="2"/> <!---->تعلیم را فوراً متوقف کنید، چون مدل بهتر نخواهد شد.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="3"/> <!---->به معماری کاملاً متفاوتی از مدل تغییر دهید.<!----></label> <!--[-1--><!--]--><!--]--> <div class="flex flex-row items-center mt-3"><button class="btn px-4 mr-4" type="submit" disabled="">Submit</button> <!--[-1--><!--]--></div></form></div><!----> <!--[2--><h3 class="relative group"><a id="۴-چه-زمانی-باید-استفاده-از-توقف-زودهنگام-را-در-نظر-بگیرید" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#۴-چه-زمانی-باید-استفاده-از-توقف-زودهنگام-را-در-نظر-بگیرید"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>۴. چه زمانی باید استفاده از توقف زودهنگام را در نظر بگیرید؟</span></h3><!--]--><!----> <div><form><!--[--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="0"/> <!---->همیشه، چون از هر نوع بیش‌برازش جلوگیری می‌کند.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="1"/> <!---->وقتی عملکرد اعتبارسنجی دیگر بهتر نمی‌شود یا شروع به افت می‌کند.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="2"/> <!---->فقط وقتی هزینه‌ی تعلیم همچنان به‌سرعت کاهش می‌یابد.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="3"/> <!---->هرگز، چون مانع رسیدن مدل به تمام ظرفیتش می‌شود.<!----></label> <!--[-1--><!--]--><!--]--> <div class="flex flex-row items-center mt-3"><button class="btn px-4 mr-4" type="submit" disabled="">Submit</button> <!--[-1--><!--]--></div></form></div><!----> <!--[2--><h3 class="relative group"><a id="۵-چه-چیزی-نشان-میدهد-مدل-شما-ممکن-است-کمبرازش-باشد" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#۵-چه-چیزی-نشان-میدهد-مدل-شما-ممکن-است-کمبرازش-باشد"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span>۵. چه چیزی نشان می‌دهد مدل شما ممکن است کم‌برازش باشد؟</span></h3><!--]--><!----> <div><form><!--[--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="0"/> <!---->دقت تعلیم بسیار بیشتر از دقت اعتبارسنجی است.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="1"/> <!---->عملکرد تعلیم و اعتبارسنجی هر دو ضعیف هستند و در ابتدای کار ثابت می‌شوند.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="2"/> <!---->منحنی‌های یادگیری بسیار هموار و بدون نوسان هستند.<!----></label> <!--[-1--><!--]--><label class="block"><input autocomplete="off" class="form-input -mt-1.5 mr-2" name="choice" type="checkbox" value="3"/> <!---->هزینه‌ی اعتبارسنجی سریع‌تر از هزینه‌ی تعلیم کاهش می‌یابد.<!----></label> <!--[-1--><!--]--><!--]--> <div class="flex flex-row items-center mt-3"><button class="btn px-4 mr-4" type="submit" disabled="">Submit</button> <!--[-1--><!--]--></div></form></div><!----></div> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/course/blob/main/chapters/fa/chapter3/5.mdx" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]-->
<script>
{
__sveltekit_pfm8ny = {
base: "/docs/course/pr_1364/fa",
assets: "/docs/course/pr_1364/fa"
};
const element = document.currentScript.parentElement;
Promise.all([
import("/docs/course/pr_1364/fa/_app/immutable/entry/start.CqZXmSrv.js"),
import("/docs/course/pr_1364/fa/_app/immutable/entry/app.B4UvgX5H.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 50],
data: [null,null],
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
76 kB
·
Xet hash:
8efe17694d57f565fedfc3e3e3ea1ba834a7e95311ef9e8870f721ac506beddd

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.