Commit
·
9ab4490
1
Parent(s):
f31484b
Upload semanticallysegmentdeezglaciers.ipynb
Browse files
semanticallysegmentdeezglaciers.ipynb
CHANGED
@@ -67,7 +67,10 @@
|
|
67 |
"# Call the notebook_login function to log in to Hugging Face's hub\n",
|
68 |
"notebook_login()\n",
|
69 |
"\n",
|
70 |
-
"# This code imports necessary modules and functions for a machine learning task. It sets up for tensor computations, deep learning, data visualization, working with transformer models, datasets, image manipulations, and more. It also logs into Hugging Face's hub.\n"
|
|
|
|
|
|
|
71 |
]
|
72 |
},
|
73 |
{
|
@@ -364,7 +367,7 @@
|
|
364 |
" fp16=True, # Whether to use 16-bit float precision instead of 32-bit\n",
|
365 |
" tf32=True, # Whether to use tf32 precision instead of 32-bit\n",
|
366 |
" gradient_accumulation_steps=4, # Number of updates steps to accumulate before performing a backward/update pass\n",
|
367 |
-
" hub_model_id =
|
368 |
")\n",
|
369 |
"\n",
|
370 |
"# Define the trainer\n",
|
@@ -397,7 +400,7 @@
|
|
397 |
"trainer.model.save_pretrained(\"glacformer\")\n",
|
398 |
"\n",
|
399 |
"# Create a repository object for the specified repository on Hugging Face's hub, cloning from the specified source\n",
|
400 |
-
"repo = huggingface_hub.Repository(\"glacformer\", clone_from
|
401 |
"\n",
|
402 |
"# Pull the latest changes from the remote repository\n",
|
403 |
"repo.git_pull()\n",
|
@@ -438,7 +441,7 @@
|
|
438 |
"# Define a class for the model\n",
|
439 |
"class glacformer():\n",
|
440 |
" def __init__(self, pipeline=pipeline(\"image-segmentation\",\n",
|
441 |
-
" model
|
442 |
" self.pipeline = pipeline\n",
|
443 |
" self.image_list = image_list\n",
|
444 |
" def __getitem__(self, index, alpha = 100):\n",
|
@@ -492,7 +495,7 @@
|
|
492 |
"name": "python",
|
493 |
"nbconvert_exporter": "python",
|
494 |
"pygments_lexer": "ipython3",
|
495 |
-
"version": "3.10.
|
496 |
},
|
497 |
"widgets": {
|
498 |
"application/vnd.jupyter.widget-state+json": {
|
|
|
67 |
"# Call the notebook_login function to log in to Hugging Face's hub\n",
|
68 |
"notebook_login()\n",
|
69 |
"\n",
|
70 |
+
"# This code imports necessary modules and functions for a machine learning task. It sets up for tensor computations, deep learning, data visualization, working with transformer models, datasets, image manipulations, and more. It also logs into Hugging Face's hub.\n",
|
71 |
+
"\n",
|
72 |
+
"# This sets the model's huggingface URL\n",
|
73 |
+
"hf_model_name = \"glacierscopessegmentation/glacier_segmentation_transformer\"\n"
|
74 |
]
|
75 |
},
|
76 |
{
|
|
|
367 |
" fp16=True, # Whether to use 16-bit float precision instead of 32-bit\n",
|
368 |
" tf32=True, # Whether to use tf32 precision instead of 32-bit\n",
|
369 |
" gradient_accumulation_steps=4, # Number of updates steps to accumulate before performing a backward/update pass\n",
|
370 |
+
" hub_model_id = hf_model_name # The model ID on the Hugging Face model hub\n",
|
371 |
")\n",
|
372 |
"\n",
|
373 |
"# Define the trainer\n",
|
|
|
400 |
"trainer.model.save_pretrained(\"glacformer\")\n",
|
401 |
"\n",
|
402 |
"# Create a repository object for the specified repository on Hugging Face's hub, cloning from the specified source\n",
|
403 |
+
"repo = huggingface_hub.Repository(\"glacformer\", clone_from=hf_model_name)\n",
|
404 |
"\n",
|
405 |
"# Pull the latest changes from the remote repository\n",
|
406 |
"repo.git_pull()\n",
|
|
|
441 |
"# Define a class for the model\n",
|
442 |
"class glacformer():\n",
|
443 |
" def __init__(self, pipeline=pipeline(\"image-segmentation\",\n",
|
444 |
+
" model=hf_model_name, image_processor=\"nvidia/MiT-b0\"), image_list = glob(\"secondleg/*/cropped_images/*.png\")) -> None:\n",
|
445 |
" self.pipeline = pipeline\n",
|
446 |
" self.image_list = image_list\n",
|
447 |
" def __getitem__(self, index, alpha = 100):\n",
|
|
|
495 |
"name": "python",
|
496 |
"nbconvert_exporter": "python",
|
497 |
"pygments_lexer": "ipython3",
|
498 |
+
"version": "3.10.11"
|
499 |
},
|
500 |
"widgets": {
|
501 |
"application/vnd.jupyter.widget-state+json": {
|