import{s as he,o as pe,n as gt}from"../chunks/scheduler.6062bdaf.js";import{S as me,i as _e,g as d,s as n,r as p,A as fe,h as c,f as a,c as i,j as et,u as m,x as w,k as st,y as l,a as r,v as _,d as f,t as g,w as u}from"../chunks/index.4bca734e.js";import{T as Ct}from"../chunks/Tip.b9ac1f03.js";import{D as ft}from"../chunks/Docstring.d7918b6d.js";import{C as ge}from"../chunks/CodeBlock.fa01571c.js";import{E as ue}from"../chunks/ExampleCodeBlock.d27cbfa4.js";import{H as E,E as $e}from"../chunks/EditOnGithub.74ab2baa.js";function be(J){let s,$=`If one of the model’s tensor is bigger than <code>max_shard_size</code>, it will end up in its own shard which will have a
size greater than <code>max_shard_size</code>.`;return{c(){s=d("p"),s.innerHTML=$},l(o){s=c(o,"P",{"data-svelte-h":!0}),w(s)!=="svelte-16sq104"&&(s.innerHTML=$)},m(o,h){r(o,s,h)},p:gt,d(o){o&&a(s)}}}function we(J){let s,$=`If one of the model’s tensor is bigger than <code>max_shard_size</code>, it will end up in its own shard which will have a
size greater than <code>max_shard_size</code>.`;return{c(){s=d("p"),s.innerHTML=$},l(o){s=c(o,"P",{"data-svelte-h":!0}),w(s)!=="svelte-16sq104"&&(s.innerHTML=$)},m(o,h){r(o,s,h)},p:gt,d(o){o&&a(s)}}}function Te(J){let s,$=`If one of the model’s tensor is bigger than <code>max_shard_size</code>, it will end up in its own shard which will have a
size greater than <code>max_shard_size</code>.`;return{c(){s=d("p"),s.innerHTML=$},l(o){s=c(o,"P",{"data-svelte-h":!0}),w(s)!=="svelte-16sq104"&&(s.innerHTML=$)},m(o,h){r(o,s,h)},p:gt,d(o){o&&a(s)}}}function Me(J){let s,$="Example:",o,h,B;return h=new ge({props:{code:"aW1wb3J0JTIwanNvbiUwQWltcG9ydCUyMG9zJTBBZnJvbSUyMHNhZmV0ZW5zb3JzLnRvcmNoJTIwaW1wb3J0JTIwc2F2ZV9maWxlJTIwYXMlMjBzYWZlX3NhdmVfZmlsZSUwQWZyb20lMjBodWdnaW5nZmFjZV9odWIlMjBpbXBvcnQlMjBzcGxpdF90b3JjaF9zdGF0ZV9kaWN0X2ludG9fc2hhcmRzJTBBJTBBZGVmJTIwc2F2ZV9zdGF0ZV9kaWN0KHN0YXRlX2RpY3QlM0ElMjBEaWN0JTVCc3RyJTJDJTIwdG9yY2guVGVuc29yJTVEJTJDJTIwc2F2ZV9kaXJlY3RvcnklM0ElMjBzdHIpJTNBJTBBJTIwJTIwJTIwJTIwc3RhdGVfZGljdF9zcGxpdCUyMCUzRCUyMHNwbGl0X3RvcmNoX3N0YXRlX2RpY3RfaW50b19zaGFyZHMoc3RhdGVfZGljdCklMEElMjAlMjAlMjAlMjBmb3IlMjBmaWxlbmFtZSUyQyUyMHRlbnNvcnMlMjBpbiUyMHN0YXRlX2RpY3Rfc3BsaXQuZmlsZW5hbWVfdG9fdGVuc29ycy5pdGVtcygpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2hhcmQlMjAlM0QlMjAlN0J0ZW5zb3IlM0ElMjBzdGF0ZV9kaWN0JTVCdGVuc29yJTVEJTIwZm9yJTIwdGVuc29yJTIwaW4lMjB0ZW5zb3JzJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2FmZV9zYXZlX2ZpbGUoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2hhcmQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvcy5wYXRoLmpvaW4oc2F2ZV9kaXJlY3RvcnklMkMlMjBmaWxlbmFtZSklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtZXRhZGF0YSUzRCU3QiUyMmZvcm1hdCUyMiUzQSUyMCUyMnB0JTIyJTdEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCUyMCUyMGlmJTIwc3RhdGVfZGljdF9zcGxpdC5pc19zaGFyZGVkJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaW5kZXglMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJtZXRhZGF0YSUyMiUzQSUyMHN0YXRlX2RpY3Rfc3BsaXQubWV0YWRhdGElMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ3ZWlnaHRfbWFwJTIyJTNBJTIwc3RhdGVfZGljdF9zcGxpdC50ZW5zb3JfdG9fZmlsZW5hbWUlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB3aXRoJTIwb3Blbihvcy5wYXRoLmpvaW4oc2F2ZV9kaXJlY3RvcnklMkMlMjAlMjJtb2RlbC5zYWZldGVuc29ycy5pbmRleC5qc29uJTIyKSUyQyUyMCUyMnclMjIpJTIwYXMlMjBmJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZi53cml0ZShqc29uLmR1bXBzKGluZGV4JTJDJTIwaW5kZW50JTNEMikp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> json
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> os
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> safetensors.torch <span class="hljs-keyword">import</span> save_file <span class="hljs-keyword">as</span> safe_save_file
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> split_torch_state_dict_into_shards

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">save_state_dict</span>(<span class="hljs-params">state_dict: <span class="hljs-type">Dict</span>[<span class="hljs-built_in">str</span>, torch.Tensor], save_directory: <span class="hljs-built_in">str</span></span>):
<span class="hljs-meta">... </span>    state_dict_split = split_torch_state_dict_into_shards(state_dict)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> filename, tensors <span class="hljs-keyword">in</span> state_dict_split.filename_to_tensors.items():
<span class="hljs-meta">... </span>        shard = {tensor: state_dict[tensor] <span class="hljs-keyword">for</span> tensor <span class="hljs-keyword">in</span> tensors}
<span class="hljs-meta">... </span>        safe_save_file(
<span class="hljs-meta">... </span>            shard,
<span class="hljs-meta">... </span>            os.path.join(save_directory, filename),
<span class="hljs-meta">... </span>            metadata={<span class="hljs-string">&quot;format&quot;</span>: <span class="hljs-string">&quot;pt&quot;</span>},
<span class="hljs-meta">... </span>        )
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> state_dict_split.is_sharded:
<span class="hljs-meta">... </span>        index = {
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;metadata&quot;</span>: state_dict_split.metadata,
<span class="hljs-meta">... </span>            <span class="hljs-string">&quot;weight_map&quot;</span>: state_dict_split.tensor_to_filename,
<span class="hljs-meta">... </span>        }
<span class="hljs-meta">... </span>        <span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(os.path.join(save_directory, <span class="hljs-string">&quot;model.safetensors.index.json&quot;</span>), <span class="hljs-string">&quot;w&quot;</span>) <span class="hljs-keyword">as</span> f:
<span class="hljs-meta">... </span>            f.write(json.dumps(index, indent=<span class="hljs-number">2</span>))`,wrap:!1}}),{c(){s=d("p"),s.textContent=$,o=n(),p(h.$$.fragment)},l(b){s=c(b,"P",{"data-svelte-h":!0}),w(s)!=="svelte-11lpom8"&&(s.textContent=$),o=i(b),m(h.$$.fragment,b)},m(b,z){r(b,s,z),r(b,o,z),_(h,b,z),B=!0},p:gt,i(b){B||(f(h.$$.fragment,b),B=!0)},o(b){g(h.$$.fragment,b),B=!1},d(b){b&&(a(s),a(o)),u(h,b)}}}function je(J){let s,$=`If one of the model’s tensor is bigger than <code>max_shard_size</code>, it will end up in its own shard which will have a
size greater than <code>max_shard_size</code>.`;return{c(){s=d("p"),s.innerHTML=$},l(o){s=c(o,"P",{"data-svelte-h":!0}),w(s)!=="svelte-16sq104"&&(s.innerHTML=$)},m(o,h){r(o,s,h)},p:gt,d(o){o&&a(s)}}}function xe(J){let s,$,o,h,B,b,z,Qt="<code>huggingface_hub</code> contains helpers to help ML libraries to serialize models weights in a standardized way. This part of the lib is still under development and will be improved in future releases. The goal is to harmonize how weights are serialized on the Hub, both to remove code duplication across libraries and to foster conventions on the Hub.",ut,L,$t,q,Kt="At the moment, this module contains a single helper that takes a state dictionary (e.g. a mapping between layer names and related tensors) and split it into several shards, while creating a proper index in the process. This helper is available for <code>torch</code>, <code>tensorflow</code> and <code>numpy</code> tensors and is designed to be easily extended to any other ML frameworks.",bt,R,wt,M,V,Zt,at,Ot="Split a model state dictionary in shards so that each shard is smaller than a given size.",Dt,nt,te=`The shards are determined by iterating through the <code>state_dict</code> in the order of its keys. There is no optimization
made to make each shard as close as possible to the maximum size passed. For example, if the limit is 10GB and we
have tensors of sizes [6GB, 6GB, 2GB, 6GB, 2GB, 2GB] they will get sharded as [6GB], [6+2GB], [6+2+2GB] and not
[6+2+2GB], [6+2GB], [6GB].`,Ht,C,Tt,U,Mt,j,W,St,it,ee="Split a model state dictionary in shards so that each shard is smaller than a given size.",Et,rt,se=`The shards are determined by iterating through the <code>state_dict</code> in the order of its keys. There is no optimization
made to make each shard as close as possible to the maximum size passed. For example, if the limit is 10GB and we
have tensors of sizes [6GB, 6GB, 2GB, 6GB, 2GB, 2GB] they will get sharded as [6GB], [6+2GB], [6+2+2GB] and not
[6+2+2GB], [6+2GB], [6GB].`,Lt,Z,jt,P,xt,T,X,qt,ot,ae="Split a model state dictionary in shards so that each shard is smaller than a given size.",Rt,lt,ne=`The shards are determined by iterating through the <code>state_dict</code> in the order of its keys. There is no optimization
made to make each shard as close as possible to the maximum size passed. For example, if the limit is 10GB and we
have tensors of sizes [6GB, 6GB, 2GB, 6GB, 2GB, 2GB] they will get sharded as [6GB], [6+2GB], [6+2+2GB] and not
[6+2+2GB], [6+2GB], [6GB].`,Vt,D,Ut,H,yt,F,vt,N,ie='This is the underlying factory from which each framework-specific helper is derived. In practice, you are not expected to use this factory directly except if you need to adapt it to a framework that is not yet supported. If that is the case, please let us know by <a href="https://github.com/huggingface/huggingface_hub/issues/new" rel="nofollow">opening a new issue</a> on the <code>huggingface_hub</code> repo.',Jt,x,Y,Wt,dt,re="Split a model state dictionary in shards so that each shard is smaller than a given size.",Pt,ct,oe=`The shards are determined by iterating through the <code>state_dict</code> in the order of its keys. There is no optimization
made to make each shard as close as possible to the maximum size passed. For example, if the limit is 10GB and we
have tensors of sizes [6GB, 6GB, 2GB, 6GB, 2GB, 2GB] they will get sharded as [6GB], [6+2GB], [6+2+2GB] and not
[6+2+2GB], [6+2GB], [6GB].`,Xt,S,Bt,Q,zt,K,Gt,y,O,Ft,ht,le="Return unique identifier to a tensor storage.",Nt,pt,de=`Multiple different tensors can share the same underlying storage. For
example, “meta” tensors all share the same storage, and thus their identifier will all be equal. This identifier is
guaranteed to be unique and constant for this tensor’s storage during its lifetime. Two tensor storages with
non-overlapping lifetimes may have the same id.`,Yt,mt,ce='Taken from <a href="https://github.com/huggingface/transformers/blob/1ecf5f7c982d761b4daaa96719d162c324187c64/src/transformers/pytorch_utils.py#L278" rel="nofollow">https://github.com/huggingface/transformers/blob/1ecf5f7c982d761b4daaa96719d162c324187c64/src/transformers/pytorch_utils.py#L278</a>.',It,tt,At,_t,kt;return B=new E({props:{title:"Serialization",local:"serialization",headingTag:"h1"}}),L=new E({props:{title:"Split state dict into shards",local:"split-state-dict-into-shards",headingTag:"h2"}}),R=new E({props:{title:"split_numpy_state_dict_into_shards",local:"huggingface_hub.split_numpy_state_dict_into_shards",headingTag:"h3"}}),V=new ft({props:{name:"huggingface_hub.split_numpy_state_dict_into_shards",anchor:"huggingface_hub.split_numpy_state_dict_into_shards",parameters:[{name:"state_dict",val:": Dict"},{name:"filename_pattern",val:": str = 'model{suffix}.safetensors'"},{name:"max_shard_size",val:": Union = 5000000000"}],parametersDescription:[{anchor:"huggingface_hub.split_numpy_state_dict_into_shards.state_dict",description:`<strong>state_dict</strong> (<code>Dict[str, np.ndarray]</code>) &#x2014;
The state dictionary to save.`,name:"state_dict"},{anchor:"huggingface_hub.split_numpy_state_dict_into_shards.filename_pattern",description:`<strong>filename_pattern</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The pattern to generate the files names in which the model will be saved. Pattern must be a string that
can be formatted with <code>filename_pattern.format(suffix=...)</code> and must contain the keyword <code>suffix</code>
Defaults to <code>&quot;model{suffix}.safetensors&quot;</code>.`,name:"filename_pattern"},{anchor:"huggingface_hub.split_numpy_state_dict_into_shards.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>) &#x2014;
The maximum size of each shard, in bytes. Defaults to 5GB.`,name:"max_shard_size"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/serialization/_numpy.py#L25",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>StateDictSplit</code> object containing the shards and the index to retrieve them.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>StateDictSplit</code></p>
`}}),C=new Ct({props:{warning:!0,$$slots:{default:[be]},$$scope:{ctx:J}}}),U=new E({props:{title:"split_tf_state_dict_into_shards",local:"huggingface_hub.split_tf_state_dict_into_shards",headingTag:"h3"}}),W=new ft({props:{name:"huggingface_hub.split_tf_state_dict_into_shards",anchor:"huggingface_hub.split_tf_state_dict_into_shards",parameters:[{name:"state_dict",val:": Dict"},{name:"filename_pattern",val:": str = 'tf_model{suffix}.h5'"},{name:"max_shard_size",val:": Union = 5000000000"}],parametersDescription:[{anchor:"huggingface_hub.split_tf_state_dict_into_shards.state_dict",description:`<strong>state_dict</strong> (<code>Dict[str, Tensor]</code>) &#x2014;
The state dictionary to save.`,name:"state_dict"},{anchor:"huggingface_hub.split_tf_state_dict_into_shards.filename_pattern",description:`<strong>filename_pattern</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The pattern to generate the files names in which the model will be saved. Pattern must be a string that
can be formatted with <code>filename_pattern.format(suffix=...)</code> and must contain the keyword <code>suffix</code>
Defaults to <code>&quot;tf_model{suffix}.h5&quot;</code>.`,name:"filename_pattern"},{anchor:"huggingface_hub.split_tf_state_dict_into_shards.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>) &#x2014;
The maximum size of each shard, in bytes. Defaults to 5GB.`,name:"max_shard_size"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/serialization/_tensorflow.py#L27",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>StateDictSplit</code> object containing the shards and the index to retrieve them.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>StateDictSplit</code></p>
`}}),Z=new Ct({props:{warning:!0,$$slots:{default:[we]},$$scope:{ctx:J}}}),P=new E({props:{title:"split_torch_state_dict_into_shards",local:"huggingface_hub.split_torch_state_dict_into_shards",headingTag:"h3"}}),X=new ft({props:{name:"huggingface_hub.split_torch_state_dict_into_shards",anchor:"huggingface_hub.split_torch_state_dict_into_shards",parameters:[{name:"state_dict",val:": Dict"},{name:"filename_pattern",val:": str = 'model{suffix}.safetensors'"},{name:"max_shard_size",val:": Union = 5000000000"}],parametersDescription:[{anchor:"huggingface_hub.split_torch_state_dict_into_shards.state_dict",description:`<strong>state_dict</strong> (<code>Dict[str, torch.Tensor]</code>) &#x2014;
The state dictionary to save.`,name:"state_dict"},{anchor:"huggingface_hub.split_torch_state_dict_into_shards.filename_pattern",description:`<strong>filename_pattern</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The pattern to generate the files names in which the model will be saved. Pattern must be a string that
can be formatted with <code>filename_pattern.format(suffix=...)</code> and must contain the keyword <code>suffix</code>
Defaults to <code>&quot;model{suffix}.safetensors&quot;</code>.`,name:"filename_pattern"},{anchor:"huggingface_hub.split_torch_state_dict_into_shards.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>) &#x2014;
The maximum size of each shard, in bytes. Defaults to 5GB.`,name:"max_shard_size"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/serialization/_torch.py#L27",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>StateDictSplit</code> object containing the shards and the index to retrieve them.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>StateDictSplit</code></p>
`}}),D=new Ct({props:{warning:!0,$$slots:{default:[Te]},$$scope:{ctx:J}}}),H=new ue({props:{anchor:"huggingface_hub.split_torch_state_dict_into_shards.example",$$slots:{default:[Me]},$$scope:{ctx:J}}}),F=new E({props:{title:"split_state_dict_into_shards_factory",local:"huggingface_hub.split_state_dict_into_shards_factory",headingTag:"h3"}}),Y=new ft({props:{name:"huggingface_hub.split_state_dict_into_shards_factory",anchor:"huggingface_hub.split_state_dict_into_shards_factory",parameters:[{name:"state_dict",val:": Dict"},{name:"get_tensor_size",val:": Callable"},{name:"get_storage_id",val:": Callable = <function <lambda> at 0x7fc058fb31c0>"},{name:"filename_pattern",val:": str = 'model{suffix}.safetensors'"},{name:"max_shard_size",val:": Union = 5000000000"}],parametersDescription:[{anchor:"huggingface_hub.split_state_dict_into_shards_factory.state_dict",description:`<strong>state_dict</strong> (<code>Dict[str, Tensor]</code>) &#x2014;
The state dictionary to save.`,name:"state_dict"},{anchor:"huggingface_hub.split_state_dict_into_shards_factory.get_tensor_size",description:`<strong>get_tensor_size</strong> (<code>Callable[[Tensor], int]</code>) &#x2014;
A function that returns the size of a tensor in bytes.`,name:"get_tensor_size"},{anchor:"huggingface_hub.split_state_dict_into_shards_factory.get_storage_id",description:`<strong>get_storage_id</strong> (<code>Callable[[Tensor], Optional[Any]]</code>, <em>optional</em>) &#x2014;
A function that returns a unique identifier to a tensor storage. Multiple different tensors can share the
same underlying storage. This identifier is guaranteed to be unique and constant for this tensor&#x2019;s storage
during its lifetime. Two tensor storages with non-overlapping lifetimes may have the same id.`,name:"get_storage_id"},{anchor:"huggingface_hub.split_state_dict_into_shards_factory.filename_pattern",description:`<strong>filename_pattern</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The pattern to generate the files names in which the model will be saved. Pattern must be a string that
can be formatted with <code>filename_pattern.format(suffix=...)</code> and must contain the keyword <code>suffix</code>
Defaults to <code>&quot;model{suffix}.safetensors&quot;</code>.`,name:"filename_pattern"},{anchor:"huggingface_hub.split_state_dict_into_shards_factory.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>) &#x2014;
The maximum size of each shard, in bytes. Defaults to 5GB.`,name:"max_shard_size"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/serialization/_base.py#L43",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>StateDictSplit</code> object containing the shards and the index to retrieve them.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>StateDictSplit</code></p>
`}}),S=new Ct({props:{warning:!0,$$slots:{default:[je]},$$scope:{ctx:J}}}),Q=new E({props:{title:"Helpers",local:"helpers",headingTag:"h2"}}),K=new E({props:{title:"get_torch_storage_id",local:"huggingface_hub.get_torch_storage_id",headingTag:"h3"}}),O=new ft({props:{name:"huggingface_hub.get_torch_storage_id",anchor:"huggingface_hub.get_torch_storage_id",parameters:[{name:"tensor",val:": torch.Tensor"}],source:"https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/serialization/_torch.py#L95"}}),tt=new $e({props:{source:"https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/package_reference/serialization.md"}}),{c(){s=d("meta"),$=n(),o=d("p"),h=n(),p(B.$$.fragment),b=n(),z=d("p"),z.innerHTML=Qt,ut=n(),p(L.$$.fragment),$t=n(),q=d("p"),q.innerHTML=Kt,bt=n(),p(R.$$.fragment),wt=n(),M=d("div"),p(V.$$.fragment),Zt=n(),at=d("p"),at.textContent=Ot,Dt=n(),nt=d("p"),nt.innerHTML=te,Ht=n(),p(C.$$.fragment),Tt=n(),p(U.$$.fragment),Mt=n(),j=d("div"),p(W.$$.fragment),St=n(),it=d("p"),it.textContent=ee,Et=n(),rt=d("p"),rt.innerHTML=se,Lt=n(),p(Z.$$.fragment),jt=n(),p(P.$$.fragment),xt=n(),T=d("div"),p(X.$$.fragment),qt=n(),ot=d("p"),ot.textContent=ae,Rt=n(),lt=d("p"),lt.innerHTML=ne,Vt=n(),p(D.$$.fragment),Ut=n(),p(H.$$.fragment),yt=n(),p(F.$$.fragment),vt=n(),N=d("p"),N.innerHTML=ie,Jt=n(),x=d("div"),p(Y.$$.fragment),Wt=n(),dt=d("p"),dt.textContent=re,Pt=n(),ct=d("p"),ct.innerHTML=oe,Xt=n(),p(S.$$.fragment),Bt=n(),p(Q.$$.fragment),zt=n(),p(K.$$.fragment),Gt=n(),y=d("div"),p(O.$$.fragment),Ft=n(),ht=d("p"),ht.textContent=le,Nt=n(),pt=d("p"),pt.textContent=de,Yt=n(),mt=d("p"),mt.innerHTML=ce,It=n(),p(tt.$$.fragment),At=n(),_t=d("p"),this.h()},l(t){const e=fe("svelte-u9bgzb",document.head);s=c(e,"META",{name:!0,content:!0}),e.forEach(a),$=i(t),o=c(t,"P",{}),et(o).forEach(a),h=i(t),m(B.$$.fragment,t),b=i(t),z=c(t,"P",{"data-svelte-h":!0}),w(z)!=="svelte-1v36qzv"&&(z.innerHTML=Qt),ut=i(t),m(L.$$.fragment,t),$t=i(t),q=c(t,"P",{"data-svelte-h":!0}),w(q)!=="svelte-b8tyi2"&&(q.innerHTML=Kt),bt=i(t),m(R.$$.fragment,t),wt=i(t),M=c(t,"DIV",{class:!0});var G=et(M);m(V.$$.fragment,G),Zt=i(G),at=c(G,"P",{"data-svelte-h":!0}),w(at)!=="svelte-1q1pe7b"&&(at.textContent=Ot),Dt=i(G),nt=c(G,"P",{"data-svelte-h":!0}),w(nt)!=="svelte-17rio2z"&&(nt.innerHTML=te),Ht=i(G),m(C.$$.fragment,G),G.forEach(a),Tt=i(t),m(U.$$.fragment,t),Mt=i(t),j=c(t,"DIV",{class:!0});var I=et(j);m(W.$$.fragment,I),St=i(I),it=c(I,"P",{"data-svelte-h":!0}),w(it)!=="svelte-1q1pe7b"&&(it.textContent=ee),Et=i(I),rt=c(I,"P",{"data-svelte-h":!0}),w(rt)!=="svelte-17rio2z"&&(rt.innerHTML=se),Lt=i(I),m(Z.$$.fragment,I),I.forEach(a),jt=i(t),m(P.$$.fragment,t),xt=i(t),T=c(t,"DIV",{class:!0});var v=et(T);m(X.$$.fragment,v),qt=i(v),ot=c(v,"P",{"data-svelte-h":!0}),w(ot)!=="svelte-1q1pe7b"&&(ot.textContent=ae),Rt=i(v),lt=c(v,"P",{"data-svelte-h":!0}),w(lt)!=="svelte-17rio2z"&&(lt.innerHTML=ne),Vt=i(v),m(D.$$.fragment,v),Ut=i(v),m(H.$$.fragment,v),v.forEach(a),yt=i(t),m(F.$$.fragment,t),vt=i(t),N=c(t,"P",{"data-svelte-h":!0}),w(N)!=="svelte-1hva642"&&(N.innerHTML=ie),Jt=i(t),x=c(t,"DIV",{class:!0});var A=et(x);m(Y.$$.fragment,A),Wt=i(A),dt=c(A,"P",{"data-svelte-h":!0}),w(dt)!=="svelte-1q1pe7b"&&(dt.textContent=re),Pt=i(A),ct=c(A,"P",{"data-svelte-h":!0}),w(ct)!=="svelte-17rio2z"&&(ct.innerHTML=oe),Xt=i(A),m(S.$$.fragment,A),A.forEach(a),Bt=i(t),m(Q.$$.fragment,t),zt=i(t),m(K.$$.fragment,t),Gt=i(t),y=c(t,"DIV",{class:!0});var k=et(y);m(O.$$.fragment,k),Ft=i(k),ht=c(k,"P",{"data-svelte-h":!0}),w(ht)!=="svelte-lfv2l4"&&(ht.textContent=le),Nt=i(k),pt=c(k,"P",{"data-svelte-h":!0}),w(pt)!=="svelte-4klsmr"&&(pt.textContent=de),Yt=i(k),mt=c(k,"P",{"data-svelte-h":!0}),w(mt)!=="svelte-akggeo"&&(mt.innerHTML=ce),k.forEach(a),It=i(t),m(tt.$$.fragment,t),At=i(t),_t=c(t,"P",{}),et(_t).forEach(a),this.h()},h(){st(s,"name","hf:doc:metadata"),st(s,"content",ye),st(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),st(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),st(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),st(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),st(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,e){l(document.head,s),r(t,$,e),r(t,o,e),r(t,h,e),_(B,t,e),r(t,b,e),r(t,z,e),r(t,ut,e),_(L,t,e),r(t,$t,e),r(t,q,e),r(t,bt,e),_(R,t,e),r(t,wt,e),r(t,M,e),_(V,M,null),l(M,Zt),l(M,at),l(M,Dt),l(M,nt),l(M,Ht),_(C,M,null),r(t,Tt,e),_(U,t,e),r(t,Mt,e),r(t,j,e),_(W,j,null),l(j,St),l(j,it),l(j,Et),l(j,rt),l(j,Lt),_(Z,j,null),r(t,jt,e),_(P,t,e),r(t,xt,e),r(t,T,e),_(X,T,null),l(T,qt),l(T,ot),l(T,Rt),l(T,lt),l(T,Vt),_(D,T,null),l(T,Ut),_(H,T,null),r(t,yt,e),_(F,t,e),r(t,vt,e),r(t,N,e),r(t,Jt,e),r(t,x,e),_(Y,x,null),l(x,Wt),l(x,dt),l(x,Pt),l(x,ct),l(x,Xt),_(S,x,null),r(t,Bt,e),_(Q,t,e),r(t,zt,e),_(K,t,e),r(t,Gt,e),r(t,y,e),_(O,y,null),l(y,Ft),l(y,ht),l(y,Nt),l(y,pt),l(y,Yt),l(y,mt),r(t,It,e),_(tt,t,e),r(t,At,e),r(t,_t,e),kt=!0},p(t,[e]){const G={};e&2&&(G.$$scope={dirty:e,ctx:t}),C.$set(G);const I={};e&2&&(I.$$scope={dirty:e,ctx:t}),Z.$set(I);const v={};e&2&&(v.$$scope={dirty:e,ctx:t}),D.$set(v);const A={};e&2&&(A.$$scope={dirty:e,ctx:t}),H.$set(A);const k={};e&2&&(k.$$scope={dirty:e,ctx:t}),S.$set(k)},i(t){kt||(f(B.$$.fragment,t),f(L.$$.fragment,t),f(R.$$.fragment,t),f(V.$$.fragment,t),f(C.$$.fragment,t),f(U.$$.fragment,t),f(W.$$.fragment,t),f(Z.$$.fragment,t),f(P.$$.fragment,t),f(X.$$.fragment,t),f(D.$$.fragment,t),f(H.$$.fragment,t),f(F.$$.fragment,t),f(Y.$$.fragment,t),f(S.$$.fragment,t),f(Q.$$.fragment,t),f(K.$$.fragment,t),f(O.$$.fragment,t),f(tt.$$.fragment,t),kt=!0)},o(t){g(B.$$.fragment,t),g(L.$$.fragment,t),g(R.$$.fragment,t),g(V.$$.fragment,t),g(C.$$.fragment,t),g(U.$$.fragment,t),g(W.$$.fragment,t),g(Z.$$.fragment,t),g(P.$$.fragment,t),g(X.$$.fragment,t),g(D.$$.fragment,t),g(H.$$.fragment,t),g(F.$$.fragment,t),g(Y.$$.fragment,t),g(S.$$.fragment,t),g(Q.$$.fragment,t),g(K.$$.fragment,t),g(O.$$.fragment,t),g(tt.$$.fragment,t),kt=!1},d(t){t&&(a($),a(o),a(h),a(b),a(z),a(ut),a($t),a(q),a(bt),a(wt),a(M),a(Tt),a(Mt),a(j),a(jt),a(xt),a(T),a(yt),a(vt),a(N),a(Jt),a(x),a(Bt),a(zt),a(Gt),a(y),a(It),a(At),a(_t)),a(s),u(B,t),u(L,t),u(R,t),u(V),u(C),u(U,t),u(W),u(Z),u(P,t),u(X),u(D),u(H),u(F,t),u(Y),u(S),u(Q,t),u(K,t),u(O),u(tt,t)}}}const ye='{"title":"Serialization","local":"serialization","sections":[{"title":"Split state dict into shards","local":"split-state-dict-into-shards","sections":[{"title":"split_numpy_state_dict_into_shards","local":"huggingface_hub.split_numpy_state_dict_into_shards","sections":[],"depth":3},{"title":"split_tf_state_dict_into_shards","local":"huggingface_hub.split_tf_state_dict_into_shards","sections":[],"depth":3},{"title":"split_torch_state_dict_into_shards","local":"huggingface_hub.split_torch_state_dict_into_shards","sections":[],"depth":3},{"title":"split_state_dict_into_shards_factory","local":"huggingface_hub.split_state_dict_into_shards_factory","sections":[],"depth":3}],"depth":2},{"title":"Helpers","local":"helpers","sections":[{"title":"get_torch_storage_id","local":"huggingface_hub.get_torch_storage_id","sections":[],"depth":3}],"depth":2}],"depth":1}';function ve(J){return pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ce extends me{constructor(s){super(),_e(this,s,ve,xe,he,{})}}export{Ce as component};
