Skip to content

Commit 5831b52

Browse files
danaaubakirovadanaaubakirovaWauplinpcuenca
authored
add smolvla to model-libraries.ts (#1529)
Co-authored-by: danaaubakirova <d.aubakirova@alumni.edu.kz> Co-authored-by: Lucain <lucainp@gmail.com> Co-authored-by: Pedro Cuenca <pedro@huggingface.co> Co-authored-by: Lucain <lucain@huggingface.co>
1 parent af2ffe8 commit 5831b52

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,47 @@ print(output)`);
762762
return snippets;
763763
};
764764

765+
export const lerobot = (model: ModelData): string[] => {
766+
if (model.tags.includes("smolvla")) {
767+
const smolvlaSnippets = [
768+
// Installation snippet
769+
`# See https://github.com/huggingface/lerobot?tab=readme-ov-file#installation for more details
770+
git clone https://github.com/huggingface/lerobot.git
771+
cd lerobot
772+
pip install -e .[smolvla]`,
773+
// Finetune snippet
774+
`# Launch finetuning on your dataset
775+
python lerobot/scripts/train.py \\
776+
--policy.path=${model.id} \\
777+
--dataset.repo_id=lerobot/svla_so101_pickplace \\
778+
--batch_size=64 \\
779+
--steps=20000 \\
780+
--output_dir=outputs/train/my_smolvla \\
781+
--job_name=my_smolvla_training \\
782+
--policy.device=cuda \\
783+
--wandb.enable=true`,
784+
];
785+
if (model.id !== "lerobot/smolvla_base") {
786+
// Inference snippet (only if not base model)
787+
smolvlaSnippets.push(
788+
`# Run the policy using the record function
789+
python -m lerobot.record \\
790+
--robot.type=so101_follower \\
791+
--robot.port=/dev/ttyACM0 \\ # <- Use your port
792+
--robot.id=my_blue_follower_arm \\ # <- Use your robot id
793+
--robot.cameras="{ front: {type: opencv, index_or_path: 8, width: 640, height: 480, fps: 30}}" \\ # <- Use your cameras
794+
--dataset.single_task="Grasp a lego block and put it in the bin." \\ # <- Use the same task description you used in your dataset recording
795+
--dataset.repo_id=HF_USER/dataset_name \\ # <- This will be the dataset name on HF Hub
796+
--dataset.episode_time_s=50 \\
797+
--dataset.num_episodes=10 \\
798+
--policy.path=${model.id}`
799+
);
800+
}
801+
return smolvlaSnippets;
802+
}
803+
return [];
804+
};
805+
765806
export const tf_keras = (model: ModelData): string[] => [
766807
`# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy)
767808
# See https://github.com/keras-team/tf-keras for more details.

packages/tasks/src/model-libraries.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
527527
filter: false,
528528
countDownloads: `path_extension:"litertlm"`,
529529
},
530+
lerobot: {
531+
prettyLabel: "LeRobot",
532+
repoName: "LeRobot",
533+
repoUrl: "https://github.com/huggingface/lerobot",
534+
docsUrl: "https://huggingface.co/docs/lerobot",
535+
filter: false,
536+
snippets: snippets.lerobot,
537+
},
530538
liveportrait: {
531539
prettyLabel: "LivePortrait",
532540
repoName: "LivePortrait",

0 commit comments

Comments
 (0)