Skip to content

Commit 75871a5

Browse files
yamini-labelboxattila-papaimnoszczakKevin Kimkkim-labelbox
authored
Release 3.50.0 (#1198)
Co-authored-by: Attila Papai <apapai@labelbox.com> Co-authored-by: mnoszczak <mnoszczak@labelbox.com> Co-authored-by: Kevin Kim <kkim@Kevins-MBP-2.attlocal.net> Co-authored-by: kkim-labelbox <99684749+kkim-labelbox@users.noreply.github.com> Co-authored-by: ovalle15 <aovalle@Andreas-MacBook-Pro-2.local> Co-authored-by: mnoszczak <99751601+mnoszczak@users.noreply.github.com> Co-authored-by: ezekielemerson <eemerson2325@gmail.com> Co-authored-by: Val Brodsky <vbrodsky@labelbox.com> Co-authored-by: Val Brodsky <vbrodsky@users.noreply.github.com> Co-authored-by: Nitin Pasari <npasari@labelbox.com> Co-authored-by: Attila Papai <97034214+attila-papai@users.noreply.github.com> Co-authored-by: Jared Storts <jstorts@labelbox.com> Co-authored-by: Łukasz Głuszek <lukaszmateuszgluszek@gmail.com> Co-authored-by: Piotr Delinowski <piotr@labelbox.com> Co-authored-by: Kevin Kim <kkim@kevins-mbp-2.lan> Co-authored-by: labelbox-engineering <58963965+labelbox-engineering@users.noreply.github.com> Co-authored-by: snyk-bot <snyk-bot@snyk.io>
1 parent a45f3ff commit 75871a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1162
-639
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
mypy -p labelbox --pretty --show-error-codes
7676
- name: Install package and test dependencies
7777
run: |
78-
pip install tox==3.18.1
78+
pip install tox==3.18.1 pytest-snapshot
7979
8080
# TODO: replace tox.ini with what the Makefile does
8181
# to make sure local testing is

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
# Changelog
2+
# Version 3.50.0 (2023-08-04)
3+
## Added
4+
* Support batch_ids filter for projects in Exports v2
5+
* Added access_from field to project members to differentiate project-based roles from organization level roles
6+
* Ability to use data_row_ids instead of the whole data row object for DataRow.export_V2()
7+
* Cursor-based pagination for dataset.data_rows()
8+
9+
## Fixed
10+
* client.get_projects() unable to fetch details for LLM projects
11+
12+
## Notebooks
13+
* Improved the documentation for `examples/basics/custom_embeddings.ipynb`
14+
* Updated the documentation for `examples/basics/data_row_metadata.ipynb`
15+
* Added details about CRUD methods to `examples/basics/ontologies.ipynb`
16+
217
# Version 3.49.1 (2023-06-29)
318
## Fixed
419
* Removed numpy version lock that caused Python version >3.8 to download incompatible numpy version

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SDK team's approval is required for all code changes (excluding notebook changes)
2+
* @Labelbox/data-io
3+
*.ipynb

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.9-slim-bullseye
22

3-
RUN pip install pytest pytest-cases pytest-rerunfailures
3+
RUN pip install pytest pytest-cases pytest-rerunfailures pytest-snapshot
44
RUN apt-get -y update
55
RUN apt install -y libsm6 \
66
libxext6 \

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ test-staging: build-image
2222
-e LABELBOX_TEST_API_KEY_STAGING=${LABELBOX_TEST_API_KEY_STAGING} \
2323
local/labelbox-python:test pytest $(PATH_TO_TEST)
2424

25+
test-staging-eu: build-image
26+
docker run -it --rm -v ${PWD}:/usr/src -w /usr/src \
27+
-e LABELBOX_TEST_ENVIRON="staging-eu" \
28+
-e DA_GCP_LABELBOX_API_KEY=${DA_GCP_LABELBOX_API_KEY} \
29+
-e LABELBOX_TEST_API_KEY_STAGING_EU=${LABELBOX_TEST_API_KEY_STAGING_EU} \
30+
local/labelbox-python:test pytest $(PATH_TO_TEST)
31+
2532
test-prod: build-image
2633
docker run -it --rm -v ${PWD}:/usr/src -w /usr/src \
2734
-e LABELBOX_TEST_ENVIRON="prod" \

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
copyright = '2021, Labelbox'
2222
author = 'Labelbox'
2323

24-
release = '3.49.1'
24+
release = '3.50.0'
2525

2626
# -- General configuration ---------------------------------------------------
2727

examples/basics/custom_embeddings.ipynb

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"metadata": {},
3232
"source": [
3333
"# Documentation\n",
34-
"Please read this document before getting started. \n",
34+
"Please read this document before getting started.\n",
3535
"https://docs.google.com/document/d/1C_zZFGNjXq10P1MvEX6MM0TC7HHrkFOp9BB0P_S_2MQ"
3636
],
3737
"cell_type": "markdown"
@@ -46,7 +46,6 @@
4646
{
4747
"metadata": {},
4848
"source": [
49-
"# labelbox\n",
5049
"!pip3 install -q \"labelbox[data]\""
5150
],
5251
"cell_type": "code",
@@ -56,7 +55,7 @@
5655
{
5756
"metadata": {},
5857
"source": [
59-
"import labelbox as lb \n",
58+
"import labelbox as lb\n",
6059
"import numpy as np\n",
6160
"import json"
6261
],
@@ -74,7 +73,6 @@
7473
{
7574
"metadata": {},
7675
"source": [
77-
"# for custom embeddings\n",
7876
"!pip3 install -q 'git+https://github.com/Labelbox/advlib.git'"
7977
],
8078
"cell_type": "code",
@@ -115,9 +113,10 @@
115113
"source": [
116114
"# get images from a Labelbox dataset\n",
117115
"# Our systems start to process data after 1000 embeddings of each type, for this demo make sure your dataset is over 1000 data rows\n",
118-
"dataset = client.get_dataset(\"<ADD YOUR DATASET ID>\")\n",
116+
"dataset = client.get_dataset(\"<ADD YOUR DATASET ID>\") \n",
119117
"drs = list(dataset.export_data_rows(timeout_seconds=9999))\n",
120-
"data_row_ids = [dr.uid for dr in drs]"
118+
"data_row_ids = [dr.uid for dr in drs]\n",
119+
"data_row_ids = data_row_ids[:1000] # keep the first 1000 examples for the sake of this demo"
121120
],
122121
"cell_type": "code",
123122
"outputs": [],
@@ -127,19 +126,19 @@
127126
"metadata": {},
128127
"source": [
129128
"# Create the payload for custom embeddings\n",
130-
"It should be a .ndjson file\n",
131-
"It does not have to be created through python."
129+
"It should be a .ndjson file. \n",
130+
"Every line is a json file that finishes with a \\n character. \n",
131+
"It does not have to be created through python. "
132132
],
133133
"cell_type": "markdown"
134134
},
135135
{
136136
"metadata": {},
137137
"source": [
138-
"\n",
139-
"\n",
140138
"nb_data_rows = len(data_row_ids)\n",
141-
"# generate 1000 custom embedding vectors, of dimension 2048 each\n",
142-
"# Labelbox supports custom embeddings of dimension up to 2048\n",
139+
"print(\"Number of data rows: \", nb_data_rows)\n",
140+
"# generate random vectors, of dimension 2048 each\n",
141+
"# Labelbox supports custom embedding vectors of dimension up to 2048\n",
143142
"custom_embeddings = [list(np.random.random(2048)) for _ in range(nb_data_rows)]"
144143
],
145144
"cell_type": "code",
@@ -149,7 +148,7 @@
149148
{
150149
"metadata": {},
151150
"source": [
152-
"# create the ndjson payload for custom embeddings\n",
151+
"# create the payload for custom embeddings\n",
153152
"payload = []\n",
154153
"for data_row_id,custom_embedding in zip(data_row_ids,custom_embeddings):\n",
155154
" payload.append({\"id\": data_row_id, \"vector\": custom_embedding})\n",
@@ -163,19 +162,28 @@
163162
{
164163
"metadata": {},
165164
"source": [
166-
"# convert payload to ndjson file\n",
165+
"# delete any pre-existing file\n",
166+
"import os\n",
167+
"if os.path.exists(\"payload.ndjson\"):\n",
168+
" os.remove(\"payload.ndjson\")\n",
167169
"\n",
170+
"# convert the payload to json file\n",
168171
"with open('payload.ndjson', 'w') as f:\n",
169-
" sanity_check_payload = json.dump(payload, f)\n",
170-
"\n",
171-
"\n",
172+
" for p in payload:\n",
173+
" f.write(json.dumps(p) + \"\\n\")\n",
174+
" # sanity_check_payload = json.dump(payload, f)"
175+
],
176+
"cell_type": "code",
177+
"outputs": [],
178+
"execution_count": null
179+
},
180+
{
181+
"metadata": {},
182+
"source": [
172183
"# sanity check that you can read/load the file and the payload is correct\n",
173184
"with open('payload.ndjson') as f:\n",
174-
" sanity_check_payload = json.load(f)\n",
175-
" \n",
176-
"\n",
177-
"print(\"Nb of custom embedding vectors in sanity_check_payload: \", len(sanity_check_payload))\n",
178-
"# print(\"sanity_check_payload: \", sanity_check_payload)"
185+
" sanity_check_payload = [json.loads(l) for l in f.readlines()]\n",
186+
"print(\"Nb of custom embedding vectors in sanity_check_payload: \", len(sanity_check_payload))"
179187
],
180188
"cell_type": "code",
181189
"outputs": [],
@@ -184,7 +192,7 @@
184192
{
185193
"metadata": {},
186194
"source": [
187-
"# See all custom embeddings available\n",
195+
"# See all custom embeddings available in your Labelbox workspace\n",
188196
"!advtool embeddings list"
189197
],
190198
"cell_type": "code",
@@ -194,9 +202,9 @@
194202
{
195203
"metadata": {},
196204
"source": [
197-
"# # Create a new custom embedding\n",
205+
"# # Create a new custom embedding, unless you want to re-use one\n",
198206
"!advtool embeddings create my_custom_embedding_2048_dimensions 2048\n",
199-
"# will return the ID of the newly created embedding, e.g. cgbjjt5ra07710005liytdf19"
207+
"# this command will return the ID of the newly created embedding, e.g. ciqtgd94607290000ljx4dvh2"
200208
],
201209
"cell_type": "code",
202210
"outputs": [],
@@ -206,7 +214,7 @@
206214
"metadata": {},
207215
"source": [
208216
"# # Delete a custom embedding\n",
209-
"# !advtool embeddings delete cj7j0ukre0771000blj4qnxgn"
217+
"# !advtool embeddings delete ciqtgd94607290000ljx4dvh2"
210218
],
211219
"cell_type": "code",
212220
"outputs": [],
@@ -222,8 +230,8 @@
222230
{
223231
"metadata": {},
224232
"source": [
225-
"# Upload the payload to Labelbox \n",
226-
"!advtool embeddings import cj7j0ukre0771000blj4qnxgn ./payload.ndjson"
233+
"# Replace the current id with the newly generated id from the previous step, or any existing custom embedding id.\n",
234+
"!advtool embeddings import c933bviqn0756000elk07et77 ./payload.ndjson"
227235
],
228236
"cell_type": "code",
229237
"outputs": [],
@@ -240,7 +248,7 @@
240248
"metadata": {},
241249
"source": [
242250
"# count how many data rows have a specific custom embedding (This can take a couple of minutes)\n",
243-
"!advtool embeddings count cj7j0ukre0771000blj4qnxgn"
251+
"!advtool embeddings count c933bviqn0756000elk07et77"
244252
],
245253
"cell_type": "code",
246254
"outputs": [],

0 commit comments

Comments
 (0)