benchmax 0.1.2.dev21__tar.gz → 0.1.2.dev22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/PKG-INFO +1 -1
  2. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/pyproject.toml +1 -1
  3. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/bundle/bundler.py +7 -20
  4. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/bundle/payload.py +0 -1
  5. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/bundle/validator.py +6 -20
  6. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/base_env.py +9 -0
  7. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax.egg-info/PKG-INFO +1 -1
  8. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/LICENSE +0 -0
  9. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/README.md +0 -0
  10. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/setup.cfg +0 -0
  11. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/adapters/__init__.py +0 -0
  12. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/adapters/benchmax_wrapper.py +0 -0
  13. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/adapters/skyrl/benchmax_data_process.py +0 -0
  14. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/adapters/skyrl/skyrl_adapter.py +0 -0
  15. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/bundle/__init__.py +0 -0
  16. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/bundle/errors.py +0 -0
  17. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/bundle/loader.py +0 -0
  18. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/__init__.py +0 -0
  19. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/crm/crm_env.py +0 -0
  20. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/crm/workdir/reward_fn.py +0 -0
  21. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/crm/workdir/salesforce_mcp.py +0 -0
  22. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/excel/data_utils.py +0 -0
  23. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/excel/excel_env.py +0 -0
  24. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/excel/workdir/__init__.py +0 -0
  25. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/excel/workdir/excel_code_runner_mcp.py +0 -0
  26. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/excel/workdir/excel_utils.py +0 -0
  27. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/excel/workdir/reward_fn.py +0 -0
  28. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/math/math_env.py +0 -0
  29. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/math/workdir/reward_fn.py +0 -0
  30. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/__init__.py +0 -0
  31. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/example_workdir/demo_mcp_server.py +0 -0
  32. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/example_workdir/reward_fn.py +0 -0
  33. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/parallel_mcp_env.py +0 -0
  34. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/provisioners/__init__.py +0 -0
  35. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/provisioners/base_provisioner.py +0 -0
  36. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/provisioners/local_provisioner.py +0 -0
  37. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/provisioners/manual_provisioner.py +0 -0
  38. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/provisioners/skypilot_provisioner.py +0 -0
  39. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/provisioners/utils.py +0 -0
  40. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/proxy_server.py +0 -0
  41. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/server_pool.py +0 -0
  42. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/mcp/utils.py +0 -0
  43. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/tracking.py +0 -0
  44. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/types.py +0 -0
  45. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/wikipedia/utils.py +0 -0
  46. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/envs/wikipedia/wiki_env.py +0 -0
  47. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/prompts/__init__.py +0 -0
  48. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax/prompts/tools.py +0 -0
  49. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax.egg-info/SOURCES.txt +0 -0
  50. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax.egg-info/dependency_links.txt +0 -0
  51. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax.egg-info/requires.txt +0 -0
  52. {benchmax-0.1.2.dev21 → benchmax-0.1.2.dev22}/src/benchmax.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: benchmax
3
- Version: 0.1.2.dev21
3
+ Version: 0.1.2.dev22
4
4
  Summary: Framework-Agnostic RL Environments for LLM Fine-Tuning
5
5
  Author: cgft.io
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "benchmax"
3
- version = "0.1.2.dev21"
3
+ version = "0.1.2.dev22"
4
4
  description = "Framework-Agnostic RL Environments for LLM Fine-Tuning"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "cgft.io" }]
@@ -70,18 +70,9 @@ def bundle_env(
70
70
  f"{mod.__name__}"
71
71
  )
72
72
 
73
- # --- Serialize the class AND constructor_args while modules are registered ---
74
- pickled_constructor_args: bytes | None = None
73
+ # --- Serialize the class ---
75
74
  try:
76
75
  pickled_class = cloudpickle.dumps(env_class)
77
- # Pickle constructor_args now (while local_modules are registered)
78
- # so non-JSON-serializable objects get pickled by value.
79
- if constructor_args is not None:
80
- try:
81
- import json
82
- json.dumps(constructor_args)
83
- except TypeError:
84
- pickled_constructor_args = cloudpickle.dumps(constructor_args)
85
76
  except Exception as e:
