File size: 512 Bytes
4eac0a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from datasets import load_dataset

# 1) Dataset yükle
ds = load_dataset("AlicanKiraz0/Cybersecurity-Dataset-Fenrir-v2.0", split="train")

# 2) Prompt-response formatına dönüştür
def format_example(example):
    system = example.get("system", "")
    user = example.get("user", "")
    assistant = example.get("assistant", "")
    text = f"<|system|>\n{system}\n<|user|>\n{user}\n<|assistant|>\n{assistant}"
    return {"text": text}

ds = ds.map(format_example, remove_columns=ds.column_names)
print(ds[0])