Download commaSteeringControl.py from commaai/commaSteeringControl: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/datasets/commaai/commaSteeringControl/resolve/f5bc2fb6fc15803d4ad2d43abb2c00fa5c8e9f33/commaSteeringControl.py
- Command line
-
hf download hf://datasets/commaai/commaSteeringControl@f5bc2fb6fc15803d4ad2d43abb2c00fa5c8e9f33/commaSteeringControl.py
-
curl -L -o commaSteeringControl.py https://huggingface.co/datasets/commaai/commaSteeringControl/resolve/f5bc2fb6fc15803d4ad2d43abb2c00fa5c8e9f33/commaSteeringControl.py
1.97 kB
| import datasets | |
| import pandas as pd | |
| import pyarrow as pa | |
| PLATFORMS = ["ACURA_RDX_2020", "AUDI_A3_3RD_GEN"] | |
| _URLS = [f'https://huggingface.co/datasets/commaai/commaSteeringControl/resolve/main/data/{platform}.zip' for platform in PLATFORMS] | |
| _DESCRIPTION = "Steering controls dataset from cars running openpilot" | |
| class CommaSteeringControl(datasets.ArrowBasedBuilder): | |
| def _info(self): | |
| return datasets.DatasetInfo( | |
| description=_DESCRIPTION, | |
| features=datasets.Features( | |
| { | |
| "t": datasets.Value("float"), | |
| "latActive": datasets.Value("bool"), | |
| "steeringPressed": datasets.Value("bool"), | |
| "vEgo": datasets.Value("float"), | |
| "aEgo": datasets.Value("float"), | |
| "steeringAngleDeg": datasets.Value("float"), | |
| "steer": datasets.Value("float"), | |
| "steerFiltered": datasets.Value("float"), | |
| "roll": datasets.Value("float"), | |
| "latAccelSteeringAngle": datasets.Value("float"), | |
| "latAccelDesired": datasets.Value("float"), | |
| "latAccelLocalizer": datasets.Value("float"), | |
| "epsFwVersion": datasets.Value("string"), | |
| } | |
| ) | |
| ) | |
| def _split_generators(self, dl_manager): | |
| downloaded_files = dl_manager.download(_URLS) | |
| return [ | |
| datasets.SplitGenerator( | |
| name=PLATFORMS[i], | |
| gen_kwargs={ | |
| "files": dl_manager.iter_archive(downloaded_files[i]) | |
| } | |
| ) for i in range(len(downloaded_files)) | |
| ] | |
| def _generate_tables(self, files): | |
| for path in files: | |
| df = pd.read_csv(path[1]) | |
| pa_table = pa.Table.from_pandas(df) | |
| yield path[0], pa_table | |
| # def _get_examples_iterable_for_split(self, split_generator): | |
| # for path in split_generator.gen_kwargs['files']: | |
| # df = pandas.read_csv(path[1]) | |
| # yield path[0], df | |
| # ds = CommaSteeringControl(use_auth_token=True) | |
| # dp = ds.as_streaming_dataset(split="AUDI_A3_3RD_GEN") | |
| # for p in dp: | |
| # print(p) | |
| # break | |