Dataset Viewer
Auto-converted to Parquet Duplicate
system
stringclasses
1 value
user
stringlengths
427
702
assistant
stringlengths
8.35k
8.8k
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
The scenario occurs on the ARG_Carcarana-10_1_T-1 map at 2025-04-18 09:03:31 under cloudy morning light. Moderate snow (intensity 0.5) falls in very dense fog, sharply reducing visibility. Two vehicles spawn, no pedestrians: the ego at (146.9146, -12.9910, 0.0, h=3.0271) and Npc313 at (132.3177, -16.8371, 0.0, h=1.3715...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-10_1_T-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG Carcaraña map, the scene takes place at 01:07 on 2023-08-17 under a clear sky with no clouds, no falling snow, and fog limiting visibility to roughly 638 m. Two vehicles are present—an ego car and an NPC—with no pedestrians. The ego starts at (-95.67, 70.90, 0.0) facing about 79°, while the NPC starts at (-1...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-11_2_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle">...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG_Carcarana-11_2_I-1-1 road network at 02:47:59 on February 29, 2020, conditions are cloudy and dry, with dense fog limiting visibility to about 340 meters. Two vehicles are present and no pedestrians: the ego car starts at (-139.3716, -129.9198, 0.0) with heading 1.348 rad, and Npc318 starts at (-140.8895, -1...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-11_2_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle">...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG_Carcarana-1_1_I-1-1 road network at 2022-12-09 16:29:43, conditions are cloudy with no active snowfall and extremely dense fog. The ego car starts at (119.573, -75.481) facing heading 1.37 rad, while a second vehicle (Npc31) begins at (125.854, -50.533) facing 3.77 rad; no pedestrians are present. The ego’s ...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-1_1_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG_Carcarana-1_3_I-1-1 map at 09:31:36 on 2024-10-23, conditions are clear-skied with moderate snowfall (intensity 0.5) and extremely dense fog (~87% visibility reduction). The ego car starts at (101.677, -166.511, 0.0) facing heading 2.941 rad, while a second vehicle (Npc334) begins at (119.546, -170.284, 0.0)...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-1_3_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG_Carcarana-1_3_I-1-1 map at 11:05 AM on 2025-02-21, conditions are cloudy and dry with light fog limiting visibility to about 500 m. The ego vehicle starts at (123.073, 26.858, 0) heading 1.377 rad, and another vehicle (Npc311) begins at (121.170, 17.894, 0) heading 1.360 rad. A pedestrian entity is present b...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-1_3_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG Carcarana road network just after midnight on May 30, 2019, conditions are cloudy with no active snowfall but extremely dense fog limiting visibility. The ego car starts at (144.6907, 144.6777, 0.0) heading −1.7815 rad, and an NPC vehicle starts at (142.8841, 115.8476, 0.0) heading −2.4201 rad; there are no ...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-1_3_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG_Carcarana-1_1_I-1-1 road network at 18:30:59 on July 27, 2024, the scene is overcast with moderate snowfall (intensity 0.5) and fog density around 32.72. The ego vehicle begins at (-166.075653, -51.772146, 0.0) with heading -0.206963 rad, while Npc323 starts at (-138.802754, -40.262781, 0.0) with heading -1....
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-1_1_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the CARLA map ARG_Carcarana-3_3_I-1-1 at 2024-01-08 15:02:32, skies are clear with moderate rain (intensity 0.5) and light fog giving roughly 525.95 m visibility. Two vehicles are present—the ego and an NPC vehicle; no pedestrians are included. The ego begins at (115.91631431702295, -150.5957610931439, 0.0) heading ...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-3_3_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG_Carcarana-4_2_T-1 map at 2023-02-13 19:06:41, conditions are cloudy with snowfall set to 0.0 intensity and fog configured to a distance of 932.85 m. The ego car starts at (151.99, -102.08, z=0) facing heading 2.94 rad, while a second vehicle, Npc310, begins at (102.50, -91.65, z=0) facing 2.93 rad. At simula...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-4_2_T-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
At 03:45:20 on June 30, 2020, under a cloudy night sky with no measurable rain but dense fog (~495 m visibility), the scene takes place on the ARG_Carcarana-6_2_I-1-1 road network. The ego car starts near (-6.59, -39.87, 0) facing 1.36 rad, and the NPC car Npc30 starts at (1.98, -17.64, 0) facing 3.57 rad. When simulat...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-6_2_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
At dawn on 2021-09-10 at 05:54:41, the scene unfolds under a rainy overcast sky with no precipitation and thick fog limiting visibility to roughly 760 meters. The ego car starts near (29.19, 146.88, 0) facing about -1.78 rad, while a second vehicle (Npc324) sits near (27.50, 139.80, 0) facing -1.85 rad, about seven met...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-7_1_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
Late at night on the ARG_Carcarana-7_1_I-1-1 map (2021-07-15 23:33:25), the weather is clear-skied with moderate snowfall and foggy visibility. The ego car begins near (-118.585, 57.758, 0.0) heading 1.38 rad, while an NPC vehicle starts at (-137.003, 79.532, 0.0) heading -0.208 rad, and a single pedestrian is present....
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-7_1_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the ARG Carcarañá I-1-1 road network at 09:56:53 on July 13, 2025, conditions are clear and dry with a thin fog yielding about 831 m visibility. The ego car starts at (53.1335, -10.4308, 0.0) facing roughly west (heading -3.09 rad), and a second vehicle, Npc34, is at (36.8658, -40.1937, 0.0) facing 1.36 rad. The ego...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="ARG_Carcarana-8_3_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the BEL_Aarschot-11_1_I-1-1 road network at 10:34:24 on 2020-04-05, the sky is clear but light-to-moderate snow (intensity 0.5) falls, with fog limiting visibility to about 925 meters. The ego vehicle starts at (8.315, -69.477, 0.0) facing heading -1.421 rad, while Npc32 begins at (4.193, -84.856, 0.0) facing -2.315...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="BEL_Aarschot-11_1_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the BEL_Aarschot-3_1_I-1-1.xodr road network at 12:21:20 on July 18, 2023, conditions are cloudy with fog and no rain falling. The ego car starts near (1.626, 0.647, 0.0) facing heading −4.616 rad, while an NPC vehicle is at (−17.253, 3.720, 0.0) facing −2.838 rad; a single pedestrian is present nearby. When simulat...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="BEL_Aarschot-3_1_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the Beringen map at 18:41:44 on March 2, 2020, clear skies prevail with no rain, yet visibility is extremely low due to dense fog. The ego car starts at (38.915, -44.338) facing roughly west, while an NPC car is placed at (11.061, -68.882). A lone pedestrian entity is included but left idle, without a defined starti...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="BEL_Beringen-3_2_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
At 23:28:51 on 2024-01-27, on the BEL_Beringen-3_4_I-1-1 map, the scene unfolds under overcast skies with moderate snowfall and extremely dense fog. The ego vehicle starts near (2.75, 2.12) facing roughly west (heading -3.02 rad), while Npc30 begins at (-19.21, -0.75) facing east (heading 0.01 rad); a single pedestrian...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="BEL_Beringen-3_4_I-1-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modificatio...
On the BEL_Nivelles-16_2_T-1 road network at 18:55 on 2023-10-11, the weather is clear but with moderate snowfall (intensity 0.5) and light fog giving roughly 721 m visibility. The ego car starts at (-7.77, -20.45, 0.0) facing heading 1.103 rad, while another vehicle (Npc341) starts at (13.30, 21.45, 0.0) facing 1.141 ...
<OpenScenario> <FileHeader author="trial" date="2023-03-23T12:00:00" description="myscenario" revMajor="1" revMinor="0" /> <ParameterDeclarations /> <CatalogLocations /> <RoadNetwork> <LogicFile filepath="BEL_Nivelles-16_2_T-1.xodr" /> </RoadNetwork> <Entities> <ScenarioObject name="ego_vehicle"> ...
End of preview. Expand in Data Studio

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

# Prompt2OpenSCENARIO Dataset

## Overview

This repository hosts the **Prompt2OpenSCENARIO dataset**, a curated subset of driving scenarios derived and reformatted for **structured scenario generation**.

Each record pairs a **natural language description** of a traffic scene with its corresponding **validated OpenSCENARIO 1.0 XML file**.

The dataset is designed for training and evaluating large language models in the context of **autonomous driving simulation** (e.g., CARLA).

- **Format:** JSON Lines (.jsonl)

- **Records:** 469

- **Language:** English (descriptions) + XML (OpenSCENARIO 1.0)

- **Validation:** All XML files were validated against the official **OpenSCENARIO 1.0 XSD schema**


## Quick Start (Python) — Load & Prepare for Fine-Tuning

Below is a **copy-paste ready** script that:

1) downloads the dataset from the Hub,

2) builds train/validation splits,

