Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Remove labels for the unsupervised model
Browse files- .pre-commit-config.yaml +1 -0
- Dockerfile +1 -0
- model.py +2 -0
- patch +13 -0
.pre-commit-config.yaml
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
repos:
|
2 |
- repo: https://github.com/pre-commit/pre-commit-hooks
|
3 |
rev: v4.2.0
|
|
|
1 |
+
exclude: patch
|
2 |
repos:
|
3 |
- repo: https://github.com/pre-commit/pre-commit-hooks
|
4 |
rev: v4.2.0
|
Dockerfile
CHANGED
@@ -50,6 +50,7 @@ RUN pip install --no-cache-dir -U \
|
|
50 |
RUN pip install --no-cache-dir -U gradio==3.16.2
|
51 |
|
52 |
COPY --chown=1000 . ${HOME}/app
|
|
|
53 |
ENV PYTHONPATH=${HOME}/app \
|
54 |
PYTHONUNBUFFERED=1 \
|
55 |
GRADIO_ALLOW_FLAGGING=never \
|
|
|
50 |
RUN pip install --no-cache-dir -U gradio==3.16.2
|
51 |
|
52 |
COPY --chown=1000 . ${HOME}/app
|
53 |
+
RUN cd CutLER && git apply ../patch
|
54 |
ENV PYTHONPATH=${HOME}/app \
|
55 |
PYTHONUNBUFFERED=1 \
|
56 |
GRADIO_ALLOW_FLAGGING=never \
|
model.py
CHANGED
@@ -131,6 +131,8 @@ class Model:
|
|
131 |
weight_path.as_posix(), 'MODEL.DEVICE',
|
132 |
'cuda:0' if torch.cuda.is_available() else 'cpu'
|
133 |
]
|
|
|
|
|
134 |
args = get_parser().parse_args(arg_list)
|
135 |
cfg = setup_cfg(args)
|
136 |
return VisualizationDemo(cfg)
|
|
|
131 |
weight_path.as_posix(), 'MODEL.DEVICE',
|
132 |
'cuda:0' if torch.cuda.is_available() else 'cpu'
|
133 |
]
|
134 |
+
if model_name in UNSUPERVISED_MODELS:
|
135 |
+
arg_list += ['DATASETS.TEST', '()']
|
136 |
args = get_parser().parse_args(arg_list)
|
137 |
cfg = setup_cfg(args)
|
138 |
return VisualizationDemo(cfg)
|
patch
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
diff --git a/cutler/demo/predictor.py b/cutler/demo/predictor.py
|
2 |
+
index 0920159..6fc8053 100644
|
3 |
+
--- a/cutler/demo/predictor.py
|
4 |
+
+++ b/cutler/demo/predictor.py
|
5 |
+
@@ -62,6 +62,8 @@ class VisualizationDemo(object):
|
6 |
+
)
|
7 |
+
if "instances" in predictions:
|
8 |
+
instances = predictions["instances"].to(self.cpu_device)
|
9 |
+
+ if self.metadata.name == '__unused':
|
10 |
+
+ instances.remove('pred_classes')
|
11 |
+
vis_output = visualizer.draw_instance_predictions(predictions=instances)
|
12 |
+
|
13 |
+
return predictions, vis_output
|