Skip to content

Commit 9cc2cf9

Browse files
committed
Fix the versions for code-quality
1 parent 12861df commit 9cc2cf9

File tree

6 files changed

+21
-27
lines changed

6 files changed

+21
-27
lines changed

.github/workflows/code-quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
python-version: '3.11'
2222

2323
- name: Install Ruff
24-
run: pip install ruff
24+
run: pip install ruff==0.14.4
2525

2626
- name: Run Ruff linter
2727
run: ruff check . --output-format=github
@@ -30,7 +30,7 @@ jobs:
3030
run: ruff format --check .
3131

3232
- name: Run Markdownlint
33-
uses: nosborn/github-action-markdown-cli@v3.3.0
33+
uses: nosborn/github-action-markdown-cli@v3.4.0
3434
with:
3535
files: .
3636
config_file: .markdownlint.json

assets/usecase/knowledge-tuning/Knowledge Tuning Workflow.excalidraw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4817,4 +4817,4 @@
48174817
"lockedMultiSelections": {}
48184818
},
48194819
"files": {}
4820-
}
4820+
}

examples/fine-tuning/rhoai-3.2/osft/osft-example.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,9 +579,7 @@
579579
{
580580
"cell_type": "code",
581581
"execution_count": null,
582-
"metadata": {
583-
"scrolled": true
584-
},
582+
"metadata": {},
585583
"outputs": [],
586584
"source": [
587585
"# Stream logs\n",

examples/fine-tuning/rhoai-3.2/training-hub/sft/sft.ipynb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535
"!python3 -m pip install --force-reinstall --no-cache-dir -U ipykernel"
3636
]
3737
},
38-
{
39-
"cell_type": "markdown",
40-
"id": "e5fcc948",
41-
"metadata": {},
42-
"source": []
43-
},
4438
{
4539
"cell_type": "markdown",
4640
"id": "49a99fc8-24d5-4040-bd1d-faa7c7e1ef27",

examples/knowledge-tuning/04_Knowledge_Mixing/utils/knowledge_utils.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ def sample_doc_qa(
100100
def _clean_response_text(df: pl.DataFrame) -> pl.DataFrame:
101101
"""Clean response text by removing markers and whitespace."""
102102
return df.with_columns(
103-
pl
104-
.col("response")
103+
pl.col("response")
105104
.str.replace_all(r"\[END\]", "")
106105
.str.replace_all(r"\[ANSWER\]", "")
107106
.str.strip_chars()
@@ -112,8 +111,7 @@ def _clean_response_text(df: pl.DataFrame) -> pl.DataFrame:
112111
def _create_metadata(df: pl.DataFrame) -> pl.Expr:
113112
"""Create metadata JSON structure."""
114113
return (
115-
pl
116-
.struct([
114+
pl.struct([
117115
pl.col("document").alias("sdg_document"),
118116
pl.lit("document_knowledge_qa").alias("dataset"),
119117
pl.col("raw_document"),
@@ -234,8 +232,7 @@ def generate_knowledge_qa_dataset(
234232
"reasoning",
235233
]
236234
messages_expr = (
237-
pl
238-
.struct(message_columns)
235+
pl.struct(message_columns)
239236
.map_elements(_create_messages_with_reasoning_no_document)
240237
.alias("messages")
241238
)
@@ -248,24 +245,21 @@ def generate_knowledge_qa_dataset(
248245
"reasoning",
249246
]
250247
messages_expr = (
251-
pl
252-
.struct(message_columns)
248+
pl.struct(message_columns)
253249
.map_elements(_create_messages_with_reasoning)
254250
.alias("messages")
255251
)
256252
elif keep_document_in_context:
257253
message_columns = ["question", "response", "document", "document_outline"]
258254
messages_expr = (
259-
pl
260-
.struct(message_columns)
255+
pl.struct(message_columns)
261256
.map_elements(_create_messages_without_reasoning)
262257
.alias("messages")
263258
)
264259
else:
265260
message_columns = ["question", "response", "document", "document_outline"]
266261
messages_expr = (
267-
pl
268-
.struct(message_columns)
262+
pl.struct(message_columns)
269263
.map_elements(_create_messages_without_reasoning_no_document)
270264
.alias("messages")
271265
)
@@ -313,8 +307,7 @@ def count_tokens(text: str) -> int:
313307
return len(tokenizer.encode(text))
314308

315309
return df.with_columns(
316-
pl
317-
.col(column_name)
310+
pl.col(column_name)
318311
.map_elements(apply_chat_template, return_dtype=pl.String)
319312
.map_elements(count_tokens, return_dtype=pl.Int32)
320313
.alias("token_length")

tests/validation/test_notebook_content.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,22 @@ def test_no_execution_counts(notebook_path, relative_path):
4343

4444

4545
def test_no_stored_outputs(notebook_path, relative_path):
46-
"""Test that notebooks have no stored outputs (should be cleared)."""
46+
"""Test that notebooks have no stored outputs (should be cleared).
47+
48+
Cells with 'keep_output' tag in metadata are ignored.
49+
"""
4750
with open(notebook_path, encoding="utf-8") as f:
4851
nb = json.load(f)
4952

5053
cells_with_outputs = []
5154
for i, cell in enumerate(nb.get("cells", [])):
5255
if cell.get("cell_type") == "code":
56+
# Check if cell has keep_output tag
57+
metadata = cell.get("metadata", {})
58+
tags = metadata.get("tags", [])
59+
if "keep_output" in tags:
60+
continue
61+
5362
outputs = cell.get("outputs", [])
5463
if len(outputs) > 0:
5564
cells_with_outputs.append((i, len(outputs)))

0 commit comments

Comments
 (0)