qxmt 0.0.0__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.
- qxmt-0.0.0/LICENSE +21 -0
- qxmt-0.0.0/PKG-INFO +149 -0
- qxmt-0.0.0/README.md +123 -0
- qxmt-0.0.0/pyproject.toml +50 -0
- qxmt-0.0.0/qxmt/__init__.py +45 -0
- qxmt-0.0.0/qxmt/configs.py +70 -0
- qxmt-0.0.0/qxmt/constants.py +24 -0
- qxmt-0.0.0/qxmt/datasets/__init__.py +7 -0
- qxmt-0.0.0/qxmt/datasets/builder.py +233 -0
- qxmt-0.0.0/qxmt/datasets/dummy/__init__.py +5 -0
- qxmt-0.0.0/qxmt/datasets/dummy/linear.py +26 -0
- qxmt-0.0.0/qxmt/datasets/raw_preprocess/__init__.py +0 -0
- qxmt-0.0.0/qxmt/datasets/raw_preprocess/sampling.py +22 -0
- qxmt-0.0.0/qxmt/datasets/schema.py +32 -0
- qxmt-0.0.0/qxmt/datasets/transform/__init__.py +0 -0
- qxmt-0.0.0/qxmt/datasets/transform/reduction_by_pca.py +37 -0
- qxmt-0.0.0/qxmt/decorators.py +10 -0
- qxmt-0.0.0/qxmt/devices/__init__.py +5 -0
- qxmt-0.0.0/qxmt/devices/base.py +32 -0
- qxmt-0.0.0/qxmt/devices/builder.py +23 -0
- qxmt-0.0.0/qxmt/devices/device_info.py +40 -0
- qxmt-0.0.0/qxmt/evaluation/__init__.py +12 -0
- qxmt-0.0.0/qxmt/evaluation/base.py +54 -0
- qxmt-0.0.0/qxmt/evaluation/defaults.py +68 -0
- qxmt-0.0.0/qxmt/evaluation/evaluation.py +131 -0
- qxmt-0.0.0/qxmt/exceptions.py +42 -0
- qxmt-0.0.0/qxmt/experiment/__init__.py +4 -0
- qxmt-0.0.0/qxmt/experiment/experiment.py +528 -0
- qxmt-0.0.0/qxmt/experiment/schema.py +31 -0
- qxmt-0.0.0/qxmt/feature_maps/__init__.py +3 -0
- qxmt-0.0.0/qxmt/feature_maps/base.py +68 -0
- qxmt-0.0.0/qxmt/feature_maps/pennylane/__init__.py +15 -0
- qxmt-0.0.0/qxmt/feature_maps/pennylane/defaults.py +81 -0
- qxmt-0.0.0/qxmt/generators/__init__.py +5 -0
- qxmt-0.0.0/qxmt/generators/description.py +71 -0
- qxmt-0.0.0/qxmt/generators/prompts.py +21 -0
- qxmt-0.0.0/qxmt/kernels/__init__.py +3 -0
- qxmt-0.0.0/qxmt/kernels/base.py +153 -0
- qxmt-0.0.0/qxmt/kernels/pennylane/__init__.py +5 -0
- qxmt-0.0.0/qxmt/kernels/pennylane/fidelity_kernel.py +38 -0
- qxmt-0.0.0/qxmt/logger.py +11 -0
- qxmt-0.0.0/qxmt/models/__init__.py +10 -0
- qxmt-0.0.0/qxmt/models/base.py +121 -0
- qxmt-0.0.0/qxmt/models/builder.py +81 -0
- qxmt-0.0.0/qxmt/models/qsvm.py +35 -0
- qxmt-0.0.0/qxmt/types.py +6 -0
- qxmt-0.0.0/qxmt/utils/__init__.py +21 -0
- qxmt-0.0.0/qxmt/utils/github.py +117 -0
- qxmt-0.0.0/qxmt/utils/yaml.py +102 -0
- qxmt-0.0.0/qxmt/visualization/__init__.py +14 -0
- qxmt-0.0.0/qxmt/visualization/graph_settings.py +9 -0
- qxmt-0.0.0/qxmt/visualization/plot_dataset.py +75 -0
- qxmt-0.0.0/qxmt/visualization/plot_metrics.py +126 -0
- qxmt-0.0.0/qxmt/visualization/plot_model_performance.py +172 -0
qxmt-0.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 kenya-sk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
qxmt-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: qxmt
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: QXMT is a experiment management tool for quantum computing and quantum machine learning.
|
|
5
|
+
Home-page: https://github.com/kenya-sk/qxmt
|
|
6
|
+
License: MIT
|
|
7
|
+
Author: kenya-sk
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Provides-Extra: llm
|
|
14
|
+
Requires-Dist: dill (>=0.3.8,<0.4.0)
|
|
15
|
+
Requires-Dist: matplotlib (>=3.9.1,<4.0.0)
|
|
16
|
+
Requires-Dist: pandas (>=2.2.2,<3.0.0)
|
|
17
|
+
Requires-Dist: pennylane (>=0.37.0,<0.38.0)
|
|
18
|
+
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
|
|
19
|
+
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
20
|
+
Requires-Dist: scikit-learn (>=1.5.1,<2.0.0)
|
|
21
|
+
Requires-Dist: torch (>=2.4.0,<3.0.0) ; extra == "llm"
|
|
22
|
+
Requires-Dist: transformers (>=4.44.2,<5.0.0) ; extra == "llm"
|
|
23
|
+
Project-URL: Repository, https://github.com/kenya-sk/qxmt
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# QXMT: Quantum Experiment Management Tool
|
|
27
|
+

|
|
28
|
+
[](https://github.com/kenya-sk/qxmt/actions/workflows/unit_tests_llm.yaml)
|
|
29
|
+
[](https://kenya-sk.github.io/qxmt/)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
QXMT is an open-source experiment management tool for quantum machine learning. The development focus is on low-cost experiment management and ensuring reproducibility. For low-cost management, the goal is to minimize the implementation code required for managing experiments, allowing developers and researchers to focus solely on new experimental implementations. To ensure reproducibility, QXMT manages experimental information as configuration file, enabling not only the original developer but also collaborators to reproduce the same experimental results without investing significant time.
|
|
33
|
+
|
|
34
|
+
QXMT provides several datasets, machine learning models, and visualization methods to facilitate experiment management. By combining these, users can not only avoid developing the entire workflow themselves but also ensure that many people can evaluate their experiments based on the same standards. These default features will be continuously expanded in future development.
|
|
35
|
+
|
|
36
|
+
### Limitation
|
|
37
|
+
QXMT is newly released, and the available features are still limited. The quantum libraries and devices that have been tested are listed below. For future development plans, please refer to the roadmap. Even in environments not listed below, you can manage experiments by implementing according to the interfaces provided by QXMT. For details on how to implement, please refer to the documentation.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
| Quantum Library | Simulator | Real Machine |
|
|
41
|
+
|---------------------|-----------|--------------|
|
|
42
|
+
|<p align="center">[pennylane](https://github.com/PennyLaneAI/pennylane)</p>|<p align="center">✅</p>|<p align="center">❌</p>|
|
|
43
|
+
|<p align="center">[Qulacs](https://github.com/qulacs/qulacs)</p> |<p align="center">❌</p>|<p align="center">❌</p>|
|
|
44
|
+
|<p align="center">[Qiskit](https://github.com/Qiskit/qiskit)</p> |<p align="center">❌</p>|<p align="center">❌</p>|
|
|
45
|
+
|<p align="center">[Cirq](https://github.com/quantumlib/Cirq)</p> |<p align="center">❌</p>|<p align="center">❌</p>|
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
<!--
|
|
50
|
+
QXMT is tested and supported on 64-bit systems with:
|
|
51
|
+
- Python 3.11
|
|
52
|
+
- macOS 14.6.1 or later
|
|
53
|
+
-->
|
|
54
|
+
|
|
55
|
+
You can install QXMT with Python's pip package manager:
|
|
56
|
+
```bash
|
|
57
|
+
pip install qxmt
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
When installing QXMT, you have the option to enable the LLM functionality. By default, it is not installed. By enabling the LLM feature, you can automatically generate experiment summaries based on code differences. If needed, please install it using the following command:
|
|
61
|
+
```bash
|
|
62
|
+
pip install qxmt[llm]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Tool Overview
|
|
66
|
+
QXMT manages experiments in the following folder structure.
|
|
67
|
+
```bash
|
|
68
|
+
<your_project>
|
|
69
|
+
├── data
|
|
70
|
+
├── configs
|
|
71
|
+
│ ├── config_1.yaml
|
|
72
|
+
│ ├── ⋮
|
|
73
|
+
│ └── config_n.yaml
|
|
74
|
+
└── experiments
|
|
75
|
+
├── <your_experiment_1>
|
|
76
|
+
│ ├── experiment.json
|
|
77
|
+
│ ├── run_1
|
|
78
|
+
│ │ └── model.pkl
|
|
79
|
+
│ ├── run_2
|
|
80
|
+
│ ├── ⋮
|
|
81
|
+
│ └── run_n
|
|
82
|
+
│ ⋮
|
|
83
|
+
└── <your_experiment_n>
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Keywords
|
|
88
|
+
- **data**: Stores raw data used in experiments
|
|
89
|
+
- **configs**: Stores yaml files related to the configuration of the experiment to be each run
|
|
90
|
+
- **experiments**: Stores experimental results
|
|
91
|
+
- A folder is automatically created for each name set at the start of the experiment.
|
|
92
|
+
- Each experiment folder consists of experiment.json and a folder to manage each run.
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## Getting Started
|
|
96
|
+
### 1. Start new experiment
|
|
97
|
+
```python
|
|
98
|
+
import qxmt
|
|
99
|
+
|
|
100
|
+
# initialize experiment setting
|
|
101
|
+
exp = qxmt.Experiment(
|
|
102
|
+
name="operation_check", # set your experiment name
|
|
103
|
+
desc="operation check of experiment package", # set your experiment description
|
|
104
|
+
auto_gen_mode=False, # if True, each experimental description is automatically generated by LLM
|
|
105
|
+
).init()
|
|
106
|
+
|
|
107
|
+
# run experiment. each experiment defined in config file or instance
|
|
108
|
+
# run from config
|
|
109
|
+
artifact, result = exp.run(config_source="configs/baseline.yaml")
|
|
110
|
+
# run from instance
|
|
111
|
+
artifact, result = exp.run(dataset=your_dataset, model=your_model)
|
|
112
|
+
|
|
113
|
+
# get instance of each experiment artifact
|
|
114
|
+
dataset = artufact.dataset
|
|
115
|
+
model = artifact.model
|
|
116
|
+
|
|
117
|
+
# output result
|
|
118
|
+
# result table convert to pandas dataframe
|
|
119
|
+
exp.runs_to_dataframe()
|
|
120
|
+
|
|
121
|
+
# visualization (Below are some of the features. See documentation for details.)
|
|
122
|
+
model.plot_train_test_kernel_matrix(dataset.X_train, dataset.X_test, n_jobs=5)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 2. Load existing experiment
|
|
126
|
+
```python
|
|
127
|
+
# load existing experiment from json file
|
|
128
|
+
exp = qxmt.Experiment().load_experiment(
|
|
129
|
+
"experiments/operation_check/experiment.json")
|
|
130
|
+
|
|
131
|
+
# reproduction target run artifact
|
|
132
|
+
reproduction_model = exp.reproduce(run_id=1)
|
|
133
|
+
|
|
134
|
+
# run new experiment
|
|
135
|
+
artifact, result = exp.run(config_source="configs/best_params.yaml")
|
|
136
|
+
|
|
137
|
+
# output result
|
|
138
|
+
exp.runs_to_dataframe()
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
<!--
|
|
143
|
+
## Documentation
|
|
144
|
+
-->
|
|
145
|
+
|
|
146
|
+
<!--
|
|
147
|
+
## Contributing
|
|
148
|
+
-->
|
|
149
|
+
|
qxmt-0.0.0/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# QXMT: Quantum Experiment Management Tool
|
|
2
|
+

|
|
3
|
+
[](https://github.com/kenya-sk/qxmt/actions/workflows/unit_tests_llm.yaml)
|
|
4
|
+
[](https://kenya-sk.github.io/qxmt/)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
QXMT is an open-source experiment management tool for quantum machine learning. The development focus is on low-cost experiment management and ensuring reproducibility. For low-cost management, the goal is to minimize the implementation code required for managing experiments, allowing developers and researchers to focus solely on new experimental implementations. To ensure reproducibility, QXMT manages experimental information as configuration file, enabling not only the original developer but also collaborators to reproduce the same experimental results without investing significant time.
|
|
8
|
+
|
|
9
|
+
QXMT provides several datasets, machine learning models, and visualization methods to facilitate experiment management. By combining these, users can not only avoid developing the entire workflow themselves but also ensure that many people can evaluate their experiments based on the same standards. These default features will be continuously expanded in future development.
|
|
10
|
+
|
|
11
|
+
### Limitation
|
|
12
|
+
QXMT is newly released, and the available features are still limited. The quantum libraries and devices that have been tested are listed below. For future development plans, please refer to the roadmap. Even in environments not listed below, you can manage experiments by implementing according to the interfaces provided by QXMT. For details on how to implement, please refer to the documentation.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
| Quantum Library | Simulator | Real Machine |
|
|
16
|
+
|---------------------|-----------|--------------|
|
|
17
|
+
|<p align="center">[pennylane](https://github.com/PennyLaneAI/pennylane)</p>|<p align="center">✅</p>|<p align="center">❌</p>|
|
|
18
|
+
|<p align="center">[Qulacs](https://github.com/qulacs/qulacs)</p> |<p align="center">❌</p>|<p align="center">❌</p>|
|
|
19
|
+
|<p align="center">[Qiskit](https://github.com/Qiskit/qiskit)</p> |<p align="center">❌</p>|<p align="center">❌</p>|
|
|
20
|
+
|<p align="center">[Cirq](https://github.com/quantumlib/Cirq)</p> |<p align="center">❌</p>|<p align="center">❌</p>|
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
<!--
|
|
25
|
+
QXMT is tested and supported on 64-bit systems with:
|
|
26
|
+
- Python 3.11
|
|
27
|
+
- macOS 14.6.1 or later
|
|
28
|
+
-->
|
|
29
|
+
|
|
30
|
+
You can install QXMT with Python's pip package manager:
|
|
31
|
+
```bash
|
|
32
|
+
pip install qxmt
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
When installing QXMT, you have the option to enable the LLM functionality. By default, it is not installed. By enabling the LLM feature, you can automatically generate experiment summaries based on code differences. If needed, please install it using the following command:
|
|
36
|
+
```bash
|
|
37
|
+
pip install qxmt[llm]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Tool Overview
|
|
41
|
+
QXMT manages experiments in the following folder structure.
|
|
42
|
+
```bash
|
|
43
|
+
<your_project>
|
|
44
|
+
├── data
|
|
45
|
+
├── configs
|
|
46
|
+
│ ├── config_1.yaml
|
|
47
|
+
│ ├── ⋮
|
|
48
|
+
│ └── config_n.yaml
|
|
49
|
+
└── experiments
|
|
50
|
+
├── <your_experiment_1>
|
|
51
|
+
│ ├── experiment.json
|
|
52
|
+
│ ├── run_1
|
|
53
|
+
│ │ └── model.pkl
|
|
54
|
+
│ ├── run_2
|
|
55
|
+
│ ├── ⋮
|
|
56
|
+
│ └── run_n
|
|
57
|
+
│ ⋮
|
|
58
|
+
└── <your_experiment_n>
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Keywords
|
|
63
|
+
- **data**: Stores raw data used in experiments
|
|
64
|
+
- **configs**: Stores yaml files related to the configuration of the experiment to be each run
|
|
65
|
+
- **experiments**: Stores experimental results
|
|
66
|
+
- A folder is automatically created for each name set at the start of the experiment.
|
|
67
|
+
- Each experiment folder consists of experiment.json and a folder to manage each run.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Getting Started
|
|
71
|
+
### 1. Start new experiment
|
|
72
|
+
```python
|
|
73
|
+
import qxmt
|
|
74
|
+
|
|
75
|
+
# initialize experiment setting
|
|
76
|
+
exp = qxmt.Experiment(
|
|
77
|
+
name="operation_check", # set your experiment name
|
|
78
|
+
desc="operation check of experiment package", # set your experiment description
|
|
79
|
+
auto_gen_mode=False, # if True, each experimental description is automatically generated by LLM
|
|
80
|
+
).init()
|
|
81
|
+
|
|
82
|
+
# run experiment. each experiment defined in config file or instance
|
|
83
|
+
# run from config
|
|
84
|
+
artifact, result = exp.run(config_source="configs/baseline.yaml")
|
|
85
|
+
# run from instance
|
|
86
|
+
artifact, result = exp.run(dataset=your_dataset, model=your_model)
|
|
87
|
+
|
|
88
|
+
# get instance of each experiment artifact
|
|
89
|
+
dataset = artufact.dataset
|
|
90
|
+
model = artifact.model
|
|
91
|
+
|
|
92
|
+
# output result
|
|
93
|
+
# result table convert to pandas dataframe
|
|
94
|
+
exp.runs_to_dataframe()
|
|
95
|
+
|
|
96
|
+
# visualization (Below are some of the features. See documentation for details.)
|
|
97
|
+
model.plot_train_test_kernel_matrix(dataset.X_train, dataset.X_test, n_jobs=5)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 2. Load existing experiment
|
|
101
|
+
```python
|
|
102
|
+
# load existing experiment from json file
|
|
103
|
+
exp = qxmt.Experiment().load_experiment(
|
|
104
|
+
"experiments/operation_check/experiment.json")
|
|
105
|
+
|
|
106
|
+
# reproduction target run artifact
|
|
107
|
+
reproduction_model = exp.reproduce(run_id=1)
|
|
108
|
+
|
|
109
|
+
# run new experiment
|
|
110
|
+
artifact, result = exp.run(config_source="configs/best_params.yaml")
|
|
111
|
+
|
|
112
|
+
# output result
|
|
113
|
+
exp.runs_to_dataframe()
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<!--
|
|
118
|
+
## Documentation
|
|
119
|
+
-->
|
|
120
|
+
|
|
121
|
+
<!--
|
|
122
|
+
## Contributing
|
|
123
|
+
-->
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "qxmt"
|
|
3
|
+
version = "0.0.0" # using poetry-dynamic-versioning
|
|
4
|
+
description = "QXMT is a experiment management tool for quantum computing and quantum machine learning."
|
|
5
|
+
authors = ["kenya-sk"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
repository = "https://github.com/kenya-sk/qxmt"
|
|
9
|
+
packages = [
|
|
10
|
+
{ include = "qxmt" }
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[tool.poetry-dynamic-versioning]
|
|
14
|
+
enable = true
|
|
15
|
+
style = "pep440"
|
|
16
|
+
|
|
17
|
+
[tool.poetry.dependencies]
|
|
18
|
+
python = "^3.11"
|
|
19
|
+
pydantic = "^2.8.2"
|
|
20
|
+
pandas = "^2.2.2"
|
|
21
|
+
scikit-learn = "^1.5.1"
|
|
22
|
+
matplotlib = "^3.9.1"
|
|
23
|
+
pennylane = "^0.37.0"
|
|
24
|
+
dill = "^0.3.8"
|
|
25
|
+
pyyaml = "^6.0.2"
|
|
26
|
+
torch = {version = "^2.4.0", optional = true}
|
|
27
|
+
transformers = {version = "^4.44.2", optional = true}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
[tool.poetry.group.dev.dependencies]
|
|
31
|
+
pytest = "^8.2.2"
|
|
32
|
+
pytest-cov = "^5.0.0"
|
|
33
|
+
black = "^24.4.2"
|
|
34
|
+
isort = "^5.13.2"
|
|
35
|
+
mypy = "^1.10.1"
|
|
36
|
+
flake8 = "^7.1.0"
|
|
37
|
+
ipykernel = "^6.29.5"
|
|
38
|
+
pytest-mock = "^3.14.0"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
[tool.poetry.group.docs.dependencies]
|
|
42
|
+
sphinx = "^8.0.2"
|
|
43
|
+
sphinx-book-theme = "^1.1.3"
|
|
44
|
+
|
|
45
|
+
[tool.poetry.extras]
|
|
46
|
+
llm = ["torch", "transformers"]
|
|
47
|
+
|
|
48
|
+
[build-system]
|
|
49
|
+
requires = ["poetry-core"]
|
|
50
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from qxmt.configs import (
|
|
2
|
+
DatasetConfig,
|
|
3
|
+
DeviceConfig,
|
|
4
|
+
EvaluationConfig,
|
|
5
|
+
ExperimentConfig,
|
|
6
|
+
FeatureMapConfig,
|
|
7
|
+
KernelConfig,
|
|
8
|
+
ModelConfig,
|
|
9
|
+
PathConfig,
|
|
10
|
+
)
|
|
11
|
+
from qxmt.exceptions import (
|
|
12
|
+
ExperimentNotInitializedError,
|
|
13
|
+
ExperimentRunSettingError,
|
|
14
|
+
InputShapeError,
|
|
15
|
+
InvalidFileExtensionError,
|
|
16
|
+
InvalidModelNameError,
|
|
17
|
+
InvalidPlatformError,
|
|
18
|
+
InvalidQunatumDeviceError,
|
|
19
|
+
JsonEncodingError,
|
|
20
|
+
ModelSettingError,
|
|
21
|
+
ReproductionError,
|
|
22
|
+
)
|
|
23
|
+
from qxmt.experiment.experiment import Experiment
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"ExperimentNotInitializedError",
|
|
27
|
+
"ExperimentRunSettingError",
|
|
28
|
+
"InputShapeError",
|
|
29
|
+
"InvalidFileExtensionError",
|
|
30
|
+
"InvalidModelNameError",
|
|
31
|
+
"InvalidPlatformError",
|
|
32
|
+
"InvalidQunatumDeviceError",
|
|
33
|
+
"JsonEncodingError",
|
|
34
|
+
"ModelSettingError",
|
|
35
|
+
"ReproductionError",
|
|
36
|
+
"Experiment",
|
|
37
|
+
"ExperimentConfig",
|
|
38
|
+
"DatasetConfig",
|
|
39
|
+
"DeviceConfig",
|
|
40
|
+
"EvaluationConfig",
|
|
41
|
+
"FeatureMapConfig",
|
|
42
|
+
"KernelConfig",
|
|
43
|
+
"ModelConfig",
|
|
44
|
+
"PathConfig",
|
|
45
|
+
]
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Any, Literal, Optional
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel, Field
|
|
5
|
+
|
|
6
|
+
from qxmt.constants import MODULE_HOME
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PathConfig(BaseModel):
|
|
10
|
+
data: Path | str
|
|
11
|
+
label: Path | str
|
|
12
|
+
|
|
13
|
+
def model_post_init(self, __context: dict[str, Any]) -> None:
|
|
14
|
+
if not Path(self.data).is_absolute():
|
|
15
|
+
self.data = MODULE_HOME / self.data
|
|
16
|
+
|
|
17
|
+
if not Path(self.label).is_absolute():
|
|
18
|
+
self.label = MODULE_HOME / self.label
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DatasetConfig(BaseModel):
|
|
22
|
+
type: Literal["file", "generate"]
|
|
23
|
+
path: PathConfig
|
|
24
|
+
random_seed: int
|
|
25
|
+
test_size: float = Field(ge=0.0, le=1.0)
|
|
26
|
+
features: Optional[list[str]] = None
|
|
27
|
+
raw_preprocess_logic: Optional[dict[str, Any]] = None
|
|
28
|
+
transform_logic: Optional[dict[str, Any]] = None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class DeviceConfig(BaseModel):
|
|
32
|
+
platform: str
|
|
33
|
+
name: str
|
|
34
|
+
n_qubits: int
|
|
35
|
+
shots: Optional[int] = None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class FeatureMapConfig(BaseModel):
|
|
39
|
+
module_name: str
|
|
40
|
+
implement_name: str
|
|
41
|
+
params: Optional[dict[str, Any]] = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class KernelConfig(BaseModel):
|
|
45
|
+
module_name: str
|
|
46
|
+
implement_name: str
|
|
47
|
+
params: Optional[dict[str, Any]] = None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ModelConfig(BaseModel):
|
|
51
|
+
name: str
|
|
52
|
+
file_name: str
|
|
53
|
+
params: dict[str, Any]
|
|
54
|
+
feature_map: Optional[FeatureMapConfig] = None
|
|
55
|
+
kernel: Optional[KernelConfig] = None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class EvaluationConfig(BaseModel):
|
|
59
|
+
default_metrics: list[str]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class ExperimentConfig(BaseModel):
|
|
63
|
+
path: Path | str = ""
|
|
64
|
+
description: str = ""
|
|
65
|
+
dataset: DatasetConfig
|
|
66
|
+
device: DeviceConfig
|
|
67
|
+
feature_map: Optional[FeatureMapConfig] = None
|
|
68
|
+
kernel: Optional[KernelConfig] = None
|
|
69
|
+
model: ModelConfig
|
|
70
|
+
evaluation: EvaluationConfig
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import pennylane as qml
|
|
5
|
+
import pytz
|
|
6
|
+
|
|
7
|
+
MODULE_HOME: Path = Path(__file__).resolve().parents[1]
|
|
8
|
+
MODULE_SRC: Path = Path(__file__).resolve().parents[0]
|
|
9
|
+
|
|
10
|
+
DEFAULT_N_JOBS = 3
|
|
11
|
+
|
|
12
|
+
DEFAULT_EXP_DIRC: Path = MODULE_HOME / "experiments"
|
|
13
|
+
DEFAULT_EXP_DB_FILE: Path = Path("experiment.json")
|
|
14
|
+
|
|
15
|
+
SUPPORTED_PLATFORMS: list[str] = ["pennylane"]
|
|
16
|
+
PENNYLANE_DEVICES: tuple[Any, ...] = (qml.devices.Device, qml.Device, qml.QubitDevice)
|
|
17
|
+
|
|
18
|
+
DEFAULT_MODEL_NAME: str = "model.pkl"
|
|
19
|
+
|
|
20
|
+
DEFAULT_METRICS_NAME: list[str] = ["accuracy", "precision", "recall", "f1_score"]
|
|
21
|
+
|
|
22
|
+
LLM_MODEL_PATH = "microsoft/Phi-3-mini-128k-instruct"
|
|
23
|
+
|
|
24
|
+
TZ: pytz.BaseTzInfo = pytz.timezone("Asia/Tokyo")
|