3) converts records into messages (system+user→assistant) compatible with a \[INST] ... \[/INST] chat template,

4) (optional) launches an **LoRA/QLoRA SFT** using TRL.

Replace BASE\_MODEL and paths as needed. If you only need the raw dataset, you can stop after the print(ds)/save\_to\_disk lines.


\# pip install -U datasets transformers peft trl bitsandbytes accelerate

import os, json, random

from datasets import load\_dataset, DatasetDict

from transformers import AutoTokenizer, AutoModelForCausalLM

from peft import LoraConfig

from trl import SFTTrainer, SFTConfig



HF\_DATASET = "anto0699/Prompt2OpenSCENARIO-LoRA-FineTune"

BASE\_MODEL = "codellama/CodeLlama-13b-Instruct-hf"  # change if needed

OUTPUT\_DIR = "runs/codellama13b-lora"



SEED = 42

VAL\_RATIO = 0.10

MAX\_LENGTH = 4000

STOP\_SEQUENCE = "</OpenScenario>"



random.seed(SEED)



\# 1) Load dataset from the Hub

raw = load\_dataset(HF\_DATASET, split="train")

print(raw)

\# raw.save\_to\_disk("data/prompt2openscenario")  # optional



\# 2) Train/validation split

split = raw.train\_test\_split(test\_size=VAL\_RATIO, seed=SEED)

