fix: support default_rng() across the flopscope client/server boundary#109
Merged
Conversation
default_rng() returned a numpy Generator the server could not serialize
("failed to serialize response: TypeError"), so every estimator using the
documented seeding scaffold (self._setup_rng = fnp.random.default_rng(...))
failed grading with SETUP_FAILED.
Add a RemoteGenerator handle, mirroring RemoteArray: the server stores the
Generator and returns {"gen_id": handle}; the client wraps it and dispatches
Generator.<method> ops back, so sampling runs + advances server-side
(deterministic per seed, bit-identical to numpy, FLOP-counted).
This was referenced Jun 1, 2026
spMohanty
added a commit
to AIcrowd/whestbench
that referenced
this pull request
Jun 1, 2026
flopscope 0.4.2 fixes fnp.random.default_rng() over the client/server grader boundary (AIcrowd/flopscope#109). Floor kept at flopscope>=0.4.1 so the lock stays resolvable before 0.4.2 is published.
05330d9 to
d92c3ad
Compare
14ba0d1 to
d92c3ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fnp.random.default_rng(seed)returned a numpyGeneratorthe server could not serialize (failed to serialize response: TypeError), so every estimator using the documented seeding scaffold (self._setup_rng = fnp.random.default_rng(...)) failed grading withSETUP_FAILED— surfacing to participants as a generic "Evaluation error".Adds a
RemoteGeneratorhandle mirroringRemoteArray:Session.store_generator/get_generator;_pack_resultreturns{"gen_id": handle}for anp.random.Generator;Generator.<method>ops dispatch to the stored generator (method-allowlisted via_ALLOWED_GEN_METHODS);_resolve_arglearns{"__gen__": h};validate_requestletsGenerator.*through.RemoteGeneratorproxy (uniform,standard_normal,integers,normal,random, …) dispatchingGenerator.<method>back;_result_from_response/_encode_argwired.Bumps
0.4.1 → 0.4.2(patch) across allversion_files— stays within the evaluator'sflopscope-client>=0.4.1,<0.5pin.Test plan
flopscope-client/tests/test_remote_generator_integration.py:default_rng().uniform(...)over the boundary + reproducibilitystandard_normal/uniformbit-identical tonumpy.random.default_rngscripts/check_version_sync.py→ all 8 locations 0.4.2test_full_integration.py(34 passed) + root suite (0 failed)_ALLOWED_GEN_METHODScovers the RNG surface participants needFound while E2E-testing the starter-kit examples via
whest submit(failed submission 309632). Does not tag/publish — release is gated.