# Fine tuning sam 2.1 segmentation model

**URL:** <https://discuss.roboflow.com/t/fine-tuning-sam-2-1-segmentation-model/7723>\
**Category:** 🤝  Community Help\
**Tags:** bugs, segmentation\
**Created:** [November 18, 2024, 1:44pm UTC](https://discuss.roboflow.com/t/fine-tuning-sam-2-1-segmentation-model/7723 "2024-11-18T13:44:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathews\_Joy](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/mathews_joy/32/5979_2.png) [@Mathews\_Joy](https://discuss.roboflow.com/u/Mathews_Joy)\
**Post date:** [November 18, 2024, 1:44pm UTC](https://discuss.roboflow.com/t/fine-tuning-sam-2-1-segmentation-model/7723/1 "2024-11-18T13:44:43Z")

</div>

I am trying to fine tune the new SAM 2.1 segmentation model using the roboflow guide given here using VsCode python 3.10 and on windows 10: [https://blog.roboflow.com/fine-tune-sam-2-1/](https://blog.roboflow.com/fine-tune-sam-2-1/)

This code runs all fine when using google collab and no errors are encountered. As soon as I run the exact same code provided on my local machine is gives the following error when running the training code command:

`!python training/train.py -c 'configs/train.yaml' --use-cluster 0 --num-gpus 1`

I get the following error when running on windows 10, using vscode:

```auto
hydra.errors.MissingConfigException: Primary config module 'sam2' not found.
Check that it's correct and contains an __init__.py file

```

my working directory:

```auto
C:\..\SAM_2_1\sam2

```

 ![Annotation 2024-11-18 105812](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/2X/8/80872c79883c0849b551206651583f7743f28c37.png)

---

<div class="post-metadata">

**Author:** ![rfjames](https://avatars.discourse-cdn.com/v4/letter/r/82dd89/32.png) [@rfjames](https://discuss.roboflow.com/u/rfjames)\
**Post date:** [November 18, 2024, 2:06pm UTC](https://discuss.roboflow.com/t/fine-tuning-sam-2-1-segmentation-model/7723/2 "2024-11-18T14:06:58Z")

</div>

Thank you for creating this topic.

We recommend running the training job in a Linux environment with an A100 GPU.

If you are using a Windows machine, [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install) may be useful.

---

<div class="post-metadata">

**Author:** ![Mathews\_Joy](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/mathews_joy/32/5979_2.png) [@Mathews\_Joy](https://discuss.roboflow.com/u/Mathews_Joy)\
**Post date:** [November 18, 2024, 2:21pm UTC](https://discuss.roboflow.com/t/fine-tuning-sam-2-1-segmentation-model/7723/3 "2024-11-18T14:21:16Z")

</div>

Thanks for the response, will the provided code not run on windows, as this is my main OS so would be ideal to get it working on there if possible, or is the error an OS issue related one?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/1X/bb6edbfa56d0cf2ee603f061e9e09103502cc8cc.png) [@system](https://discuss.roboflow.com/u/system)\
**Post date:** [December 9, 2024, 2:21pm UTC](https://discuss.roboflow.com/t/fine-tuning-sam-2-1-segmentation-model/7723/4 "2024-12-09T14:21:47Z")

</div>

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
