-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #929 from roboflow/new-model-ids-2
Enable new type of models - Roboflow instant models
- Loading branch information
Showing
14 changed files
with
212 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
DatasetID = str | ||
VersionID = str | ||
ModelID = str | ||
VersionID = int | ||
TaskType = str | ||
ModelType = str | ||
WorkspaceID = str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
from typing import Tuple | ||
from typing import Optional, Tuple, Union | ||
|
||
from inference.core.entities.types import DatasetID, VersionID | ||
from inference.core.entities.types import DatasetID, ModelID, VersionID | ||
from inference.core.exceptions import InvalidModelIDError | ||
|
||
|
||
def get_model_id_chunks(model_id: str) -> Tuple[DatasetID, VersionID]: | ||
def get_model_id_chunks( | ||
model_id: str, | ||
) -> Tuple[Union[DatasetID, ModelID], Optional[VersionID]]: | ||
model_id_chunks = model_id.split("/") | ||
if len(model_id_chunks) != 2: | ||
raise InvalidModelIDError(f"Model ID: `{model_id}` is invalid.") | ||
return model_id_chunks[0], model_id_chunks[1] | ||
dataset_id, version_id = model_id_chunks[0], model_id_chunks[1] | ||
if dataset_id.lower() in { | ||
"clip", | ||
"cogvlm", | ||
"doctr", | ||
"doctr_rec", | ||
"doctr_det", | ||
"gaze", | ||
"grounding_dino", | ||
"sam", | ||
"sam2", | ||
"owlv2", | ||
"trocr", | ||
"yolo_world", | ||
}: | ||
return dataset_id, version_id | ||
try: | ||
return dataset_id, str(int(version_id)) | ||
except Exception: | ||
return model_id, None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.