Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Gated models","local":"gated-models","sections":[{"title":"Manage gated models as a model author","local":"manage-gated-models-as-a-model-author","sections":[{"title":"Review access requests","local":"review-access-requests","sections":[{"title":"From the UI","local":"from-the-ui","sections":[],"depth":4},{"title":"Via the API","local":"via-the-api","sections":[],"depth":4}],"depth":3},{"title":"Download access report","local":"download-access-report","sections":[],"depth":3},{"title":"Customize requested information","local":"customize-requested-information","sections":[],"depth":3},{"title":"Example use cases of programmatically managing access requests","local":"example-use-cases-of-programmatically-managing-access-requests","sections":[],"depth":3}],"depth":2},{"title":"Access gated models as a user","local":"access-gated-models-as-a-user","sections":[{"title":"Download files","local":"download-files","sections":[],"depth":3}],"depth":2}],"depth":1}"> | |
| <link href="/docs/hub/main/en/_app/immutable/assets/0.e3b0c442.css" rel="modulepreload"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/entry/start.d0cd5065.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/scheduler.d6170356.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/singletons.d032f1eb.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/paths.752f1c6b.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/entry/app.b6abe3c1.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/index.fcd4cc08.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/nodes/0.f045427f.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/nodes/78.693638cd.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/Tip.b09c67cf.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/CodeBlock.7b16bdef.js"> | |
| <link rel="modulepreload" href="/docs/hub/main/en/_app/immutable/chunks/EditOnGithub.da2b595c.js"><!-- HEAD_svelte-u9bgzb_START --><meta name="hf:doc:metadata" content="{"title":"Gated models","local":"gated-models","sections":[{"title":"Manage gated models as a model author","local":"manage-gated-models-as-a-model-author","sections":[{"title":"Review access requests","local":"review-access-requests","sections":[{"title":"From the UI","local":"from-the-ui","sections":[],"depth":4},{"title":"Via the API","local":"via-the-api","sections":[],"depth":4}],"depth":3},{"title":"Download access report","local":"download-access-report","sections":[],"depth":3},{"title":"Customize requested information","local":"customize-requested-information","sections":[],"depth":3},{"title":"Example use cases of programmatically managing access requests","local":"example-use-cases-of-programmatically-managing-access-requests","sections":[],"depth":3}],"depth":2},{"title":"Access gated models as a user","local":"access-gated-models-as-a-user","sections":[{"title":"Download files","local":"download-files","sections":[],"depth":3}],"depth":2}],"depth":1}"><!-- HEAD_svelte-u9bgzb_END --> <p></p> <h1 class="relative group"><a id="gated-models" 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="#gated-models"><span><svg class="" 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>Gated models</span></h1> <p data-svelte-h="svelte-lyogpd">To give more control over how models are used, the Hub allows model authors to enable <strong>access requests</strong> for their models. Users must agree to share their contact information (username and email address) with the model authors to access the model files when enabled. Model authors can configure this request with additional fields. A model with access requests enabled is called a <strong>gated model</strong>. Access requests are always granted to individual users rather than to entire organizations. A common use case of gated models is to provide access to early research models before the wider release.</p> <h2 class="relative group"><a id="manage-gated-models-as-a-model-author" 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="#manage-gated-models-as-a-model-author"><span><svg class="" 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>Manage gated models as a model author</span></h2> <a id="manual-approval"></a> <a id="notifications-settings"></a> <p data-svelte-h="svelte-1anvtb0">To enable access requests, go to the model settings page. By default, the model is not gated. Click on <strong>Enable Access request</strong> in the top-right corner.</p> <div class="flex justify-center" data-svelte-h="svelte-10b12yr"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-disabled.png"> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-disabled-dark.png"></div> <p data-svelte-h="svelte-1lfr8yj">By default, access to the model is automatically granted to the user when requesting it. This is referred to as <strong>automatic approval</strong>. In this mode, any user can access your model once they’ve shared their personal information with you.</p> <div class="flex justify-center" data-svelte-h="svelte-iweqzt"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-enabled.png"> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-enabled-dark.png"></div> <p data-svelte-h="svelte-1a6didr">If you want to manually approve which users can access your model, you must set it to <strong>manual approval</strong>. When this is the case, you will notice more options:</p> <ul data-svelte-h="svelte-3t12mm"><li><strong>Add access</strong> allows you to search for a user and grant them access even if they did not request it.</li> <li><strong>Notification frequency</strong> lets you configure when to get notified if new users request access. It can be set to once a day or real-time. By default, an email is sent to your primary email address. For models hosted under an organization, emails are by default sent to the first 5 admins of the organization. In both cases (user or organization) you can set a different email address in the <strong>Notifications email</strong> field.</li></ul> <div class="flex justify-center" data-svelte-h="svelte-1sf1cc7"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-manual-approval.png"> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-manual-approval-dark.png"></div> <h3 class="relative group"><a id="review-access-requests" 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="#review-access-requests"><span><svg class="" 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>Review access requests</span></h3> <p data-svelte-h="svelte-znqy4j">Once access requests are enabled, you have full control of who can access your model or not, whether the approval mode is manual or automatic. You can review and manage requests either from the UI or via the API.</p> <h4 class="relative group"><a id="from-the-ui" 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="#from-the-ui"><span><svg class="" 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>From the UI</span></h4> <p data-svelte-h="svelte-1v3bi3i">You can review who has access to your gated model from its settings page by clicking on the <strong>Review access requests</strong> button. This will open a modal with 3 lists of users:</p> <ul data-svelte-h="svelte-7nrvc6"><li><strong>pending</strong>: the list of users waiting for approval to access your model. This list is empty unless you’ve selected <strong>manual approval</strong>. You can either <strong>Accept</strong> or <strong>Reject</strong> the demand. If the demand is rejected, the user cannot access your model and cannot request access again.</li> <li><strong>accepted</strong>: the complete list of users with access to your model. You can choose to <strong>Reject</strong> access at any time for any user, whether the approval mode is manual or automatic. You can also <strong>Cancel</strong> the approval, which will move the user to the <em>pending</em> list.</li> <li><strong>rejected</strong>: the list of users you’ve manually rejected. Those users cannot access your models. If they go to your model repository, they will see a message <em>Your request to access this repo has been rejected by the repo’s authors</em>.</li></ul> <div class="flex justify-center" data-svelte-h="svelte-1uql1lz"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-enabled-pending-users.png"> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-enabled-pending-users-dark.png"></div> <h4 class="relative group"><a id="via-the-api" 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="#via-the-api"><span><svg class="" 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>Via the API</span></h4> <p data-svelte-h="svelte-1sb5cq2">You can automate the approval of access requests by using the API. You must pass a <code>token</code> with <code>write</code> access to the gated repository. To generate a token, go to <a href="https://huggingface.co/settings/tokens" rel="nofollow">your user settings</a>.</p> <table data-svelte-h="svelte-gwu8am"><thead><tr><th>Method</th> <th>URI</th> <th>Description</th> <th>Headers</th> <th>Payload</th></tr></thead> <tbody><tr><td><code>GET</code></td> <td><code>/api/models/{repo_id}/user-access-request/pending</code></td> <td>Retrieve the list of pending requests.</td> <td><code>{"authorization": "Bearer $token"}</code></td> <td></td></tr> <tr><td><code>GET</code></td> <td><code>/api/models/{repo_id}/user-access-request/accepted</code></td> <td>Retrieve the list of accepted requests.</td> <td><code>{"authorization": "Bearer $token"}</code></td> <td></td></tr> <tr><td><code>GET</code></td> <td><code>/api/models/{repo_id}/user-access-request/rejected</code></td> <td>Retrieve the list of rejected requests.</td> <td><code>{"authorization": "Bearer $token"}</code></td> <td></td></tr> <tr><td><code>POST</code></td> <td><code>/api/models/{repo_id}/user-access-request/handle</code></td> <td>Change the status of a given access request to <code>status</code>.</td> <td><code>{"authorization": "Bearer $token"}</code></td> <td><code>{"status": "accepted"/"rejected"/"pending", "user": "username"}</code></td></tr> <tr><td><code>POST</code></td> <td><code>/api/models/{repo_id}/user-access-request/grant</code></td> <td>Allow a specific user to access your repo.</td> <td><code>{"authorization": "Bearer $token"}</code></td> <td><code>{"user": "username"}</code></td></tr></tbody></table> <p data-svelte-h="svelte-k0a5d4">The base URL for the HTTP endpoints above is <code>https://huggingface.co</code>.</p> <p data-svelte-h="svelte-1pscj1k"><strong>NEW!</strong> Those endpoints are now officially supported in our Python client <code>huggingface_hub</code>. List the access requests to your model with <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.list_pending_access_requests" rel="nofollow"><code>list_pending_access_requests</code></a>, <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.list_accepted_access_requests" rel="nofollow"><code>list_accepted_access_requests</code></a> and <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.list_rejected_access_requests" rel="nofollow"><code>list_rejected_access_requests</code></a>. You can also accept, cancel and reject access requests with <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.accept_access_request" rel="nofollow"><code>accept_access_request</code></a>, <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.cancel_access_request" rel="nofollow"><code>cancel_access_request</code></a>, <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.reject_access_request" rel="nofollow"><code>reject_access_request</code></a>. Finally, you can grant access to a user with <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.grant_access" rel="nofollow"><code>grant_access</code></a>.</p> <h3 class="relative group"><a id="download-access-report" 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="#download-access-report"><span><svg class="" 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>Download access report</span></h3> <p data-svelte-h="svelte-jhtiag">You can download a report of all access requests for a gated model with the <strong>download user access report</strong> button. Click on it to download a json file with a list of users. For each entry, you have:</p> <ul data-svelte-h="svelte-15c2ku5"><li><strong>user</strong>: the user id. Example: <em>julien-c</em>.</li> <li><strong>fullname</strong>: name of the user on the Hub. Example: <em>Julien Chaumond</em>.</li> <li><strong>status</strong>: status of the request. Either <code>"pending"</code>, <code>"accepted"</code> or <code>"rejected"</code>.</li> <li><strong>email</strong>: email of the user.</li> <li><strong>time</strong>: datetime when the user initially made the request.</li></ul> <a id="modifying-the-prompt"></a> <h3 class="relative group"><a id="customize-requested-information" 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="#customize-requested-information"><span><svg class="" 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>Customize requested information</span></h3> <p data-svelte-h="svelte-t1yfs">By default, users landing on your gated model will be asked to share their contact information (email and username) by clicking the <strong>Agree and send request to access repo</strong> button.</p> <div class="flex justify-center" data-svelte-h="svelte-1gcz8n5"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-user-side.png"> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-user-side-dark.png"></div> <p data-svelte-h="svelte-1o31f3x">If you want to collect more user information, you can configure additional fields. This information will be accessible from the <strong>Settings</strong> tab. To do so, add an <code>extra_gated_fields</code> property to your <a href="./model-cards#model-card-metadata">model card metadata</a> containing a list of key/value pairs. The <em>key</em> is the name of the field and <em>value</em> its type or an object with a <code>type</code> field. The list of field types is:</p> <ul data-svelte-h="svelte-1dzbkws"><li><code>text</code>: a single-line text field.</li> <li><code>checkbox</code>: a checkbox field.</li> <li><code>date_picker</code>: a date picker field.</li> <li><code>country</code>: a country dropdown. The list of countries is based on the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2" rel="nofollow">ISO 3166-1 alpha-2</a> standard.</li> <li><code>select</code>: a dropdown with a list of options. The list of options is defined in the <code>options</code> field. Example: <code>options: ["option 1", "option 2", {label: "option3", value: "opt3"}]</code>.</li></ul> <p data-svelte-h="svelte-t97csy">Finally, you can also personalize the message displayed to the user with the <code>extra_gated_prompt</code> extra field.</p> <p data-svelte-h="svelte-oeg9hw">Here is an example of customized request form where the user is asked to provide their company name and country and acknowledge that the model is for non-commercial use only.</p> <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 class="" 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=""><!-- HTML_TAG_START --><span class="hljs-meta">---</span> | |
| <span class="hljs-attr">extra_gated_prompt:</span> <span class="hljs-string">"You agree to not use the model to conduct experiments that cause harm to human subjects."</span> | |
| <span class="hljs-attr">extra_gated_fields:</span> | |
| <span class="hljs-attr">Company:</span> <span class="hljs-string">text</span> | |
| <span class="hljs-attr">Country:</span> <span class="hljs-string">country</span> | |
| <span class="hljs-attr">Specific date:</span> <span class="hljs-string">date_picker</span> | |
| <span class="hljs-attr">I want to use this model for:</span> | |
| <span class="hljs-attr">type:</span> <span class="hljs-string">select</span> | |
| <span class="hljs-attr">options:</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-string">Research</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-string">Education</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-attr">label:</span> <span class="hljs-string">Other</span> | |
| <span class="hljs-attr">value:</span> <span class="hljs-string">other</span> | |
| <span class="hljs-attr">I agree to use this model for non-commercial use ONLY:</span> <span class="hljs-string">checkbox</span> | |
| <span class="hljs-meta">---</span><!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1s4bktk">In some cases, you might also want to modify the default text in the gate heading, description, and button. For those use cases, you can modify <code>extra_gated_heading</code>, <code>extra_gated_description</code> and <code>extra_gated_button_content</code> like this:</p> <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 class="" 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=""><!-- HTML_TAG_START --><span class="hljs-meta">---</span> | |
| <span class="hljs-attr">extra_gated_heading:</span> <span class="hljs-string">"Acknowledge license to accept the repository"</span> | |
| <span class="hljs-attr">extra_gated_description:</span> <span class="hljs-string">"Our team may take 2-3 days to process your request"</span> | |
| <span class="hljs-attr">extra_gated_button_content:</span> <span class="hljs-string">"Acknowledge license"</span> | |
| <span class="hljs-meta">---</span><!-- HTML_TAG_END --></pre></div> <h3 class="relative group"><a id="example-use-cases-of-programmatically-managing-access-requests" 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="#example-use-cases-of-programmatically-managing-access-requests"><span><svg class="" 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>Example use cases of programmatically managing access requests</span></h3> <p data-svelte-h="svelte-1897xjs">Here are a few interesting use cases of programmatically managing access requests for gated repos we’ve seen organically emerge in the community. | |
| As a reminder, the model repo needs to be set to manual approval, otherwise users get access to it automatically.</p> <p data-svelte-h="svelte-yr6mdt">Possible use cases of programmatic management include:</p> <ul data-svelte-h="svelte-r02lrj"><li>If you have advanced user request screening requirements (for advanced compliance requirements, etc) or you wish to handle the user requests outside the Hub.<ul><li>An example for this was Meta’s <a href="https://huggingface.co/meta-llama/Llama-2-7b-chat-hf" rel="nofollow">Llama 2</a> initial release where users had to request access on a Meta website.</li> <li>You can ask users for their HF username in your access flow, and then use a script to programmatically accept user requests on the Hub based on your set of conditions.</li></ul></li> <li>If you want to condition access to a model based on completing a payment flow (note that the actual payment flow happens outside of the Hub).<ul><li>Here’s an <a href="https://huggingface.co/Trelis/openchat_3.5-function-calling-v3" rel="nofollow">example repo</a> from TrelisResearch that uses this use case.</li> <li><a href="https://huggingface.co/RonanMcGovern" rel="nofollow">@RonanMcGovern</a> has posted a <a href="https://www.youtube.com/watch?v=2OT2SI5auQU" rel="nofollow">video about the flow</a> and tips on how to implement it.</li></ul></li></ul> <h2 class="relative group"><a id="access-gated-models-as-a-user" 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="#access-gated-models-as-a-user"><span><svg class="" 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>Access gated models as a user</span></h2> <p data-svelte-h="svelte-1ch10lt">As a user, if you want to use a gated model, you will need to request access to it. This means that you must be logged in to a Hugging Face user account.</p> <p data-svelte-h="svelte-ko0zek">Requesting access can only be done from your browser. Go to the model on the Hub and you will be prompted to share your information:</p> <div class="flex justify-center" data-svelte-h="svelte-1gcz8n5"><img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-user-side.png"> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/models-gated-user-side-dark.png"></div> <p data-svelte-h="svelte-j60cqy">By clicking on <strong>Agree</strong>, you agree to share your username and email address with the model authors. In some cases, additional fields might be requested. To help the model authors decide whether to grant you access, try to fill out the form as completely as possible.</p> <p data-svelte-h="svelte-100o7ev">Once the access request is sent, there are two possibilities. If the approval mechanism is automatic, you immediately get access to the model files. Otherwise, the requests have to be approved manually by the authors, which can take more time.</p> <div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400"><p data-svelte-h="svelte-v0650n">The model authors have complete control over model access. In particular, they can decide at any time to block your access to the model without prior notice, regardless of approval mechanism or if your request has already been approved.</p></div> <h3 class="relative group"><a id="download-files" 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="#download-files"><span><svg class="" 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>Download files</span></h3> <p data-svelte-h="svelte-av0oj7">To download files from a gated model you’ll need to be authenticated. In the browser, this is automatic as long as you are logged in with your account. If you are using a script, you will need to provide a <a href="./security-tokens">user token</a>. In the Hugging Face Python ecosystem (<code>transformers</code>, <code>diffusers</code>, <code>datasets</code>, etc.), you can login your machine using the <a href="https://huggingface.co/docs/huggingface_hub/index" rel="nofollow"><code>huggingface_hub</code></a> library and running in your terminal:</p> <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 class="" 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=""><!-- HTML_TAG_START -->huggingface-cli login<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1tl5gun">Alternatively, you can programmatically login using <code>login()</code> in a notebook or a script:</p> <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 class="" 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=""><!-- HTML_TAG_START --><span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> login | |
| <span class="hljs-meta">>>> </span>login()<!-- HTML_TAG_END --></pre></div> <p data-svelte-h="svelte-1th12os">You can also provide the <code>token</code> parameter to most loading methods in the libraries (<code>from_pretrained</code>, <code>hf_hub_download</code>, <code>load_dataset</code>, etc.), directly from your scripts.</p> <p data-svelte-h="svelte-1f4mmkp">For more details about how to login, check out the <a href="https://huggingface.co/docs/huggingface_hub/quick-start#login" rel="nofollow">login guide</a>.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/hub-docs/blob/main/docs/hub/models-gated.md" target="_blank"><span data-svelte-h="svelte-1kd6by1"><</span> <span data-svelte-h="svelte-x0xyl0">></span> <span data-svelte-h="svelte-1dajgef"><span class="underline ml-1.5">Update</span> on GitHub</span></a> <p></p> | |
| <script> | |
| { | |
| __sveltekit_1vatp3t = { | |
| assets: "/docs/hub/main/en", | |
| base: "/docs/hub/main/en", | |
| env: {} | |
| }; | |
| const element = document.currentScript.parentElement; | |
| const data = [null,null]; | |
| Promise.all([ | |
| import("/docs/hub/main/en/_app/immutable/entry/start.d0cd5065.js"), | |
| import("/docs/hub/main/en/_app/immutable/entry/app.b6abe3c1.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 78], | |
| data, | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 39.7 kB
- Xet hash:
- 3f7c2892832cdd9750f1e91c448914b58a333dc87a4a3023206d1d0be81c502a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.