ds = DatasetDict({"train": split\["train"], "validation": split\["test"]})



\# 3) Convert to chat messages (system + user -> assistant)

def to\_messages(ex):

&nbsp;   system = ex\["system"].strip()

&nbsp;   user = ex\["user"].strip()

&nbsp;   assistant = ex\["assistant"].strip()

&nbsp;   if not assistant.endswith(STOP\_SEQUENCE):

&nbsp;       assistant += STOP\_SEQUENCE

&nbsp;   user\_with\_sys = f"<<SYS>>\\n{system}\\n<</SYS>>\\n\\n{user}"

&nbsp;   return {

&nbsp;       "messages": \[

&nbsp;           {"role": "user", "content": user\_with\_sys},

&nbsp;           {"role": "assistant", "content": assistant},

&nbsp;       ]

&nbsp;   }



ds = ds.map(to\_messages)



\# 4) (Optional) Fine-tune with TRL + PEFT (LoRA or QLoRA)

USE\_4BIT = True  # set False for LoRA "full-precision" loading



tok = AutoTokenizer.from\_pretrained(BASE\_MODEL, use\_fast=True)

if tok.pad\_token is None:

&nbsp;   tok.pad\_token = tok.eos\_token

tok.padding\_side = "right"



\# Instruct-style template compatible with assistant\_only\_loss=True

tok.chat\_template = (

&nbsp;   "{{ bos\_token }}"

&nbsp;   "{% for m in messages %}"

&nbsp;   "{% if m\['role'] == 'user' %}"

&nbsp;   "\[INST] {{ m\['content'] }} \[/INST]"

&nbsp;   "{% elif m\['role'] == 'assistant' %}"

&nbsp;   "{% generation %}{{ m\['content'] }}{% endgeneration %}{{ eos\_token }}"

&nbsp;   "{% endif %}"

&nbsp;   "{% endfor %}"

)



