YUNTA88 commited on
Commit
26d786a
·
verified ·
1 Parent(s): 62cbd63

Upload root_scripts/fix_parquet.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. root_scripts/fix_parquet.py +44 -0
root_scripts/fix_parquet.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import pandas as pd
3
+
4
+ path = "/workspace/rl4phyx/RL4Phyx/ZeroSearch/One-Shot-RLVR/data/train/physics_vlm/mechanics/mechanics_1_rl_numerical.parquet"
5
+ df = pd.read_parquet(path)
6
+
7
+ # Build a clean open-ended prompt from scratch
8
+ open_ended_prompt = """Look at the image and answer the physics question.
9
+
10
+ A patient with a dislocated shoulder is put into a traction apparatus as shown in figure. The pulls A and B have equal magnitudes and must combine to produce an outward traction force of 12.8 N on the patient's arm.
11
+
12
+ Question: How large should these pulls be?
13
+
14
+ Please reason step by step and put your final numerical answer (with units) in \\boxed{}."""
15
+
16
+ # Rebuild all rows with clean prompt
17
+ new_rows = []
18
+ for i, row in df.iterrows():
19
+ r = {
20
+ "data_source": row["data_source"],
21
+ "prompt": [{"content": open_ended_prompt, "role": "user"}],
22
+ "ability": row["ability"],
23
+ "reward_model": row["reward_model"], # keeps {'ground_truth': '7.55N', 'style': 'rule'}
24
+ "extra_info": row["extra_info"],
25
+ }
26
+ new_rows.append(r)
27
+
28
+ new_df = pd.DataFrame(new_rows)
29
+ new_df.to_parquet(path, index=False)
30
+
31
+ # Verify
32
+ df2 = pd.read_parquet(path)
33
+ print("Shape:", df2.shape)
34
+ print("Columns:", list(df2.columns))
35
+ print()
36
+ print("Prompt:")
37
+ print(df2.iloc[0]["prompt"][0]["content"])
38
+ print()
39
+ print("reward_model:", df2.iloc[0]["reward_model"])
40
+ print("extra_info:", df2.iloc[0]["extra_info"])
41
+ print()
42
+ has_options = "Options" in df2.iloc[0]["prompt"][0]["content"]
43
+ print("Has Options:", has_options)
44
+ print("DONE!")