Clay-foundation / model

The Clay Foundation Model (in development)
https://clay-foundation.github.io/model/
Apache License 2.0
236 stars 25 forks source link

Issue on page /clay-v1-wall-to-wall.html #255

Closed ritwikvashistha closed 1 month ago

ritwikvashistha commented 1 month ago

I am trying to run the clay v1 model on my Mac and faced an issue with installing one of the libraries. When I run the code 'from stacchip.processors.prechip import normalize_timestamp', I run into an issue. The library wasn't installed as part of the dependencies, and I tried installing it manually, but it doesn't seem to exist. Can you please tell me how I can install this particular library?

yellowcap commented 1 month ago

Hi @ritwikvashistha can you try pip install stacchip?

I think we could also port the normalize function into the notebook and remove the library, this is a very simple function, see https://github.com/Clay-foundation/stacchip/blob/main/stacchip/processors/prechip.py#L45

ritwikvashistha commented 1 month ago

Thanks, defining the function directly worked. But I encountered another issue later. When I run with torch.no_grad(): unmsk_patch, unmsk_idx, msk_idx, msk_matrix = model.model.encoder(datacube), I get the error "RuntimeError: Expected all tensors to be on the same device, but found at least two devices, mps:0 and cpu!". I checked datacube and all the values have 'mps:0' as device so I don't know why the issue is coming up.

yellowcap commented 1 month ago

I have not tested this script with MacOS devices. Try changing device="cpu" on cell 16 and see if it runs. For this size of data the model is fast even of CPU so hopefully you can run the notebook to the end with that change.

jacobbieker commented 1 month ago

You can run it onmps fine, although I did have to change from float64 to float32 for it to work with the mps backend, and just looped through the datacube's items and moved them to mps to make it work. It did give a decent speed up compared to CPU!

ritwikvashistha commented 1 month ago

Thanks, @yellowcap and @jacobbieker. I just went with cpu and it worked. It wasn't very slow for me!