Spaces:
Runtime error
Runtime error
sps44
commited on
Commit
•
6e55aa6
0
Parent(s):
Duplicate from renumics/cifar100-sliceline-demo
Browse files- .gitattributes +34 -0
- .gitignore +2 -0
- Dockerfile +19 -0
- README.md +21 -0
- cifar100-enrichment-cv.parquet +3 -0
- prepare.py +23 -0
- requirements.txt +3 -0
- run.py +40 -0
- sliceline-layout.json +1 -0
- sliceline.pkl +3 -0
- spotlight-layout.json +1 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
|
2 |
+
.venv/
|
Dockerfile
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
ENV HOME=/code
|
5 |
+
# COPY ./requirements.txt /code/requirements.txt
|
6 |
+
# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
7 |
+
|
8 |
+
RUN apt install curl
|
9 |
+
RUN pip install pip -U
|
10 |
+
|
11 |
+
RUN pip install renumics-spotlight==1.3.0rc8 pyarrow
|
12 |
+
|
13 |
+
RUN pip install datasets cleanvision
|
14 |
+
|
15 |
+
COPY . .
|
16 |
+
RUN mkdir -p /code/.cache
|
17 |
+
RUN chmod -R 777 /code
|
18 |
+
RUN python prepare.py
|
19 |
+
CMD ["python", "run.py"]
|
README.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Explore data slices in the CIFAR-100 benchmark
|
3 |
+
emoji: 📊
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: blue
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
license: mit
|
9 |
+
app_file: run.py
|
10 |
+
datasets:
|
11 |
+
- renumics/cifar100-enriched
|
12 |
+
- cifar100
|
13 |
+
tags:
|
14 |
+
- renumics
|
15 |
+
- spotlight
|
16 |
+
- sliceline
|
17 |
+
- data-centric-ai
|
18 |
+
duplicated_from: renumics/cifar100-sliceline-demo
|
19 |
+
---
|
20 |
+
|
21 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
cifar100-enrichment-cv.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0bc7e67b598b765cce75309f7c414a13ca9fcc8004f436a0490822c899bfa66c
|
3 |
+
size 544628
|
prepare.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import datasets
|
3 |
+
import os
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
if __name__ == "__main__":
|
7 |
+
cache_file = "dataset_cache.parquet"
|
8 |
+
if os.path.exists(cache_file):
|
9 |
+
# Load dataset from cache
|
10 |
+
df = pd.read_parquet(cache_file)
|
11 |
+
print("Dataset loaded from cache.")
|
12 |
+
else:
|
13 |
+
# Load dataset using datasets.load_dataset()
|
14 |
+
dataset = datasets.load_dataset("renumics/cifar100-enriched", split="test")
|
15 |
+
print("Dataset loaded using datasets.load_dataset().")
|
16 |
+
|
17 |
+
df = dataset.to_pandas()
|
18 |
+
|
19 |
+
# Save dataset to cache
|
20 |
+
df.to_parquet(cache_file)
|
21 |
+
|
22 |
+
print("Dataset saved to cache.")
|
23 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
renumics-spotlight
|
2 |
+
datasets
|
3 |
+
fastparquet
|
run.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import datasets
|
3 |
+
from renumics import spotlight
|
4 |
+
import os
|
5 |
+
import pandas as pd
|
6 |
+
|
7 |
+
if __name__ == "__main__":
|
8 |
+
cache_file = "dataset_cache.parquet"
|
9 |
+
cache_file_enrichment="cifar100-enrichment-cv.parquet"
|
10 |
+
cache_file_issues="sliceline.pkl"
|
11 |
+
|
12 |
+
if os.path.exists(cache_file):
|
13 |
+
# Load dataset from cache
|
14 |
+
df = pd.read_parquet(cache_file)
|
15 |
+
print("Dataset loaded from cache.")
|
16 |
+
else:
|
17 |
+
# Load dataset using datasets.load_dataset()
|
18 |
+
dataset = datasets.load_dataset("renumics/cifar100-enriched", split="test")
|
19 |
+
print("Dataset loaded using datasets.load_dataset().")
|
20 |
+
|
21 |
+
df = dataset.to_pandas()
|
22 |
+
|
23 |
+
# Save dataset to cache
|
24 |
+
df.to_parquet(cache_file)
|
25 |
+
|
26 |
+
print("Dataset saved to cache.")
|
27 |
+
|
28 |
+
df_cv=pd.read_parquet(cache_file_enrichment)
|
29 |
+
|
30 |
+
df = pd.concat([df, df_cv], axis=1)
|
31 |
+
|
32 |
+
with open(cache_file_issues, "rb") as issue_file:
|
33 |
+
issues = pickle.load(issue_file)
|
34 |
+
|
35 |
+
#df = dataset.to_pandas()
|
36 |
+
df_show = df.drop(columns=['embedding', 'probabilities'])
|
37 |
+
while True:
|
38 |
+
view = spotlight.show(df_show, issues=issues, port=7860, host="0.0.0.0", layout="sliceline-layout.json",
|
39 |
+
dtype={"image": spotlight.Image, "embedding_reduced": spotlight.Embedding}, allow_filebrowsing=False)
|
40 |
+
view.close()
|
sliceline-layout.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"orientation":"vertical","children":[{"kind":"split","weight":1,"orientation":"horizontal","children":[{"kind":"tab","weight":1,"children":[{"kind":"widget","name":"Table","type":"table","config":{"tableView":"selected","visibleColumns":null,"sorting":null,"orderByRelevance":false}}]},{"kind":"tab","weight":1,"children":[{"kind":"widget","name":"Similarity Map","type":"similaritymap","config":{"placeBy":null,"reductionMethod":null,"colorBy":"fine_label_prediction_error","sizeBy":null,"filter":false,"umapNNeighbors":20,"umapMetric":null,"umapMinDist":0.15,"pcaNormalization":null,"umapMenuLocalGlobalBalance":null,"umapMenuIsAdvanced":false}}]},{"kind":"tab","weight":1,"children":[{"kind":"widget","name":"Issues","type":"IssuesWidget","config":null}]}]},{"kind":"tab","weight":1,"children":[{"kind":"widget","name":"Inspector","type":"inspector","config":{"views":[{"view":"ArrayLens","key":"12MuLXBrGWyR1UqByhSAGR","name":"embedding_reduced","columns":["embedding_reduced"]},{"view":"ImageView","key":"tuCdyeyADoxB7jtazsiLt2","name":"image","columns":["image"]},{"view":"TextLens","columns":["fine_label_prediction_str"],"name":"view","key":"45099023-3dcc-4f56-baa3-b0447a98a3c6"},{"view":"TextLens","columns":["fine_label_str"],"name":"view","key":"f057b3df-7920-4adb-bf6f-03c260a56b94"}]}}]}]}
|
sliceline.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:af9bff1ba785b9effd303824617bb3c79ee1113d1bf7786d2c878541340d2eb1
|
3 |
+
size 8504
|
spotlight-layout.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"orientation":"vertical","children":[{"kind":"split","weight":55.52608311229001,"orientation":"horizontal","children":[{"kind":"tab","weight":41.16700201207244,"children":[{"kind":"widget","name":"Table","type":"table","config":{"tableView":"full","visibleColumns":["coarse_label_str","fine_label_prediction_str","fine_label_str","image","__idx__"],"sorting":[["__idx__","DESC"]],"orderByRelevance":false,"columnWidths":{"coarse_label":92,"coarse_label_str":165,"embedding_reduced":128,"fine_label":92,"fine_label_prediction":92,"fine_label_prediction_error":92,"fine_label_prediction_str":244,"fine_label_str":194,"full_image":256,"image":200,"split":256,"__idx__":92,"__last_edited_at__":192,"__last_edited_by__":256}}}]},{"kind":"tab","weight":33.66487769877306,"children":[{"kind":"widget","name":"Similarity Map","type":"similaritymap","config":{"placeBy":null,"reductionMethod":null,"colorBy":"fine_label_str","sizeBy":null,"filter":false,"umapNNeighbors":20,"umapMetric":null,"umapMinDist":0.15,"pcaNormalization":null,"umapMenuLocalGlobalBalance":null,"umapMenuIsAdvanced":false}},{"kind":"widget","name":"Scatter Plot","type":"scatterplot","config":{"xAxisColumn":null,"yAxisColumn":null,"colorBy":null,"sizeBy":null,"filter":false}}]},{"kind":"tab","weight":25.168120289154498,"children":[{"kind":"widget","name":"Histogram","type":"histogram","config":{"columnKey":"fine_label_str","stackByColumnKey":"fine_label_prediction_error","filter":false}}]}]},{"kind":"tab","weight":44.47391688770999,"children":[{"kind":"widget","name":"Inspector","type":"inspector","config":{"views":[{"view":"ImageView","key":"es3NP2fbYeG5TzTQqCzZKL","name":"image","columns":["image"]},{"view":"TextLens","columns":["fine_label_str"],"name":"view","key":"7262001a-1270-467c-bfe8-6b6883adbc7d"},{"view":"TextLens","columns":["fine_label_prediction_str"],"name":"view","key":"f72a8ae9-17c4-4097-b454-79a6f60865db"},{"view":"ScalarView","columns":["fine_label_prediction_error"],"name":"view","key":"be4d6afe-9093-4581-b363-df11d3c6d34a"}],"visibleColumns":4}}]}]}
|