Skip to main content

fixreprod

This is under review.

It is still undergoing improvement.

fixreprod is an indispensable tool to solve reproducibility problems in pseudorandom numbers by fixing all seeds and deterministic algorithms used in libraries of AI systems. The current version can take care of torch, tensorflow, gym and gymnasium with numpy, random and scipy. The program is expandable.

To run fixreprod, install it by the following command. ($) indicates the prompt from the system in the terminal.

$ pip install fixreprod

How to run fixreprod

For example, assume reinforcement_q_learning.py is a source code. Use grep command to generate test.py. test.py contains imported libraries which will be checked by fixreprod. The sed command sed '/^"""/,/^"""/d' removes comment lines from reinforcement_q_learning.py and saves it in reinfo.py. The first grep command removes comment lines with the first character of "#" from reinfo.py and save it in rein.py. The second grep command extracts imported libraries from rein.py and save it in test.py.

$ grep import reinforcement_q_learning.py >test.py

or To see the code only, run the following commands

$ sed '/^"""/,/^"""/d' reinforcement_q_learning.py >reinfo.py

$ grep -v '^#' reinfo.py >rein.py

$ grep import rein.py >test.py

Before running fixreprod, you must install all libraries used in the source code. In reinforcement_q_learning.py, gym, random, numpy, and torch must be installed.

Run fixrepdod and enter "test.py" for checking.
fixreprod will show the all seeds to be fixed to eliminate 
reproducibility problems from your code. 
9 seeds and 1 fixing deterministic algorithms are found 
  in this example.
  
$ fixreprod
Enter the source code file name: test.py
env.action_space.seed(0)
env.reset(seed=0)
np.random.seed(0)
random.Random().seed(0)
random.seed(0)
torch.Generator().manual_seed(0)        
torch.cuda.manual_seed(0)
torch.cuda.manual_seed_all(0)
torch.manual_seed(0)
torch.use_deterministic_algorithms(True)

These generated codes should be embedded in the rein.py or reinforcement_q_learning.py. The following figure shows the reproducible result. When changing seed numbers, the different reproducible result can be obtained.

Metadata

Release files for fixreprod 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fixreprod 0.0.11
File Size Uploaded Provenance
fixreprod-0.0.11.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fixreprod 0.0.11
File Interpreter ABI Platform
fixreprod-0.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / fixreprod-0.0.11.tar.gz

Download URL fixreprod-0.0.11.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cfa2e15e9081ab4448c7801831a64476fc0f599c46b2949b4b36ce43c68d98d5
BLAKE2b-256 checksum
How to use checksums
57549eb80dbdfafe389a3e1bc59480607905829c99a0cbd1b1653c37dcb5a115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.12

Release files / fixreprod-0.0.11-py3-none-any.whl

Download URL fixreprod-0.0.11-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f64a89448a946de18184e9f7699974e53c313ed724e6f09d074c34c7f8b52c93
BLAKE2b-256 checksum
How to use checksums
0baa5fce7cf0e701b68f44d11a2af2b5acf04bbf4158dc59080c66cbc7a4ff20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.12

Security for fixreprod 0.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page