diff --git a/pymc/backends/__init__.py b/pymc/backends/__init__.py index 9347d2ae3a1..1be86110a88 100644 --- a/pymc/backends/__init__.py +++ b/pymc/backends/__init__.py @@ -73,7 +73,7 @@ HAS_MCB = False try: - from mcbackend import Backend + from mcbackend import Backend, NumPyBackend from pymc.backends.mcbackend import init_chain_adapters @@ -119,6 +119,8 @@ def init_traces( model: Model, ) -> Sequence[IBaseTrace]: """Initializes a trace recorder for each chain.""" + if HAS_MCB and backend is None: + backend = NumPyBackend(preallocate=expected_length) if HAS_MCB and isinstance(backend, Backend): return init_chain_adapters( backend=backend,