Skip to content

Commit 871297c

Browse files
committed
Revise comments in chunking notebook
Signed-off-by: Ali Maredia <[email protected]>
1 parent b33f3c3 commit 871297c

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

notebooks/doc-preprocessing-to-sdg/chunking.ipynb

+24-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
"id": "7b33678f-67d2-48a1-801f-302622e43e0f",
66
"metadata": {},
77
"source": [
8-
"## Goal\n",
8+
"## Chunking\n",
99
"The goal of chunking for InstructLab SDG is to provide the teacher model small and logical pieces of the source document to generate data off of.\n",
1010
"\n",
1111
"In this notebook we are doing chunking with Docling[https://docling-project.github.io/docling/examples/hybrid_chunking/#hybrid-chunking].\n",
1212
"\n",
13-
"First let's ensure docling is installed."
13+
"The input to this notebook is a docling JSON file created after a docling conversion, or a directory of docling JSON files."
14+
]
15+
},
16+
{
17+
"cell_type": "markdown",
18+
"id": "d9f268fd-35d2-4c7a-8cfa-47630de00837",
19+
"metadata": {},
20+
"source": [
21+
"### Dependencies"
1422
]
1523
},
1624
{
@@ -272,8 +280,7 @@
272280
" c = dict(chunk=chunk, file=file.stem)\n",
273281
" all_chunks.append(c)\n",
274282
" except ConversionError as e:\n",
275-
" print(f\"Skipping file {file}\")\n",
276-
"# print(all_chunks)"
283+
" print(f\"Skipping file {file}\")"
277284
]
278285
},
279286
{
@@ -286,14 +293,26 @@
286293
"To view the chunks, run through the following cell. As you can see the document is broken into small pieces with metadata about the chunk based on the document's format"
287294
]
288295
},
296+
{
297+
"cell_type": "code",
298+
"execution_count": 1,
299+
"id": "ff88cf5c-1315-4eca-afcd-25706eaf7d6b",
300+
"metadata": {},
301+
"outputs": [],
302+
"source": [
303+
"# print(all_chunks)"
304+
]
305+
},
289306
{
290307
"cell_type": "markdown",
291308
"id": "84826055-a7f1-4334-a12b-bbc07a523199",
292309
"metadata": {
293310
"tags": []
294311
},
295312
"source": [
296-
"## Save the chunks to a text file each"
313+
"## Save the chunks to a text file for each chunk\n",
314+
"\n",
315+
"Each chunk is saved to an individual text file in the format: `{docling-json-file-name}-{chunk #}.txt`. Having chunking in this format is important as an input to create-sdg-seed-data notebook."
297316
]
298317
},
299318
{

0 commit comments

Comments
 (0)