neuronets / nobrainer_training_scripts

1 stars 2 forks source link

Setting up nobrainer and training models #24

Open hvgazula opened 4 months ago

hvgazula commented 4 months ago

@dhritimandas I opened an issue here to discuss any roadblocks you may be facing.

hvgazula commented 4 months ago

Just an fyi, I just added a skeleton training script for brainsiam at https://github.com/neuronets/nobrainer_training_scripts/blob/main/1.2.0/scripts/train/brainsiam_train.py

Notice that while the code shows using a Segmentation class, it is not a segmentation model. So, we need to write a custom training (aka fit) script. It should be straightforward and I will take a stab at it. I hope this use case will enable us to come up with a more generic fit class or at least instructions on how to write a custom training loop inside nobrainer (which in reality is no different from how it is done in tf/keras).

PS: if this isn't clear, don't bother. I will explain when we meet next.

hvgazula commented 2 months ago
# installation instructions
conda create -n nobrainer-dev "python<3.12" -y
git clone https://github.com/neuronets/nobrainer
cd nobrainer
pip install -e .
hvgazula commented 2 months ago

Thanks for the clarification. It worked fine until I ran into the following error. I have python 3.12 and tensorflow 2.16 installed (the latest one that comes with pip install tensorflow). Do I need to downgrade tf (as the setup.cfg file has this listed as tensorflow<2.16)? image

@dhritimandas The official TF docs recommend python 3.8-3.11. So, if you notice the installation instructions, I set "python<3.12" and that will take care of the correct tf version for nobrainer. TF>=2.16 moved to keras 3.0 which will fail with some functions in nobrainer. I hope this helps.