Skip to content

Commit

Permalink
add enetry in toc, polish tutorial, add lancedb to env
Browse files Browse the repository at this point in the history
  • Loading branch information
lillythomas committed Jul 23, 2024
1 parent 8822fbe commit e6356a6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 37 deletions.
2 changes: 2 additions & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ parts:
file: tutorials/visualize-embeddings
- title: Clay MAE reconstruction
file: tutorials/reconstruction
- title: NAIP Inference and Similarity Search with Clay
file: tutorials/v1-inference-simsearch-naip-stacchip
- caption: About Clay
chapters:
- title: GitHub
Expand Down
58 changes: 21 additions & 37 deletions docs/tutorials/v1-inference-simsearch-naip-stacchip.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "e0c141b9-4038-4542-832c-f71e04bd93c1",
"cell_type": "markdown",
"id": "4eb77ee7",
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"\n",
"sys.path.append(\"../\") # Model src\n",
"sys.path.append(\"../../stacchip/\") "
"Install the [stacchip](https://github.com/Clay-foundation/stacchip) library."
]
},
{
Expand All @@ -47,7 +42,23 @@
"metadata": {},
"outputs": [],
"source": [
"# %pip install stacchip ==0.1.33"
"%pip install stacchip ==0.1.33"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "e0c141b9-4038-4542-832c-f71e04bd93c1",
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"\n",
"sys.path.append(\"../../\") # Model src\n",
"\n",
"# If the pip install for stacchip doesn't work above, \n",
"# git clone the repo and comment out the following with the path\n",
"sys.path.append(\"../../../stacchip/\")"
]
},
{
Expand Down Expand Up @@ -185,33 +196,6 @@
"chip_bounds = [] # List to hold chip bounds"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d058e157-33f5-4276-aaec-6f68677bf3d2",
"metadata": {},
"outputs": [],
"source": [
"for item in items_list[:2]:\n",
" print(f\"Working on {item}\")\n",
"\n",
" # Index the chips in the item\n",
" indexer = NoStatsChipIndexer(item)\n",
"\n",
" # Instantiate the chipper\n",
" chipper = Chipper(\n",
" indexer, asset_blacklist=[\"thumbnail\", \"tilejson\", \"rendered_preview\"]\n",
" )\n",
"\n",
" # Get 5 randomly sampled chips from the total\n",
" # number of chips within this item's entire image\n",
" for chip_id in random.sample(range(0, len(chipper)), 25):\n",
" print(chipper[chip_id])\n",
" x_index, y_index, chip = chipper[chip_id]\n",
" chip_images.append(chip[\"image\"])\n",
" chip_bounds.append(indexer.get_chip_bbox(x_index, y_index))"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -482,7 +466,7 @@
"# https://huggingface.co/made-with-clay/Clay/blob/main/clay-v1-base.ckpt\n",
"# and put it in a checkpoints folder.\n",
"model = load_model(\n",
" ckpt=\"../checkpoints/clay-v1-base.ckpt\",\n",
" ckpt=\"../../checkpoints/clay-v1-base.ckpt\",\n",
" device=torch.device(\"cuda\") if torch.cuda.is_available() else torch.device(\"cpu\"),\n",
")"
]
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
- jupyter-book~=1.0.0
- jupyterlab~=4.0.7
- jsonargparse~=4.27.0
- lancedb~=0.10.2
- lightning~=2.1.0
- matplotlib-base~=3.8.2
- planetary-computer~=1.0.0
Expand Down

0 comments on commit e6356a6

Please sign in to comment.