import{s as Yt,o as Ft,n as rt}from"../chunks/scheduler.6062bdaf.js";import{S as At,i as Kt,g as l,s as o,r as m,A as Ot,h as d,f as a,c as r,j as at,u as f,x as T,k as nt,y as c,a as i,v as g,d as u,t as w,w as y}from"../chunks/index.4bca734e.js";import{T as $t}from"../chunks/Tip.b9ac1f03.js";import{D as Mt}from"../chunks/Docstring.81ba5e3c.js";import{C as te}from"../chunks/CodeBlock.fa01571c.js";import{E as ee}from"../chunks/ExampleCodeBlock.30e7542f.js";import{H as it,E as se}from"../chunks/EditOnGithub.74ab2baa.js";function ae(v){let e,p=`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(){e=l("p"),e.innerHTML=p},l(n){e=d(n,"P",{"data-svelte-h":!0}),T(e)!=="svelte-16sq104"&&(e.innerHTML=p)},m(n,h){i(n,e,h)},p:rt,d(n){n&&a(e)}}}function ne(v){let e,p=`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(){e=l("p"),e.innerHTML=p},l(n){e=d(n,"P",{"data-svelte-h":!0}),T(e)!=="svelte-16sq104"&&(e.innerHTML=p)},m(n,h){i(n,e,h)},p:rt,d(n){n&&a(e)}}}function ie(v){let e,p=`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(){e=l("p"),e.innerHTML=p},l(n){e=d(n,"P",{"data-svelte-h":!0}),T(e)!=="svelte-16sq104"&&(e.innerHTML=p)},m(n,h){i(n,e,h)},p:rt,d(n){n&&a(e)}}}function oe(v){let e,p="Example:",n,h,C;return h=new te({props:{code:"aW1wb3J0JTIwanNvbiUwQWltcG9ydCUyMG9zJTBBZnJvbSUyMHNhZmV0ZW5zb3JzLnRvcmNoJTIwaW1wb3J0JTIwc2F2ZV9maWxlJTIwYXMlMjBzYWZlX3NhdmVfZmlsZSUwQWZyb20lMjBodWdnaW5nZmFjZV9odWIlMjBpbXBvcnQlMjBzcGxpdF90b3JjaF9zdGF0ZV9kaWN0X2ludG9fc2hhcmRzJTBBJTBBZGVmJTIwc2F2ZV9zdGF0ZV9kaWN0KHN0YXRlX2RpY3QlM0ElMjBEaWN0JTVCc3RyJTJDJTIwdG9yY2guVGVuc29yJTVEJTJDJTIwc2F2ZV9kaXJlY3RvcnklM0ElMjBzdHIpJTNBJTBBJTIwJTIwJTIwJTIwc3RhdGVfZGljdF9zcGxpdCUyMCUzRCUyMHNwbGl0X3RvcmNoX3N0YXRlX2RpY3RfaW50b19zaGFyZHMoc3RhdGVfZGljdCklMEElMjAlMjAlMjAlMjBmb3IlMjBmaWxlbmFtZSUyQyUyMHRlbnNvcnMlMjBpbiUyMHN0YXRlX2RpY3Rfc3BsaXQuZmlsZW5hbWVfdG9fdGVuc29ycy52YWx1ZXMoKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNoYXJkJTIwJTNEJTIwJTdCdGVuc29yJTNBJTIwc3RhdGVfZGljdCU1QnRlbnNvciU1RCUyMGZvciUyMHRlbnNvciUyMGluJTIwdGVuc29ycyU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNhZmVfc2F2ZV9maWxlKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNoYXJkJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3MucGF0aC5qb2luKHNhdmVfZGlyZWN0b3J5JTJDJTIwZmlsZW5hbWUpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbWV0YWRhdGElM0QlN0IlMjJmb3JtYXQlMjIlM0ElMjAlMjJwdCUyMiU3RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCklMEElMjAlMjAlMjAlMjBpZiUyMHN0YXRlX2RpY3Rfc3BsaXQuaXNfc2hhcmRlZCUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGluZGV4JTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIybWV0YWRhdGElMjIlM0ElMjBzdGF0ZV9kaWN0X3NwbGl0Lm1ldGFkYXRhJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyd2VpZ2h0X21hcCUyMiUzQSUyMHN0YXRlX2RpY3Rfc3BsaXQudGVuc29yX3RvX2ZpbGVuYW1lJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwd2l0aCUyMG9wZW4ob3MucGF0aC5qb2luKHNhdmVfZGlyZWN0b3J5JTJDJTIwJTIybW9kZWwuc2FmZXRlbnNvcnMuaW5kZXguanNvbiUyMiklMkMlMjAlMjJ3JTIyKSUyMGFzJTIwZiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGYud3JpdGUoanNvbi5kdW1wcyhpbmRleCUyQyUyMGluZGVudCUzRDIpKQ==",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.values():
<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(){e=l("p"),e.textContent=p,n=o(),m(h.$$.fragment)},l(_){e=d(_,"P",{"data-svelte-h":!0}),T(e)!=="svelte-11lpom8"&&(e.textContent=p),n=r(_),f(h.$$.fragment,_)},m(_,I){i(_,e,I),i(_,n,I),g(h,_,I),C=!0},p:rt,i(_){C||(u(h.$$.fragment,_),C=!0)},o(_){w(h.$$.fragment,_),C=!1},d(_){_&&(a(e),a(n)),y(h,_)}}}function re(v){let e,p=`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(){e=l("p"),e.innerHTML=p},l(n){e=d(n,"P",{"data-svelte-h":!0}),T(e)!=="svelte-16sq104"&&(e.innerHTML=p)},m(n,h){i(n,e,h)},p:rt,d(n){n&&a(e)}}}function le(v){let e,p,n,h,C,_,I,St="<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.",lt,S,dt,H,Ht="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.",ct,R,ht,$,V,Jt,Y,Rt="Split a model state dictionary in shards so that each shard is smaller than a given size.",xt,F,Vt=`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,z,pt,N,_t,M,q,Ct,A,Nt="Split a model state dictionary in shards so that each shard is smaller than a given size.",It,K,qt=`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].`,Gt,j,mt,W,ft,b,X,Ut,O,Wt="Split a model state dictionary in shards so that each shard is smaller than a given size.",Bt,tt,Xt=`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].`,zt,k,jt,D,gt,L,ut,E,Lt='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.',wt,J,P,kt,et,Et="Split a model state dictionary in shards so that each shard is smaller than a given size.",Dt,st,Pt=`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].`,Zt,Z,yt,Q,Tt,ot,bt;return C=new it({props:{title:"Serialization",local:"serialization",headingTag:"h1"}}),S=new it({props:{title:"Split state dict into shards",local:"split-state-dict-into-shards",headingTag:"h2"}}),R=new it({props:{title:"split_numpy_state_dict_into_shards",local:"huggingface_hub.split_numpy_state_dict_into_shards",headingTag:"h3"}}),V=new Mt({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:": int = 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/v0.23.0/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>
`}}),z=new $t({props:{warning:!0,$$slots:{default:[ae]},$$scope:{ctx:v}}}),N=new it({props:{title:"split_tf_state_dict_into_shards",local:"huggingface_hub.split_tf_state_dict_into_shards",headingTag:"h3"}}),q=new Mt({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:": int = 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/v0.23.0/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>
`}}),j=new $t({props:{warning:!0,$$slots:{default:[ne]},$$scope:{ctx:v}}}),W=new it({props:{title:"split_torch_state_dict_into_shards",local:"huggingface_hub.split_torch_state_dict_into_shards",headingTag:"h3"}}),X=new Mt({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:": int = 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/v0.23.0/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>
`}}),k=new $t({props:{warning:!0,$$slots:{default:[ie]},$$scope:{ctx:v}}}),D=new ee({props:{anchor:"huggingface_hub.split_torch_state_dict_into_shards.example",$$slots:{default:[oe]},$$scope:{ctx:v}}}),L=new it({props:{title:"split_state_dict_into_shards_factory",local:"huggingface_hub.split_state_dict_into_shards_factory",headingTag:"h3"}}),P=new Mt({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 0x7ff2da38d2d0>"},{name:"filename_pattern",val:": str = 'model{suffix}.safetensors'"},{name:"max_shard_size",val:": int = 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/v0.23.0/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>
`}}),Z=new $t({props:{warning:!0,$$slots:{default:[re]},$$scope:{ctx:v}}}),Q=new se({props:{source:"https://github.com/huggingface/huggingface_hub/blob/main/docs/source/en/package_reference/serialization.md"}}),{c(){e=l("meta"),p=o(),n=l("p"),h=o(),m(C.$$.fragment),_=o(),I=l("p"),I.innerHTML=St,lt=o(),m(S.$$.fragment),dt=o(),H=l("p"),H.innerHTML=Ht,ct=o(),m(R.$$.fragment),ht=o(),$=l("div"),m(V.$$.fragment),Jt=o(),Y=l("p"),Y.textContent=Rt,xt=o(),F=l("p"),F.innerHTML=Vt,vt=o(),m(z.$$.fragment),pt=o(),m(N.$$.fragment),_t=o(),M=l("div"),m(q.$$.fragment),Ct=o(),A=l("p"),A.textContent=Nt,It=o(),K=l("p"),K.innerHTML=qt,Gt=o(),m(j.$$.fragment),mt=o(),m(W.$$.fragment),ft=o(),b=l("div"),m(X.$$.fragment),Ut=o(),O=l("p"),O.textContent=Wt,Bt=o(),tt=l("p"),tt.innerHTML=Xt,zt=o(),m(k.$$.fragment),jt=o(),m(D.$$.fragment),gt=o(),m(L.$$.fragment),ut=o(),E=l("p"),E.innerHTML=Lt,wt=o(),J=l("div"),m(P.$$.fragment),kt=o(),et=l("p"),et.textContent=Et,Dt=o(),st=l("p"),st.innerHTML=Pt,Zt=o(),m(Z.$$.fragment),yt=o(),m(Q.$$.fragment),Tt=o(),ot=l("p"),this.h()},l(t){const s=Ot("svelte-u9bgzb",document.head);e=d(s,"META",{name:!0,content:!0}),s.forEach(a),p=r(t),n=d(t,"P",{}),at(n).forEach(a),h=r(t),f(C.$$.fragment,t),_=r(t),I=d(t,"P",{"data-svelte-h":!0}),T(I)!=="svelte-1v36qzv"&&(I.innerHTML=St),lt=r(t),f(S.$$.fragment,t),dt=r(t),H=d(t,"P",{"data-svelte-h":!0}),T(H)!=="svelte-b8tyi2"&&(H.innerHTML=Ht),ct=r(t),f(R.$$.fragment,t),ht=r(t),$=d(t,"DIV",{class:!0});var G=at($);f(V.$$.fragment,G),Jt=r(G),Y=d(G,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-1q1pe7b"&&(Y.textContent=Rt),xt=r(G),F=d(G,"P",{"data-svelte-h":!0}),T(F)!=="svelte-17rio2z"&&(F.innerHTML=Vt),vt=r(G),f(z.$$.fragment,G),G.forEach(a),pt=r(t),f(N.$$.fragment,t),_t=r(t),M=d(t,"DIV",{class:!0});var U=at(M);f(q.$$.fragment,U),Ct=r(U),A=d(U,"P",{"data-svelte-h":!0}),T(A)!=="svelte-1q1pe7b"&&(A.textContent=Nt),It=r(U),K=d(U,"P",{"data-svelte-h":!0}),T(K)!=="svelte-17rio2z"&&(K.innerHTML=qt),Gt=r(U),f(j.$$.fragment,U),U.forEach(a),mt=r(t),f(W.$$.fragment,t),ft=r(t),b=d(t,"DIV",{class:!0});var x=at(b);f(X.$$.fragment,x),Ut=r(x),O=d(x,"P",{"data-svelte-h":!0}),T(O)!=="svelte-1q1pe7b"&&(O.textContent=Wt),Bt=r(x),tt=d(x,"P",{"data-svelte-h":!0}),T(tt)!=="svelte-17rio2z"&&(tt.innerHTML=Xt),zt=r(x),f(k.$$.fragment,x),jt=r(x),f(D.$$.fragment,x),x.forEach(a),gt=r(t),f(L.$$.fragment,t),ut=r(t),E=d(t,"P",{"data-svelte-h":!0}),T(E)!=="svelte-1hva642"&&(E.innerHTML=Lt),wt=r(t),J=d(t,"DIV",{class:!0});var B=at(J);f(P.$$.fragment,B),kt=r(B),et=d(B,"P",{"data-svelte-h":!0}),T(et)!=="svelte-1q1pe7b"&&(et.textContent=Et),Dt=r(B),st=d(B,"P",{"data-svelte-h":!0}),T(st)!=="svelte-17rio2z"&&(st.innerHTML=Pt),Zt=r(B),f(Z.$$.fragment,B),B.forEach(a),yt=r(t),f(Q.$$.fragment,t),Tt=r(t),ot=d(t,"P",{}),at(ot).forEach(a),this.h()},h(){nt(e,"name","hf:doc:metadata"),nt(e,"content",de),nt($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),nt(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),nt(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),nt(J,"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,s){c(document.head,e),i(t,p,s),i(t,n,s),i(t,h,s),g(C,t,s),i(t,_,s),i(t,I,s),i(t,lt,s),g(S,t,s),i(t,dt,s),i(t,H,s),i(t,ct,s),g(R,t,s),i(t,ht,s),i(t,$,s),g(V,$,null),c($,Jt),c($,Y),c($,xt),c($,F),c($,vt),g(z,$,null),i(t,pt,s),g(N,t,s),i(t,_t,s),i(t,M,s),g(q,M,null),c(M,Ct),c(M,A),c(M,It),c(M,K),c(M,Gt),g(j,M,null),i(t,mt,s),g(W,t,s),i(t,ft,s),i(t,b,s),g(X,b,null),c(b,Ut),c(b,O),c(b,Bt),c(b,tt),c(b,zt),g(k,b,null),c(b,jt),g(D,b,null),i(t,gt,s),g(L,t,s),i(t,ut,s),i(t,E,s),i(t,wt,s),i(t,J,s),g(P,J,null),c(J,kt),c(J,et),c(J,Dt),c(J,st),c(J,Zt),g(Z,J,null),i(t,yt,s),g(Q,t,s),i(t,Tt,s),i(t,ot,s),bt=!0},p(t,[s]){const G={};s&2&&(G.$$scope={dirty:s,ctx:t}),z.$set(G);const U={};s&2&&(U.$$scope={dirty:s,ctx:t}),j.$set(U);const x={};s&2&&(x.$$scope={dirty:s,ctx:t}),k.$set(x);const B={};s&2&&(B.$$scope={dirty:s,ctx:t}),D.$set(B);const Qt={};s&2&&(Qt.$$scope={dirty:s,ctx:t}),Z.$set(Qt)},i(t){bt||(u(C.$$.fragment,t),u(S.$$.fragment,t),u(R.$$.fragment,t),u(V.$$.fragment,t),u(z.$$.fragment,t),u(N.$$.fragment,t),u(q.$$.fragment,t),u(j.$$.fragment,t),u(W.$$.fragment,t),u(X.$$.fragment,t),u(k.$$.fragment,t),u(D.$$.fragment,t),u(L.$$.fragment,t),u(P.$$.fragment,t),u(Z.$$.fragment,t),u(Q.$$.fragment,t),bt=!0)},o(t){w(C.$$.fragment,t),w(S.$$.fragment,t),w(R.$$.fragment,t),w(V.$$.fragment,t),w(z.$$.fragment,t),w(N.$$.fragment,t),w(q.$$.fragment,t),w(j.$$.fragment,t),w(W.$$.fragment,t),w(X.$$.fragment,t),w(k.$$.fragment,t),w(D.$$.fragment,t),w(L.$$.fragment,t),w(P.$$.fragment,t),w(Z.$$.fragment,t),w(Q.$$.fragment,t),bt=!1},d(t){t&&(a(p),a(n),a(h),a(_),a(I),a(lt),a(dt),a(H),a(ct),a(ht),a($),a(pt),a(_t),a(M),a(mt),a(ft),a(b),a(gt),a(ut),a(E),a(wt),a(J),a(yt),a(Tt),a(ot)),a(e),y(C,t),y(S,t),y(R,t),y(V),y(z),y(N,t),y(q),y(j),y(W,t),y(X),y(k),y(D),y(L,t),y(P),y(Z),y(Q,t)}}}const de='{"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}],"depth":1}';function ce(v){return Ft(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class we extends At{constructor(e){super(),Kt(this,e,ce,le,Yt,{})}}export{we as component};