86
77
  raise BundlingError(
87
78
  f"Failed to serialize {env_class.__name__} with cloudpickle: {e}"
@@ -108,13 +99,8 @@ def bundle_env(
108
99
  python_version=python_version,
109
100
  benchmax_version=benchmax_version,
110
101
  constructor_args=constructor_args,
111
- constructor_args_pickled=pickled_constructor_args is not None,
112
- )
113
- payload = BundledEnv(
114
- pickled_class=pickled_class,
115
- metadata=metadata,
116
- pickled_constructor_args=pickled_constructor_args,
117
102
  )
103
+ payload = BundledEnv(pickled_class=pickled_class, metadata=metadata)
118
104
 
119
105
  size_kb = len(pickled_class) / 1024
120
106
  logger.info(
@@ -150,11 +136,12 @@ def write_bundle_files(
150
136
  pickle_path.write_bytes(bundle.pickled_class)
151
137
  metadata_path.write_bytes(bundle.metadata.to_json_bytes())
152
138
 
153
- # Write pre-pickled constructor_args (pickled during bundling while
154
- # local_modules were registered, so module code is inline).
155
- if bundle.pickled_constructor_args is not None:
139
+ # Write pickled constructor_args alongside the class pickle
140
+ # when they contain non-JSON-serializable objects (e.g. SearchClient).
141
+ pickled_args = bundle.metadata.pickled_constructor_args_bytes()
142
+ if pickled_args is not None:
156
143
  args_path = pickle_path.with_suffix(".args.pkl")
157
- args_path.write_bytes(bundle.pickled_constructor_args)
144
+ args_path.write_bytes(pickled_args)
158
145
  logger.info("[bundling] Wrote pickled constructor_args to %s", args_path)
159
146
 
160
147
 
@@ -75,4 +75,3 @@ class BundledEnv:
75
75
 
76
76
  pickled_class: bytes
77
77
  metadata: BundleMetadata
78
- pickled_constructor_args: Optional[bytes] = None
@@ -35,8 +35,7 @@ def validate_bundle(
35
35
  if constructor_args is None:
36
36
  constructor_args = bundle.metadata.constructor_args
37
37
  return _run_isolated_validation(
38
- bundle.pickled_class, bundle.metadata, constructor_args,
39
- pickled_constructor_args=bundle.pickled_constructor_args,
38
+ bundle.pickled_class, bundle.metadata, constructor_args
40
39
  )
41
40
 
42
41
 
@@ -111,7 +110,6 @@ def _run_isolated_validation(
111
110
  pickled_class: bytes,
112
111
  metadata: BundleMetadata,
113
112
  constructor_args: Optional[Dict[str, Any]],
114
- pickled_constructor_args: Optional[bytes] = None,
115
113
  ) -> List[str]:
116
114
  """Create a temp venv, install deps, unpickle the bundle, and smoke test.
117
115
 
@@ -194,30 +192,18 @@ def _run_isolated_validation(
194
192
  with open(pickle_path, "wb") as f:
195
193
  f.write(pickled_class)
196
194
 
197
- # 5. Write constructor args as pickle (handles non-JSON-serializable objects)
198
- args_pickle_path = os.path.join(venv_dir, "constructor_args.pkl")
199
- if pickled_constructor_args is not None:
200
- # Use pre-pickled args (pickled during bundling with modules registered)
201
- with open(args_pickle_path, "wb") as f:
202
- f.write(pickled_constructor_args)
203
- elif constructor_args is not None:
204
- import cloudpickle as _cp
205
- with open(args_pickle_path, "wb") as f:
206
- _cp.dump(constructor_args, f)
207
-
208
- # 6. Write and run smoke test script using cloudpickle directly
195
+ # 5. Write and run smoke test script using cloudpickle directly
196
+ constructor_args_json = json.dumps(constructor_args) if constructor_args else "null"
209
197
  smoke_script = textwrap.dedent(f"""\
210
- import os
198
+ import json
211
199
  import asyncio
212
200
  import cloudpickle
213
201
 
214
202
  with open({pickle_path!r}, "rb") as f:
215
203
  env_class = cloudpickle.load(f)
216
204
 
217
- args_path = {args_pickle_path!r}
218
- if os.path.exists(args_path):
219
- with open(args_path, "rb") as f:
220
- constructor_args = cloudpickle.load(f)
205
+ constructor_args = json.loads({constructor_args_json!r})
206
+ if constructor_args is not None:
221
207
  instance = env_class(**constructor_args)
222
208
  tools = asyncio.run(instance.list_tools())
223
209
  asyncio.run(instance.shutdown())
@@ -38,6 +38,15 @@ class BaseEnv(ABC):
38
38
 
39
39
  self.compute_reward = _tracked
40
40
 
41
+ cls_compute_group_reward = type(self).compute_group_reward
42
+
43
+ @wraps(cls_compute_group_reward)
44
+ async def _tracked_group(*args, **kwargs):
45
+ with tracking_context(self._tracking_config):
46
+ return await cls_compute_group_reward(self, *args, **kwargs)
47
+
48
+ self.compute_group_reward = _tracked_group
49
+
41
50
  def get_tracking_config(self) -> Optional[TrackingConfig]:
42
51
  return self._tracking_config
43
52
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: benchmax
3
- Version: 0.1.2.dev21
3
+ Version: 0.1.2.dev22
4
4
  Summary: Framework-Agnostic RL Environments for LLM Fine-Tuning
5
5
  Author: cgft.io
6
6
  Classifier: Programming Language :: Python :: 3
File without changes
File without changes
File without changes