benchmax 0.1.2.dev18__tar.gz → 0.1.2.dev20__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.dev18 → benchmax-0.1.2.dev20}/PKG-INFO +2 -2
  2. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/pyproject.toml +2 -2
  3. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/bundle/bundler.py +28 -0
  4. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/bundle/loader.py +14 -0
  5. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/bundle/payload.py +28 -1
  6. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax.egg-info/PKG-INFO +2 -2
  7. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax.egg-info/requires.txt +1 -1
  8. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/LICENSE +0 -0
  9. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/README.md +0 -0
  10. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/setup.cfg +0 -0
  11. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/adapters/__init__.py +0 -0
  12. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/adapters/benchmax_wrapper.py +0 -0
  13. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/adapters/skyrl/benchmax_data_process.py +0 -0
  14. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/adapters/skyrl/skyrl_adapter.py +0 -0
  15. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/bundle/__init__.py +0 -0
  16. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/bundle/errors.py +0 -0
  17. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/bundle/validator.py +0 -0
  18. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/__init__.py +0 -0
  19. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/base_env.py +0 -0
  20. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/crm/crm_env.py +0 -0
  21. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/crm/workdir/reward_fn.py +0 -0
  22. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/crm/workdir/salesforce_mcp.py +0 -0
  23. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/excel/data_utils.py +0 -0
  24. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/excel/excel_env.py +0 -0
  25. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/excel/workdir/__init__.py +0 -0
  26. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/excel/workdir/excel_code_runner_mcp.py +0 -0
  27. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/excel/workdir/excel_utils.py +0 -0
  28. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/excel/workdir/reward_fn.py +0 -0
  29. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/math/math_env.py +0 -0
  30. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/math/workdir/reward_fn.py +0 -0
  31. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/__init__.py +0 -0
  32. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/example_workdir/demo_mcp_server.py +0 -0
  33. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/example_workdir/reward_fn.py +0 -0
  34. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/parallel_mcp_env.py +0 -0
  35. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/provisioners/__init__.py +0 -0
  36. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/provisioners/base_provisioner.py +0 -0
  37. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/provisioners/local_provisioner.py +0 -0
  38. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/provisioners/manual_provisioner.py +0 -0
  39. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/provisioners/skypilot_provisioner.py +0 -0
  40. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/provisioners/utils.py +0 -0
  41. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/proxy_server.py +0 -0
  42. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/server_pool.py +0 -0
  43. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/mcp/utils.py +0 -0
  44. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/tracking.py +0 -0
  45. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/types.py +0 -0
  46. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/wikipedia/utils.py +0 -0
  47. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/envs/wikipedia/wiki_env.py +0 -0
  48. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/prompts/__init__.py +0 -0
  49. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax/prompts/tools.py +0 -0
  50. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax.egg-info/SOURCES.txt +0 -0
  51. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/src/benchmax.egg-info/dependency_links.txt +0 -0
  52. {benchmax-0.1.2.dev18 → benchmax-0.1.2.dev20}/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.dev18
3
+ Version: 0.1.2.dev20
4
4
  Summary: Framework-Agnostic RL Environments for LLM Fine-Tuning
5
5
  Author: cgft.io
6
6
  Classifier: Programming Language :: Python :: 3
@@ -12,7 +12,7 @@ Requires-Dist: aiohttp>=3.13.1
12
12
  Requires-Dist: asyncio>=4.0.0
13
13
  Requires-Dist: cloudpickle>=3.0.0
14
14
  Requires-Dist: datasets>=4.0.0
15
- Requires-Dist: expt-logger>=0.1.0.dev20
15
+ Requires-Dist: expt-logger>=0.1.0.dev22
16
16
  Provides-Extra: mcp
17
17
  Requires-Dist: fastmcp~=2.12.0; extra == "mcp"
18
18
  Requires-Dist: pyjwt>=2.10.1; extra == "mcp"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "benchmax"
3
- version = "0.1.2.dev18"
3
+ version = "0.1.2.dev20"
4
4
  description = "Framework-Agnostic RL Environments for LLM Fine-Tuning"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "cgft.io" }]
@@ -10,7 +10,7 @@ dependencies = [
10
10
  "asyncio>=4.0.0",
11
11
  "cloudpickle>=3.0.0",
12
12
  "datasets>=4.0.0",
13
- "expt-logger>=0.1.0.dev20",
13
+ "expt-logger>=0.1.0.dev22",
14
14
  ]
15
15
  classifiers = [
16
16
  "Programming Language :: Python :: 3",
@@ -136,10 +136,38 @@ def write_bundle_files(
136
136
  pickle_path.write_bytes(bundle.pickled_class)
137
137
  metadata_path.write_bytes(bundle.metadata.to_json_bytes())
138
138
 
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:
143
+ args_path = pickle_path.with_suffix(".args.pkl")
144
+ args_path.write_bytes(pickled_args)
145
+ logger.info("[bundling] Wrote pickled constructor_args to %s", args_path)
146
+
139
147
 
140
148
  def read_bundle_files(pickle_path: Path, metadata_path: Path) -> BundledEnv:
141
149
  pickle_path = Path(pickle_path)
142
150
  metadata_path = Path(metadata_path)
143
151
  pickled_class = pickle_path.read_bytes()
144
152
  metadata = BundleMetadata.from_json_bytes(metadata_path.read_bytes())
153
+
154
+ # Load pickled constructor_args if they were serialized separately.
155
+ if metadata.constructor_args_pickled:
156
+ args_pickle_path = pickle_path.with_suffix(".args.pkl")
157
+ if args_pickle_path.exists():
158
+ constructor_args = cloudpickle.loads(args_pickle_path.read_bytes())
159
+ metadata = BundleMetadata(
160
+ pip_dependencies=metadata.pip_dependencies,
161
+ python_version=metadata.python_version,
162
+ benchmax_version=metadata.benchmax_version,
163
+ constructor_args=constructor_args,
164
+ format_version=metadata.format_version,
165
+ )
166
+ logger.info("[bundling] Loaded pickled constructor_args from %s", args_pickle_path)
167
+ else:
168
+ logger.warning(
169
+ "[bundling] Metadata indicates pickled constructor_args but %s not found",
170
+ args_pickle_path,
171
+ )
172
+
145
173
  return BundledEnv(pickled_class=pickled_class, metadata=metadata)
@@ -150,6 +150,20 @@ def load_env_from_files(
150
150
  metadata_path = Path(metadata_path)
151
151
  pickled_class = pickle_path.read_bytes()
152
152
  metadata = BundleMetadata.from_json_bytes(metadata_path.read_bytes())
153
+
154
+ # If constructor_args were pickled separately, load them.
155
+ if constructor_args is None and metadata.constructor_args_pickled:
156
+ args_pickle_path = pickle_path.with_suffix(".args.pkl")
157
+ if args_pickle_path.exists():
158
+ import cloudpickle
159
+ constructor_args = cloudpickle.loads(args_pickle_path.read_bytes())
160
+ logger.info("[bundling] Loaded pickled constructor_args from %s", args_pickle_path)
161
+ else:
162
+ logger.warning(
163
+ "[bundling] Metadata indicates pickled constructor_args but %s not found",
164
+ args_pickle_path,
165
+ )
166
+
153
167
  return load_env(
154
168
  pickled_class,
155
169
  metadata,
@@ -13,6 +13,7 @@ class BundleMetadata:
13
13
  python_version: str
14
14
  benchmax_version: str
15
15
  constructor_args: Optional[Dict[str, Any]] = None
16
+ constructor_args_pickled: bool = False
16
17
  format_version: int = FORMAT_VERSION
17
18
 
18
19
  def to_dict(self) -> Dict[str, Any]:
@@ -21,11 +22,36 @@ class BundleMetadata:
21
22
  "python_version": self.python_version,
22
23
  "benchmax_version": self.benchmax_version,
23
24
  "constructor_args": self.constructor_args,
25
+ "constructor_args_pickled": self.constructor_args_pickled,
24
26
  "format_version": self.format_version,
25
27
  }
26
28
 
27
29
  def to_json_bytes(self) -> bytes:
28
- return json.dumps(self.to_dict()).encode("utf-8")
30
+ data = self.to_dict()
31
+ # constructor_args may contain non-JSON-serializable objects
32
+ # (e.g. SearchClient instances). Null them out and set the flag
33
+ # so the loader knows to look for the separate pickled args file.
34
+ if self.has_pickled_constructor_args():
35
+ data["constructor_args"] = None
36
+ data["constructor_args_pickled"] = True
37
+ return json.dumps(data).encode("utf-8")
38
+
39
+ def has_pickled_constructor_args(self) -> bool:
40
+ """True if constructor_args need separate pickle serialization."""
41
+ if self.constructor_args is None:
42
+ return False
43
+ try:
44
+ json.dumps(self.constructor_args)
45
+ return False
46
+ except TypeError:
47
+ return True
48
+
49
+ def pickled_constructor_args_bytes(self) -> bytes | None:
50
+ """Pickle constructor_args if they aren't JSON-serializable."""
51
+ if not self.has_pickled_constructor_args():
52
+ return None
53
+ import cloudpickle
54
+ return cloudpickle.dumps(self.constructor_args)
29
55
 
30
56
  @classmethod
31
57
  def from_dict(cls, data: Dict[str, Any]) -> "BundleMetadata":
@@ -34,6 +60,7 @@ class BundleMetadata:
34
60
  python_version=data.get("python_version", "unknown"),
35
61
  benchmax_version=data.get("benchmax_version", "unknown"),
36
62
  constructor_args=data.get("constructor_args"),
63
+ constructor_args_pickled=bool(data.get("constructor_args_pickled", False)),
37
64
  format_version=int(data.get("format_version", FORMAT_VERSION)),
38
65
  )
39
66
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: benchmax
3
- Version: 0.1.2.dev18
3
+ Version: 0.1.2.dev20
4
4
  Summary: Framework-Agnostic RL Environments for LLM Fine-Tuning
5
5
  Author: cgft.io
6
6
  Classifier: Programming Language :: Python :: 3
@@ -12,7 +12,7 @@ Requires-Dist: aiohttp>=3.13.1
12
12
  Requires-Dist: asyncio>=4.0.0
13
13
  Requires-Dist: cloudpickle>=3.0.0
14
14
  Requires-Dist: datasets>=4.0.0
15
- Requires-Dist: expt-logger>=0.1.0.dev20
15
+ Requires-Dist: expt-logger>=0.1.0.dev22
16
16
  Provides-Extra: mcp
17
17
  Requires-Dist: fastmcp~=2.12.0; extra == "mcp"
18
18
  Requires-Dist: pyjwt>=2.10.1; extra == "mcp"
@@ -2,7 +2,7 @@ aiohttp>=3.13.1
2
2
  asyncio>=4.0.0
3
3
  cloudpickle>=3.0.0
4
4
  datasets>=4.0.0
5
- expt-logger>=0.1.0.dev20
5
+ expt-logger>=0.1.0.dev22
6
6
 
7
7
  [mcp]
8
8
  fastmcp~=2.12.0
File without changes
File without changes
File without changes