Update README.md
Browse files89 unmodified lines90919293949596979817 unmodified lines11611711811989 unmodified lines---# Overview# Dataset## Data Instances StructureAn example of a Multi-SWE-bench datum is as follows:```org: (str) - Organization name identifier from Github.17 unmodified linesinstance_id: (str) - A formatted instance identifier, usually as org__repo_PR-number.```## Usage89 unmodified lines9091929394959697989910017 unmodified lines11811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421589 unmodified lines---# OverviewWe are extremely delighted to release Multi-SWE-Bench.Multi-SWE-Bench aims to build a multi-language benchmark dataset containing real software engineering scenarios for evaluating the ability of LLM to solve real software engineering problems.The dataset supports multiple languages, currently including C, C++, Java, Javascript, Typescript, Rust, Go.# Data Instances StructureAn example of a Multi-SWE-bench datum is as follows:```org: (str) - Organization name identifier from Github.17 unmodified linesinstance_id: (str) - A formatted instance identifier, usually as org__repo_PR-number.```# UsageBecause huggingface's dataset library does not support complex nested structures,there are nested structures within these fields that have been serialized in the original dataset(huggingface),and you'll have to deserialize these if you want to use this dataset.```pythonSERIALIZATION_FIELDS = ['base', 'fixed tests', 'p2p_tests', 'f2p_tests','s2p_tests', 'n2p_tests', 'run_result','test_patch_result', 'fix_patch_result']```## sample```pythonfrom datasets import load_dataset, configimport pandas as pdimport osimport json# Constant definitions# There are nested structures within these fields, which were serialized in the original dataset, and now these need to be deserializedSERIALIZATION_FIELDS = ['base', 'fixed tests', 'p2p_tests', 'f2p_tests','s2p_tests', 'n2p_tests', 'run_result','test_patch_result', 'fix_patch_result']CACHE_DIR = 'D:/huggingface_cache'def safe_deserialize(value):"""Safely deserialize a JSON string"""try:if value in (None, ''):return Nonereturn json.loads(value)except (TypeError, json.JSONDecodeError) as e:print(f"Deserialization failed: {str(e)}")return valuedef load_hf_dataset():"""Load a HuggingFace dataset"""os.environ['HF_HOME'] = CACHE_DIRconfig.HF_DATASETS_CACHE = CACHE_DIRreturn load_dataset("Hagon/test2", split='cpp')def analyze_dataset_structure(dataset):"""Analyze and print the dataset structure"""print(f"Dataset size: {len(dataset)}")print("\nDataset structure analysis: " + "-" * 50)print("Field names and types:")for name, dtype in dataset.features.items():print(f" {name}: {str(dtype)}")def print_data_types(dataset, sample_count=3):"""Print the data types of sample data"""print(f"\nData types of the first {sample_count} samples:")for i in range(min(sample_count, len(dataset))):print(f"\nSample {i}:")for key, value in dataset[i].items():print(f" {key}: {type(value).__name__} ({len(str(value))} chars)")def analyze_serialization(dataset, sample_count=3):"""Analyze the deserialization results of fields"""print("\nDeserialization result analysis: " + "-" * 50)for i in range(min(sample_count, len(dataset))):print(f"\nSample {i}:")item = dataset[i]for key in SERIALIZATION_FIELDS:safe_key = key.replace(' ', '_')raw_value = item.get(safe_key)deserialized = safe_deserialize(raw_value)print(f"Field [{key}]:")print(f" Original type: {type(raw_value).__name__}")print(f" Deserialized type: {type(deserialized).__name__ if deserialized else 'None'}")if isinstance(deserialized, dict):sample = dict(list(deserialized.items())[:2])print(f" Sample content: {str(sample)[:200]}...")elif deserialized:print(f" Content preview: {str(deserialized)[:200]}...")else:print(" Empty/Invalid data")def main():"""Main function entry"""dataset = load_hf_dataset()# analyze_dataset_structure(dataset)# print_data_types(dataset)analyze_serialization(dataset)if __name__ == "__main__":main()```
README.md+99-3