Skip to content

Release 0.2 refactor qorc update + some high level modifs#50

Open
v-espitalier wants to merge 10 commits intomerlinquantum:release-0.2-refactorfrom
v-espitalier:release-0.2-refactor_qorc_update
Open

Release 0.2 refactor qorc update + some high level modifs#50
v-espitalier wants to merge 10 commits intomerlinquantum:release-0.2-refactorfrom
v-espitalier:release-0.2-refactor_qorc_update

Conversation

@v-espitalier
Copy link
Contributor

@v-espitalier v-espitalier commented Jan 27, 2026

Reproduced papers / Qorc update :

  • Update code for MerLin v0.2
  • Fix for remote processor
  • Move Qorc data functions
  • Fix for Qorc and RFF looping (seed -> run_seed)
  • other minor fixes

High level modifs :

  • Log lib versions
  • move '--config' definition at the end of gloabl_cli.json (So that it is more visible in the cli help).

"seed" : 42,
"n_photons" : 3,
"n_modes" : 20,
"run_seed" : 42,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let us keep a ticket to remember to fix that more generally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the QORC paper reproduction code to support MerLin v0.2, including API changes, bug fixes, and improvements to the development workflow. The changes include updating the MerLin API calls to use the new measurement_strategy parameter instead of output_mapping_strategy, fixing the remote processor interface, reorganizing dataset utility functions, and standardizing the seed parameter naming from seed to run_seed.

Changes:

  • Updated MerLin API to v0.2 with new measurement strategy and parameter requirements (including Pi factor multiplication)
  • Fixed remote processor API call (renamed max_batch_size to microbatch_size)
  • Moved dataset utility functions from shared to local module
  • Renamed seed parameter to run_seed throughout configuration files and runner code
  • Added library version logging for Python, Perceval, and MerLin
  • Improved CLI usability by moving --config flag to end of help output
  • Translated French comments to English in remote processor module

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
runtime_lib/runtime.py Adds version logging for Python, Perceval, and MerLin libraries
runtime_lib/global_cli.json Moves --config argument to end for better visibility in CLI help
papers/shared/QORC/datasets.py Removes dataset utility functions (moved to local module), reorganizes imports
papers/QORC/requirements.txt Adds minimum version constraint for merlinquantum (>=0.2.0)
papers/QORC/lib/runner.py Renames seed to run_seed, fixes loop variable naming, adds new parameters for dataset and QPU device
papers/QORC/lib/lib_rff_encoding_and_linear_training.py Adds accuracy logging statements
papers/QORC/lib/lib_remote_qorc.py Translates French comments to English, updates API call from max_batch_size to microbatch_size
papers/QORC/lib/lib_qorc_encoding_and_linear_training.py Updates MerLin API to v0.2 (removes output_size, replaces output_mapping_strategy with measurement_strategy), adds Pi factor multiplication for input tensors
papers/QORC/lib/lib_datasets.py Moves dataset utility functions from shared module to local implementation
papers/QORC/configs/xp_rff.json Renames seed to run_seed
papers/QORC/configs/xp_qorc.json Renames seed to run_seed
papers/QORC/configs/defaults.json Renames seed to run_seed, updates default values for n_photons and n_modes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

device_name = "cpu"
input_size = (
n_modes - 1
) # Nb input features = 11 pour ascella (le premier mode n'a pas de PS)
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment contains French text that should be translated to English for consistency with the rest of the codebase. The comment should read: "Nb input features = 11 for ascella (the first mode doesn't have a PS)"

Suggested change
) # Nb input features = 11 pour ascella (le premier mode n'a pas de PS)
) # Nb input features = 11 for ascella (the first mode doesn't have a PS)

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +7
"n_photons" : 3,
"n_modes" : 20,
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default values for n_photons and n_modes have been changed (n_photons from 2 to 3, n_modes from 10 to 20). While this might be intentional for the v0.2 update, please verify these are the intended default values, as they will affect the behavior of experiments that don't explicitly specify these parameters.

Copilot uses AI. Check for mistakes.
@jsenellart
Copy link
Contributor

is the code working on the cloud through MerlinProcessor?

@v-espitalier
Copy link
Contributor Author

v-espitalier commented Jan 28, 2026

is the code working on the cloud through MerlinProcessor?

It was recently tested for sim:ascella, so should be good for qpu:ascella too.
sim:belenos was tested during initial implementation (with MerLin v1.0).
We noticed a possible bug with "sim:slos" remote processor (on MerLin's side) to be investigated by the team.

Copy link
Contributor

@ben9871 ben9871 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the notebook also does not run without adding a cell such as this since the repo notebook is below runtime lib and implementations.
I think it should run easily for the user if they installed the requirements so I'd recommend making sure the path is correct or having some stuff directly in the notebook

"import sys
from pathlib import Path

p = Path.cwd().resolve()

Walk up until we find a directory that contains runtime_lib/

for parent in [p] + list(p.parents):
if (parent / "runtime_lib").is_dir():
sys.path.insert(0, str(parent))
break
else:
raise RuntimeError("Could not find a parent directory containing 'runtime_lib/'")

print("Using workspace root:", parent)
print("runtime_lib found at:", (parent / "runtime_lib").resolve())"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the configs are currently running multiple versions of the same model in order to make the comparison. While this is economical, the rule is to have 1 config PER run. The figures from the paper are then to be reproduced using .sh files that recombine these

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. one config per run

@ben9871
Copy link
Contributor

ben9871 commented Feb 4, 2026

is the code working on the cloud through MerlinProcessor?

It was recently tested for sim:ascella, so should be good for qpu:ascella too. sim:belenos was tested during initial implementation (with MerLin v1.0). We noticed a possible bug with "sim:slos" remote processor (on MerLin's side) to be investigated by the team.

To be investigated. will comment further on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants