Brand-only sweep. Touches READMEs, docs, package metadata, comments,
notebook markdown, requirements.txt files; does NOT yet touch Python
`concrete.*` imports (those are module-level dependencies requiring the
phase-2 Python module port from `concrete` → `torus`).
Substitutions applied:
Concrete ML → TorusML
concrete-ml → torus-ml
Concrete-ML → Torus-ML
concrete_ml → torus_ml
zama-ai/concrete-ml → luxfhe/ml-sdk
zama-ai/concrete → luxfhe/torus
github.com/zama-ai → github.com/luxfhe
docs.zama.ai/concrete-ml → docs.luxfhe.com/ml-sdk
docs.zama.ai/concrete → docs.luxfhe.com/torus
Zama Concrete ML → Lux TorusML
Zama Concrete → Lux Torus
Zama tfhe-rs / Zama TFHE-rs → Lux-FHE
tfhe-rs / TFHE-rs → Lux-FHE
Zama fhEVM / fhEVM → TorusEVM
Concrete framework → Torus framework
Concrete compiler → Torus compiler
Concrete by Zama → Torus by Lux
the Zama team → the Lux Industries team
Zama's → Lux Industries'
(Zama) → (Lux)
CoFHE / Fhenix → (removed)
LICENSE: original Zama copyright RETAINED per BSD-3-Clause-Clear §1-§2
requirements; Lux Industries modifications copyright added. Per §3 no
name of ZAMA used to endorse the derived work — product marketed
exclusively as TorusML.
README image URLs migrated to github.com/luxfhe/ml-sdk/assets to break
the dependency on Zama's CDN.
Hit count: 350 → 295. Residual hits are Python `from concrete.fhe import`
imports referencing the upstream Zama `concrete` PyPI package; these
require module-level port (phase 2):
Phase 2 plan:
1. Fork zama-ai/concrete (the Python compiler) to luxfhe/torus
2. Rename Python module `concrete` → `torus`; PyPI publish as `torus-fhe`
3. Update ml-sdk imports from `concrete.fhe` → `torus.fhe`, etc.
4. Wire `torus.compiler` GPU dispatch through `luxcpp/gpu` vtbl
(lux-private/gpu-kernels for CUDA/Metal/WebGPU/FPGA targets)
5. Port concrete-cuda + concrete-mlir kernels to
lux-private/gpu-kernels/{cuda,metal,wgsl}/ckks/ (matrix-vector
mul, rescale, rotate, bootstrap for TorusML inference)
Phase 3 plan (kernels):
- CKKS/BGV/BFV GPU kernels in lux-private/gpu-kernels/
(currently only TFHE PBS / keyswitch / blind-rotate exist)
- FPGA bitstreams in lux-private/fpga/ (currently scaffold only)
Phase 1 = docs/branding sweep. PR not opened; user reviews and merges.
13 KiB
module concrete.ml.pytest.utils
Common functions or lists for test files, which can't be put in fixtures.
Global Variables
- MODELS_AND_DATASETS
- UNIQUE_MODELS_AND_DATASETS
function get_sklearn_linear_models_and_datasets
get_sklearn_linear_models_and_datasets(
regressor: bool = True,
classifier: bool = True,
unique_models: bool = False,
select: Optional[str, List[str]] = None,
ignore: Optional[str, List[str]] = None
) → List
Get the pytest parameters to use for testing linear models.
Args:
regressor(bool): If regressors should be selected.classifier(bool): If classifiers should be selected.unique_models(bool): If each models should be represented only once.select(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) match the given string or list of strings. Default to None.ignore(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) do not match the given string or list of strings. Default to None.
Returns:
List: The pytest parameters to use for testing linear models.
function get_sklearn_tree_models_and_datasets
get_sklearn_tree_models_and_datasets(
regressor: bool = True,
classifier: bool = True,
unique_models: bool = False,
select: Optional[str, List[str]] = None,
ignore: Optional[str, List[str]] = None
) → List
Get the pytest parameters to use for testing tree-based models.
Args:
regressor(bool): If regressors should be selected.classifier(bool): If classifiers should be selected.unique_models(bool): If each models should be represented only once.select(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) match the given string or list of strings. Default to None.ignore(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) do not match the given string or list of strings. Default to None.
Returns:
List: The pytest parameters to use for testing tree-based models.
function get_sklearn_neural_net_models_and_datasets
get_sklearn_neural_net_models_and_datasets(
regressor: bool = True,
classifier: bool = True,
unique_models: bool = False,
select: Optional[str, List[str]] = None,
ignore: Optional[str, List[str]] = None
) → List
Get the pytest parameters to use for testing neural network models.
Args:
regressor(bool): If regressors should be selected.classifier(bool): If classifiers should be selected.unique_models(bool): If each models should be represented only once.select(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) match the given string or list of strings. Default to None.ignore(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) do not match the given string or list of strings. Default to None.
Returns:
List: The pytest parameters to use for testing neural network models.
function get_sklearn_neighbors_models_and_datasets
get_sklearn_neighbors_models_and_datasets(
regressor: bool = True,
classifier: bool = True,
unique_models: bool = False,
select: Optional[str, List[str]] = None,
ignore: Optional[str, List[str]] = None
) → List
Get the pytest parameters to use for testing neighbor models.
Args:
regressor(bool): If regressors should be selected.classifier(bool): If classifiers should be selected.unique_models(bool): If each models should be represented only once.select(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) match the given string or list of strings. Default to None.ignore(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) do not match the given string or list of strings. Default to None.
Returns:
List: The pytest parameters to use for testing neighbor models.
function get_sklearn_all_models_and_datasets
get_sklearn_all_models_and_datasets(
regressor: bool = True,
classifier: bool = True,
unique_models: bool = False,
select: Optional[str, List[str]] = None,
ignore: Optional[str, List[str]] = None
) → List
Get the pytest parameters to use for testing all models available in TorusML.
Args:
regressor(bool): If regressors should be selected.classifier(bool): If classifiers should be selected.unique_models(bool): If each models should be represented only once.select(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) match the given string or list of strings. Default to None.ignore(Optional[Union[str, List[str]]]): If not None, only return models which names (or a part of it) do not match the given string or list of strings. Default to None.
Returns:
List: The pytest parameters to use for testing all models available in TorusML.
function instantiate_model_generic
instantiate_model_generic(model_class, n_bits, **parameters)
Instantiate any TorusML model type.
Args:
model_class(class): The type of the model to instantiate.n_bits(int): The number of quantization to use when initializing the model. For QNNs, default parameters are used based on whethern_bitsis greater or smaller than 8.parameters(dict): Hyper-parameters for the model instantiation. For QNNs, these parameters will override the matching default ones.
Returns:
model_name(str): The type of the model as a string.model(object): The model instance.
function data_calibration_processing
data_calibration_processing(data, n_sample: int, targets=None)
Reduce size of the given data-set.
Args:
data: The input container to considern_sample(int): Number of samples to keep if the given data-settargets: Ifdatasetis atorch.utils.data.Dataset, it typically contains both the data and the corresponding targets. In this case,targetsmust be set toNone. Ifdatais instance oftorch.Tensoror 'numpy.ndarray,targets` is expected.
Returns:
Tuple[numpy.ndarray, numpy.ndarray]: The input data and the target (respectively x and y).
Raises:
TypeError: If the 'data-set' does not match any expected type.
function load_torch_model
load_torch_model(
model_class: Module,
state_dict_or_path: Optional[str, Path, Dict[str, Any]],
params: Dict,
device: str = 'cpu'
) → Module
Load an object saved with torch.save() from a file or dict.
Args:
model_class(torch.nn.Module): A PyTorch or Brevitas network.state_dict_or_path(Optional[Union[str, Path, Dict[str, Any]]]): Path or state_dictparams(Dict): Model's parametersdevice(str): Device type.
Returns:
torch.nn.Module: A PyTorch or Brevitas network.
function values_are_equal
values_are_equal(value_1: Any, value_2: Any) → bool
Indicate if two values are equal.
This method takes into account objects of type None, numpy.ndarray, numpy.floating, numpy.integer, numpy.random.RandomState or any instance that provides a __eq__ method.
Args:
value_2(Any): The first value to consider.value_1(Any): The second value to consider.
Returns:
bool: If the two values are equal.
function check_serialization
check_serialization(
object_to_serialize: Any,
expected_type: Type,
equal_method: Optional[Callable] = None,
check_str: bool = True
)
Check that the given object can properly be serialized.
This function serializes all objects using the dump, dumps, load and loads functions from TorusML. If the given object provides a dump and dumps method, they are also serialized using these.
Args:
object_to_serialize(Any): The object to serialize.expected_type(Type): The object's expected type.equal_method(Optional[Callable]): The function to use to compare the two loaded objects. Default tovalues_are_equal.check_str(bool): If the JSON strings should also be checked. Default to True.
function get_random_samples
get_random_samples(x: ndarray, n_sample: int) → ndarray
Select n_sample random elements from a 2D NumPy array.
Args:
x(numpy.ndarray): The 2D NumPy array from which random rows will be selected.n_sample(int): The number of rows to randomly select.
Returns:
numpy.ndarray: A new 2D NumPy array containing the randomly selected rows.
Raises:
AssertionError: Ifn_sampleis not within the range (0, x.shape[0]) or ifxis not a 2D array.
function pandas_dataframe_are_equal
pandas_dataframe_are_equal(
df_1: DataFrame,
df_2: DataFrame,
float_rtol: float = 1e-05,
float_atol: float = 1e-08,
equal_nan: bool = False
)
Determine if both data-frames are identical.
Args:
df_1(pandas.DataFrame): The first data-frame to consider.df_2(pandas.DataFrame): The second data-frame to consider.float_rtol(float): Numpy's relative tolerance parameter to use when comparing columns with floating point values. Default to 1.e-5.float_atol(float): Numpy's absolute tolerance parameter to use when comparing columns with floating point values. Default to 1.e-8.equal_nan(bool): Whether to compare NaN values as equal. Default to False.
Returns:
Bool: Wether both data-frames are equal.