bnb\_cfg = None

dtype = "bfloat16"

if USE\_4BIT:

&nbsp;   from transformers import BitsAndBytesConfig

&nbsp;   bnb\_cfg = BitsAndBytesConfig(

&nbsp;       load\_in\_4bit=True,

&nbsp;       bnb\_4bit\_quant\_type="nf4",

&nbsp;       bnb\_4bit\_use\_double\_quant=True,

&nbsp;       bnb\_4bit\_compute\_dtype=getattr(\_\_import\_\_("torch"), "bfloat16")

&nbsp;   )



model = AutoModelForCausalLM.from\_pretrained(

&nbsp;   BASE\_MODEL,

&nbsp;   torch\_dtype=None if USE\_4BIT else getattr(\_\_import\_\_("torch"), "bfloat16"),

&nbsp;   quantization\_config=bnb\_cfg if USE\_4BIT else None,

&nbsp;   device\_map="auto" if USE\_4BIT else None,

)

model.config.pad\_token\_id = tok.pad\_token\_id

model.config.use\_cache = False  # enabled automatically at inference time



\# Filter overlong samples to respect context length

def ok\_len(batch):

&nbsp;   return \[

&nbsp;       len(tok.apply\_chat\_template(msgs, tokenize=True, add\_generation\_prompt=False)) <= MAX\_LENGTH

&nbsp;       for msgs in batch\["messages"]

&nbsp;   ]

ds\["train"] = ds\["train"].filter(ok\_len, batched=True)



\# LoRA config (typical for Llama-like)

peft\_cfg = LoraConfig(

&nbsp;   r=32, lora\_alpha=32, lora\_dropout=0.05, bias="none",

&nbsp;   target\_modules=\["q\_proj","k\_proj","v\_proj","o\_proj","gate\_proj","up\_proj","down\_proj"],

&nbsp;   task\_type="CAUSAL\_LM"

)



\# SFT config

sft\_cfg = SFTConfig(

&nbsp;   output\_dir=OUTPUT\_DIR,

&nbsp;   max\_length=MAX\_LENGTH,

&nbsp;   packing=False,

&nbsp;   per\_device\_train\_batch\_size=1,

&nbsp;   gradient\_accumulation\_steps=8,

&nbsp;   per\_device\_eval\_batch\_size=1,

&nbsp;   learning\_rate=2e-4,

&nbsp;   num\_train\_epochs=2,

&nbsp;   warmup\_ratio=0.05,

&nbsp;   lr\_scheduler\_type="cosine",

&nbsp;   logging\_steps=20,

&nbsp;   eval\_strategy="steps",

&nbsp;   eval\_steps=200,

&nbsp;   save\_steps=50,

&nbsp;   save\_total\_limit=3,

&nbsp;   bf16=True,

&nbsp;   gradient\_checkpointing=True,

&nbsp;   assistant\_only\_loss=True,

&nbsp;   report\_to=\["tensorboard"],

)



trainer = SFTTrainer(

&nbsp;   model=model,

&nbsp;   args=sft\_cfg,

&nbsp;   train\_dataset=ds\["train"],

&nbsp;   eval\_dataset=ds\["validation"],

&nbsp;   peft\_config=peft\_cfg,

&nbsp;   processing\_class=tok,

)



trainer.train()

trainer.save\_model(OUTPUT\_DIR)

tok.save\_pretrained(OUTPUT\_DIR)

print("Finished fine-tuning; adapters saved to:", OUTPUT\_DIR)

## Dataset Structure

Each record contains three fields:


{

&nbsp; "system": "Act as an OpenSCENARIO 1.0 generator for ADS testing in CARLA. I will give you a scene description in English and you must return one valid .xosc file, XML only, encoded in UTF-8, starting with <OpenScenario> and ending with </OpenScenario>. The file must be schema-compliant, and executable in CARLA without modifications. The scenario must include: the map (<RoadNetwork>), <Environment> with <TimeOfDay> and <Weather>, exactly one ego vehicle, any other entities with unique names, initial positions using <WorldPosition>, and a valid <Storyboard> with deterministic triggers/events/actions. Use realistic defaults if details are missing (no randomness), but never omit these features. No comments or extra text, only the .xosc.",

&nbsp; "user": "Human-readable description of the scene (time, weather, vehicles, pedestrians, routes, triggers).",

&nbsp; "assistant": "Machine-readable OpenSCENARIO 1.0 XML file, compliant and executable in CARLA."

}



\## Example

\*\*User Prompt (natural language):\*\*

On April 18, 2025, at 09:03:31, the scene unfolds under cloudy skies with moderate snowfall and dense fog. 

The ego vehicle starts at (146.915, -12.991, 0.0) facing north.



\*\*Assistant reply (OpenSCENARIO 1.0):\*\*

```xml

<OpenScenario>

&nbsp; <FileHeader author="dataset" date="2025-04-18T09:03:31" description="generated\_scenario" revMajor="1" revMinor="0" />

&nbsp; <RoadNetwork>

&nbsp;   <LogicFile filepath="ARG\_Carcarana-10\_1\_T-1.xodr"/>

&nbsp; </RoadNetwork>

&nbsp; <Entities>

&nbsp;   <ScenarioObject name="ego\_vehicle">

&nbsp;     <Vehicle name="vehicle.lincoln.mkz2017" vehicleCategory="car">

&nbsp;       <Performance maxSpeed="69.0" maxAcceleration="10.0" maxDeceleration="10.0"/>

&nbsp;       ...

&nbsp;     </Vehicle>

&nbsp;   </ScenarioObject>

&nbsp; </Entities>

&nbsp; <Storyboard>

&nbsp;   ...

&nbsp; </Storyboard>

</OpenScenario>

## Data Statistics

  • **Total records:* 469
  • **Average description length:** 50–100 words
  • **Average XML length:** ~1000–2000 tokens

## Validation and Quality Control

  • All XML outputs are **well-formed and schema-valid** under OpenSCENARIO 1.0 XSD.
  • Each scenario is **executable in CARLA without modifications**.

## Provenance

The dataset was constructed from and reformatted using data originating from **SCTrans**:

  • **Original dataset:** SCTrans – Constructing a Large Public Scenario Dataset for Simulation Testing of Autonomous Driving Systems
  • **Repository:** https://github.com/seclab-fudan/SCTrans
  • **Properties of the original dataset:** simulation scenario files utilizing existing traffic scenario datasets (i.e., naturalistic movement of road users recorded on public roads).

## Citation of the original dataset:


@inproceedings{SCTrans-ICSE-2024,

&nbsp;   author    = {Jiarun Dai and Bufan Gao and Mingyuan Luo and Zongan Huang and Zhongrui Li and Yuan Zhang and Min Yang},

&nbsp;   booktitle = {Proceedings of the 2024 International Conference on Software Engineering},

&nbsp;   title     = {Constructing a Large Public Scenario Dataset for Simulation Testing of Autonomous Driving Systems},

&nbsp;   year      = {2024},

}

## Citation of This Dataset

If you use this dataset in your research, please cite:


@misc{prompt2openscenario2025,

&nbsp; title        = {Empty Title},

&nbsp; author       = {No Authors},

&nbsp; year         = {2025},

&nbsp; publisher    = {Hugging Face},

&nbsp; howpublished = {\\url{https://huggingface.co/datasets/anto0699/Prompt2OpenSCENARIO-LoRA-FineTune}}

}

## License

This dataset is released under the same terms as the OpenSCENARIO 1.0 standard and inherits conditions from the SCTrans dataset.

It is intended for research and educational purposes only.

Downloads last month
4