import{s as Se,n as ke,o as ze}from"../chunks/scheduler.eb244325.js";import{S as Ee,i as Ne,e as o,s as a,c as n,h as Fe,a as p,d as l,b as i,f as De,g as d,j as J,k as He,l as Ye,m as s,n as m,t as M,o as r,p as y}from"../chunks/index.3fe63ad3.js";import{C as qe}from"../chunks/CopyLLMTxtMenu.08242e11.js";import{C as F}from"../chunks/CodeBlock.91baa5b4.js";import{H as u,E as Pe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.234c3f85.js";function Oe(ge){let T,Y,E,q,f,P,w,O,U,je="This guide covers the dataset tools utilities available in LeRobot for modifying and editing existing datasets.",K,b,ee,$,Xe="LeRobot provides several utilities for manipulating datasets:",te,c,Ze="<li><strong>Delete Episodes</strong> - Remove specific episodes from a dataset</li> <li><strong>Split Dataset</strong> - Divide a dataset into multiple smaller datasets</li> <li><strong>Merge Datasets</strong> - Combine multiple datasets into one. The datasets must have identical features, and episodes are concatenated in the order specified in <code>repo_ids</code></li> <li><strong>Add Features</strong> - Add new features to a dataset</li> <li><strong>Remove Features</strong> - Remove features from a dataset</li>",le,C,Ge=`The core implementation is in <code>lerobot.datasets.dataset_tools</code>.
An example script detailing how to use the tools API is available in <code>examples/dataset/use_dataset_tools.py</code>.`,se,h,ae,I,Ve="<code>lerobot-edit-dataset</code> is a command-line script for editing datasets. It can be used to delete episodes, split datasets, merge datasets, add features, and remove features.",ie,v,_e="Run <code>lerobot-edit-dataset --help</code> for more information on the configuration of each operation.",oe,g,ne,j,pe,X,Be="Remove specific episodes from a dataset. This is useful for filtering out undesired data.",de,Z,me,G,Me,V,Re="Divide a dataset into multiple subsets.",re,_,ye,B,xe="There are no constraints on the split names, they can be determined by the user. Resulting datasets are saved under the repo id with the split name appended, e.g. <code>lerobot/pusht_train</code>, <code>lerobot/pusht_task1</code>, <code>lerobot/pusht_task2</code>.",Je,R,Te,x,Ae="Combine multiple datasets into a single dataset.",ue,A,fe,Q,we,L,Qe="Remove features from a dataset.",Ue,W,be,D,$e,H,Le="Add the <code>--push_to_hub</code> flag to any command to automatically upload the resulting dataset to the Hugging Face Hub:",ce,S,Ce,k,We="There is also a tool for adding features to a dataset that is not yet covered in <code>lerobot-edit-dataset</code>.",he,z,Ie,N,ve;return f=new qe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),w=new u({props:{title:"Using Dataset Tools",local:"using-dataset-tools",headingTag:"h1"}}),b=new u({props:{title:"Overview",local:"overview",headingTag:"h2"}}),h=new u({props:{title:"Command-Line Tool: lerobot-edit-dataset",local:"command-line-tool-lerobot-edit-dataset",headingTag:"h2"}}),g=new u({props:{title:"Usage Examples",local:"usage-examples",headingTag:"h3"}}),j=new u({props:{title:"Delete Episodes",local:"delete-episodes",headingTag:"h4"}}),Z=new F({props:{code:"JTIzJTIwRGVsZXRlJTIwZXBpc29kZXMlMjAwJTJDJTIwMiUyQyUyMGFuZCUyMDUlMjAobW9kaWZpZXMlMjBvcmlnaW5hbCUyMGRhdGFzZXQpJTBBbGVyb2JvdC1lZGl0LWRhdGFzZXQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXJlcG9faWQlMjBsZXJvYm90JTJGcHVzaHQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW9wZXJhdGlvbi50eXBlJTIwZGVsZXRlX2VwaXNvZGVzJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vcGVyYXRpb24uZXBpc29kZV9pbmRpY2VzJTIwJTIyJTVCMCUyQyUyMDIlMkMlMjA1JTVEJTIyJTBBJTBBJTIzJTIwRGVsZXRlJTIwZXBpc29kZXMlMjBhbmQlMjBzYXZlJTIwdG8lMjBhJTIwbmV3JTIwZGF0YXNldCUyMChwcmVzZXJ2ZXMlMjBvcmlnaW5hbCUyMGRhdGFzZXQpJTBBbGVyb2JvdC1lZGl0LWRhdGFzZXQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXJlcG9faWQlMjBsZXJvYm90JTJGcHVzaHQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW5ld19yZXBvX2lkJTIwbGVyb2JvdCUyRnB1c2h0X2FmdGVyX2RlbGV0aW9uJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vcGVyYXRpb24udHlwZSUyMGRlbGV0ZV9lcGlzb2RlcyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3BlcmF0aW9uLmVwaXNvZGVfaW5kaWNlcyUyMCUyMiU1QjAlMkMlMjAyJTJDJTIwNSU1RCUyMg==",highlighted:`<span class="hljs-comment"># Delete episodes 0, 2, and 5 (modifies original dataset)</span>
lerobot-edit-dataset \\
    --repo_id lerobot/pusht \\
    --operation.type delete_episodes \\
    --operation.episode_indices <span class="hljs-string">&quot;[0, 2, 5]&quot;</span>

<span class="hljs-comment"># Delete episodes and save to a new dataset (preserves original dataset)</span>
lerobot-edit-dataset \\
    --repo_id lerobot/pusht \\
    --new_repo_id lerobot/pusht_after_deletion \\
    --operation.type delete_episodes \\
    --operation.episode_indices <span class="hljs-string">&quot;[0, 2, 5]&quot;</span>`,wrap:!1}}),G=new u({props:{title:"Split Dataset",local:"split-dataset",headingTag:"h4"}}),_=new F({props:{code:"JTIzJTIwU3BsaXQlMjBieSUyMGZyYWN0aW9ucyUyMChlLmcuJTIwODAlMjUlMjB0cmFpbiUyQyUyMDIwJTI1JTIwdGVzdCUyQyUyMDIwJTI1JTIwdmFsKSUwQWxlcm9ib3QtZWRpdC1kYXRhc2V0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1yZXBvX2lkJTIwbGVyb2JvdCUyRnB1c2h0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vcGVyYXRpb24udHlwZSUyMHNwbGl0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vcGVyYXRpb24uc3BsaXRzJTIwJyU3QiUyMnRyYWluJTIyJTNBJTIwMC44JTJDJTIwJTIydGVzdCUyMiUzQSUyMDAuMiUyQyUyMCUyMnZhbCUyMiUzQSUyMDAuMiU3RCclMEElMEElMjMlMjBTcGxpdCUyMGJ5JTIwc3BlY2lmaWMlMjBlcGlzb2RlJTIwaW5kaWNlcyUwQWxlcm9ib3QtZWRpdC1kYXRhc2V0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1yZXBvX2lkJTIwbGVyb2JvdCUyRnB1c2h0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vcGVyYXRpb24udHlwZSUyMHNwbGl0JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vcGVyYXRpb24uc3BsaXRzJTIwJyU3QiUyMnRhc2sxJTIyJTNBJTIwJTVCMCUyQyUyMDElMkMlMjAyJTJDJTIwMyU1RCUyQyUyMCUyMnRhc2syJTIyJTNBJTIwJTVCNCUyQyUyMDUlNUQlN0Qn",highlighted:`<span class="hljs-comment"># Split by fractions (e.g. 80% train, 20% test, 20% val)</span>
lerobot-edit-dataset \\
    --repo_id lerobot/pusht \\
    --operation.type <span class="hljs-built_in">split</span> \\
    --operation.splits <span class="hljs-string">&#x27;{&quot;train&quot;: 0.8, &quot;test&quot;: 0.2, &quot;val&quot;: 0.2}&#x27;</span>

<span class="hljs-comment"># Split by specific episode indices</span>
lerobot-edit-dataset \\
    --repo_id lerobot/pusht \\
    --operation.type <span class="hljs-built_in">split</span> \\
    --operation.splits <span class="hljs-string">&#x27;{&quot;task1&quot;: [0, 1, 2, 3], &quot;task2&quot;: [4, 5]}&#x27;</span>`,wrap:!1}}),R=new u({props:{title:"Merge Datasets",local:"merge-datasets",headingTag:"h4"}}),A=new F({props:{code:"JTIzJTIwTWVyZ2UlMjB0cmFpbiUyMGFuZCUyMHZhbGlkYXRpb24lMjBzcGxpdHMlMjBiYWNrJTIwaW50byUyMG9uZSUyMGRhdGFzZXQlMEFsZXJvYm90LWVkaXQtZGF0YXNldCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcmVwb19pZCUyMGxlcm9ib3QlMkZwdXNodF9tZXJnZWQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW9wZXJhdGlvbi50eXBlJTIwbWVyZ2UlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW9wZXJhdGlvbi5yZXBvX2lkcyUyMCUyMiU1QidsZXJvYm90JTJGcHVzaHRfdHJhaW4nJTJDJTIwJ2xlcm9ib3QlMkZwdXNodF92YWwnJTVEJTIy",highlighted:`<span class="hljs-comment"># Merge train and validation splits back into one dataset</span>
lerobot-edit-dataset \\
    --repo_id lerobot/pusht_merged \\
    --operation.type merge \\
    --operation.repo_ids <span class="hljs-string">&quot;[&#x27;lerobot/pusht_train&#x27;, &#x27;lerobot/pusht_val&#x27;]&quot;</span>`,wrap:!1}}),Q=new u({props:{title:"Remove Features",local:"remove-features",headingTag:"h4"}}),W=new F({props:{code:"JTIzJTIwUmVtb3ZlJTIwYSUyMGNhbWVyYSUyMGZlYXR1cmUlMEFsZXJvYm90LWVkaXQtZGF0YXNldCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcmVwb19pZCUyMGxlcm9ib3QlMkZwdXNodCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3BlcmF0aW9uLnR5cGUlMjByZW1vdmVfZmVhdHVyZSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3BlcmF0aW9uLmZlYXR1cmVfbmFtZXMlMjAlMjIlNUInb2JzZXJ2YXRpb24uaW1hZ2VzLnRvcCclNUQlMjI=",highlighted:`<span class="hljs-comment"># Remove a camera feature</span>
lerobot-edit-dataset \\
    --repo_id lerobot/pusht \\
    --operation.type remove_feature \\
    --operation.feature_names <span class="hljs-string">&quot;[&#x27;observation.images.top&#x27;]&quot;</span>`,wrap:!1}}),D=new u({props:{title:"Push to Hub",local:"push-to-hub",headingTag:"h3"}}),S=new F({props:{code:"bGVyb2JvdC1lZGl0LWRhdGFzZXQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXJlcG9faWQlMjBsZXJvYm90JTJGcHVzaHQlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW5ld19yZXBvX2lkJTIwbGVyb2JvdCUyRnB1c2h0X2FmdGVyX2RlbGV0aW9uJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1vcGVyYXRpb24udHlwZSUyMGRlbGV0ZV9lcGlzb2RlcyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3BlcmF0aW9uLmVwaXNvZGVfaW5kaWNlcyUyMCUyMiU1QjAlMkMlMjAyJTJDJTIwNSU1RCUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHVzaF90b19odWI=",highlighted:`lerobot-edit-dataset \\
    --repo_id lerobot/pusht \\
    --new_repo_id lerobot/pusht_after_deletion \\
    --operation.type delete_episodes \\
    --operation.episode_indices <span class="hljs-string">&quot;[0, 2, 5]&quot;</span> \\
    --push_to_hub`,wrap:!1}}),z=new Pe({props:{source:"https://github.com/huggingface/lerobot/blob/main/docs/source/using_dataset_tools.mdx"}}),{c(){T=o("meta"),Y=a(),E=o("p"),q=a(),n(f.$$.fragment),P=a(),n(w.$$.fragment),O=a(),U=o("p"),U.textContent=je,K=a(),n(b.$$.fragment),ee=a(),$=o("p"),$.textContent=Xe,te=a(),c=o("ol"),c.innerHTML=Ze,le=a(),C=o("p"),C.innerHTML=Ge,se=a(),n(h.$$.fragment),ae=a(),I=o("p"),I.innerHTML=Ve,ie=a(),v=o("p"),v.innerHTML=_e,oe=a(),n(g.$$.fragment),ne=a(),n(j.$$.fragment),pe=a(),X=o("p"),X.textContent=Be,de=a(),n(Z.$$.fragment),me=a(),n(G.$$.fragment),Me=a(),V=o("p"),V.textContent=Re,re=a(),n(_.$$.fragment),ye=a(),B=o("p"),B.innerHTML=xe,Je=a(),n(R.$$.fragment),Te=a(),x=o("p"),x.textContent=Ae,ue=a(),n(A.$$.fragment),fe=a(),n(Q.$$.fragment),we=a(),L=o("p"),L.textContent=Qe,Ue=a(),n(W.$$.fragment),be=a(),n(D.$$.fragment),$e=a(),H=o("p"),H.innerHTML=Le,ce=a(),n(S.$$.fragment),Ce=a(),k=o("p"),k.innerHTML=We,he=a(),n(z.$$.fragment),Ie=a(),N=o("p"),this.h()},l(e){const t=Fe("svelte-u9bgzb",document.head);T=p(t,"META",{name:!0,content:!0}),t.forEach(l),Y=i(e),E=p(e,"P",{}),De(E).forEach(l),q=i(e),d(f.$$.fragment,e),P=i(e),d(w.$$.fragment,e),O=i(e),U=p(e,"P",{"data-svelte-h":!0}),J(U)!=="svelte-5t28x9"&&(U.textContent=je),K=i(e),d(b.$$.fragment,e),ee=i(e),$=p(e,"P",{"data-svelte-h":!0}),J($)!=="svelte-hj7n0k"&&($.textContent=Xe),te=i(e),c=p(e,"OL",{"data-svelte-h":!0}),J(c)!=="svelte-dq8jio"&&(c.innerHTML=Ze),le=i(e),C=p(e,"P",{"data-svelte-h":!0}),J(C)!=="svelte-w34ggo"&&(C.innerHTML=Ge),se=i(e),d(h.$$.fragment,e),ae=i(e),I=p(e,"P",{"data-svelte-h":!0}),J(I)!=="svelte-1gs621f"&&(I.innerHTML=Ve),ie=i(e),v=p(e,"P",{"data-svelte-h":!0}),J(v)!=="svelte-1p3gisj"&&(v.innerHTML=_e),oe=i(e),d(g.$$.fragment,e),ne=i(e),d(j.$$.fragment,e),pe=i(e),X=p(e,"P",{"data-svelte-h":!0}),J(X)!=="svelte-1cixye9"&&(X.textContent=Be),de=i(e),d(Z.$$.fragment,e),me=i(e),d(G.$$.fragment,e),Me=i(e),V=p(e,"P",{"data-svelte-h":!0}),J(V)!=="svelte-bhxspr"&&(V.textContent=Re),re=i(e),d(_.$$.fragment,e),ye=i(e),B=p(e,"P",{"data-svelte-h":!0}),J(B)!=="svelte-1dczp"&&(B.innerHTML=xe),Je=i(e),d(R.$$.fragment,e),Te=i(e),x=p(e,"P",{"data-svelte-h":!0}),J(x)!=="svelte-15p8tt9"&&(x.textContent=Ae),ue=i(e),d(A.$$.fragment,e),fe=i(e),d(Q.$$.fragment,e),we=i(e),L=p(e,"P",{"data-svelte-h":!0}),J(L)!=="svelte-rft37k"&&(L.textContent=Qe),Ue=i(e),d(W.$$.fragment,e),be=i(e),d(D.$$.fragment,e),$e=i(e),H=p(e,"P",{"data-svelte-h":!0}),J(H)!=="svelte-2f8bep"&&(H.innerHTML=Le),ce=i(e),d(S.$$.fragment,e),Ce=i(e),k=p(e,"P",{"data-svelte-h":!0}),J(k)!=="svelte-1ozpz6o"&&(k.innerHTML=We),he=i(e),d(z.$$.fragment,e),Ie=i(e),N=p(e,"P",{}),De(N).forEach(l),this.h()},h(){He(T,"name","hf:doc:metadata"),He(T,"content",Ke)},m(e,t){Ye(document.head,T),s(e,Y,t),s(e,E,t),s(e,q,t),m(f,e,t),s(e,P,t),m(w,e,t),s(e,O,t),s(e,U,t),s(e,K,t),m(b,e,t),s(e,ee,t),s(e,$,t),s(e,te,t),s(e,c,t),s(e,le,t),s(e,C,t),s(e,se,t),m(h,e,t),s(e,ae,t),s(e,I,t),s(e,ie,t),s(e,v,t),s(e,oe,t),m(g,e,t),s(e,ne,t),m(j,e,t),s(e,pe,t),s(e,X,t),s(e,de,t),m(Z,e,t),s(e,me,t),m(G,e,t),s(e,Me,t),s(e,V,t),s(e,re,t),m(_,e,t),s(e,ye,t),s(e,B,t),s(e,Je,t),m(R,e,t),s(e,Te,t),s(e,x,t),s(e,ue,t),m(A,e,t),s(e,fe,t),m(Q,e,t),s(e,we,t),s(e,L,t),s(e,Ue,t),m(W,e,t),s(e,be,t),m(D,e,t),s(e,$e,t),s(e,H,t),s(e,ce,t),m(S,e,t),s(e,Ce,t),s(e,k,t),s(e,he,t),m(z,e,t),s(e,Ie,t),s(e,N,t),ve=!0},p:ke,i(e){ve||(M(f.$$.fragment,e),M(w.$$.fragment,e),M(b.$$.fragment,e),M(h.$$.fragment,e),M(g.$$.fragment,e),M(j.$$.fragment,e),M(Z.$$.fragment,e),M(G.$$.fragment,e),M(_.$$.fragment,e),M(R.$$.fragment,e),M(A.$$.fragment,e),M(Q.$$.fragment,e),M(W.$$.fragment,e),M(D.$$.fragment,e),M(S.$$.fragment,e),M(z.$$.fragment,e),ve=!0)},o(e){r(f.$$.fragment,e),r(w.$$.fragment,e),r(b.$$.fragment,e),r(h.$$.fragment,e),r(g.$$.fragment,e),r(j.$$.fragment,e),r(Z.$$.fragment,e),r(G.$$.fragment,e),r(_.$$.fragment,e),r(R.$$.fragment,e),r(A.$$.fragment,e),r(Q.$$.fragment,e),r(W.$$.fragment,e),r(D.$$.fragment,e),r(S.$$.fragment,e),r(z.$$.fragment,e),ve=!1},d(e){e&&(l(Y),l(E),l(q),l(P),l(O),l(U),l(K),l(ee),l($),l(te),l(c),l(le),l(C),l(se),l(ae),l(I),l(ie),l(v),l(oe),l(ne),l(pe),l(X),l(de),l(me),l(Me),l(V),l(re),l(ye),l(B),l(Je),l(Te),l(x),l(ue),l(fe),l(we),l(L),l(Ue),l(be),l($e),l(H),l(ce),l(Ce),l(k),l(he),l(Ie),l(N)),l(T),y(f,e),y(w,e),y(b,e),y(h,e),y(g,e),y(j,e),y(Z,e),y(G,e),y(_,e),y(R,e),y(A,e),y(Q,e),y(W,e),y(D,e),y(S,e),y(z,e)}}}const Ke='{"title":"Using Dataset Tools","local":"using-dataset-tools","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Command-Line Tool: lerobot-edit-dataset","local":"command-line-tool-lerobot-edit-dataset","sections":[{"title":"Usage Examples","local":"usage-examples","sections":[{"title":"Delete Episodes","local":"delete-episodes","sections":[],"depth":4},{"title":"Split Dataset","local":"split-dataset","sections":[],"depth":4},{"title":"Merge Datasets","local":"merge-datasets","sections":[],"depth":4},{"title":"Remove Features","local":"remove-features","sections":[],"depth":4}],"depth":3},{"title":"Push to Hub","local":"push-to-hub","sections":[],"depth":3}],"depth":2}],"depth":1}';function et(ge){return ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ot extends Ee{constructor(T){super(),Ne(this,T,et,Oe,Se,{})}}export{ot as component};
