Skip to content

Commit

Permalink
Merge pull request #347 from roboflow/lean/paligemma2-upload
Browse files Browse the repository at this point in the history
PaliGemma2 model upload support
  • Loading branch information
lrosemberg authored Dec 13, 2024
2 parents 7fca4bb + 12efbff commit 594bff7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file.

## 1.1.5
## 1.1.50

[stub]
- Added support for Palligema2 model uploads via `upload_model` command with the following model types:
- `paligemma2-3b-pt-224`
- `paligemma2-3b-pt-448`
- `paligemma2-3b-pt-896`
2 changes: 1 addition & 1 deletion roboflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from roboflow.models import CLIPModel, GazeModel # noqa: F401
from roboflow.util.general import write_line

__version__ = "1.1.49"
__version__ = "1.1.50"


def check_key(api_key, model, notebook, num_retries=0):
Expand Down
14 changes: 8 additions & 6 deletions roboflow/core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
"yolov9",
"yolonas",
"paligemma",
"paligemma2",
"yolov10",
"florence-2",
"yolov11",
Expand All @@ -496,14 +497,17 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
if not any(supported_model in model_type for supported_model in supported_models):
raise (ValueError(f"Model type {model_type} not supported. Supported models are" f" {supported_models}"))

if model_type.startswith(("paligemma", "florence-2")):
if "paligemma" in model_type or "florence-2" in model_type:
if model_type.startswith(("paligemma", "paligemma2", "florence-2")):
if any(model in model_type for model in ["paligemma", "paligemma2", "florence-2"]):
supported_hf_types = [
"florence-2-base",
"florence-2-large",
"paligemma-3b-pt-224",
"paligemma-3b-pt-448",
"paligemma-3b-pt-896",
"paligemma2-3b-pt-224",
"paligemma2-3b-pt-448",
"paligemma2-3b-pt-896",
]
if model_type not in supported_hf_types:
raise RuntimeError(
Expand Down Expand Up @@ -819,10 +823,8 @@ def __download_zip(self, link, location, format):
def bar_progress(current, total, width=80):
progress_message = (
"Downloading Dataset Version Zip in "
+ location
+ " to "
+ format
+ ": %d%% [%d / %d] bytes" % (current / total * 100, current, total)
f"{location} to {format}: "
f"{current/total*100:.0f}% [{current} / {total}] bytes"
)
sys.stdout.write("\r" + progress_message)
sys.stdout.flush()
Expand Down
2 changes: 1 addition & 1 deletion roboflow/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def is_valid_ISO8601_timestamp(ts):
try:
datetime.fromisoformat(ts)
return True
except:
except (ValueError, TypeError):
return False


Expand Down

0 comments on commit 594bff7

Please sign in to comment.