# Convert the data to JSON format suitable for fine-tuning
import pandas as pd
# Load the CSV file to inspect its structure
file_path = 'E:/work/fintune/data/test.csv'
data = pd.read_csv(file_path)
# Display the first few rows of the data to understand its structure
data.head()
data_json = [
{
"instruction": row['text1'],
"output": row['text2']
} for _, row in data.iterrows()
]
# Save the JSON to a file
output_path = 'E:/work/fintune/data/product_descriptions.json'
import json
with open(output_path, 'w', encoding='utf-8') as f:
json.dump(data_json, f, ensure_ascii=False, indent=4)
# Output the path to the JSON file for further use
output_path