@@ -136,9 +136,9 @@ def __init__(
136
136
137
137
if init_strategy_num_candidates is not None :
138
138
warn (
139
- """ Passing `init_strategy_num_candidates` is deprecated as of sbi
140
- v0.19.0. Instead, use e.g.,
141
- `init_strategy_parameters={" num_candidate_samples" : 1000}`"" " ,
139
+ "Passing `init_strategy_num_candidates` is deprecated as of sbi "
140
+ " v0.19.0. Instead, use e.g., `init_strategy_parameters "
141
+ f"= { ' num_candidate_samples' : 1000} `" ,
142
142
stacklevel = 2 ,
143
143
)
144
144
self .init_strategy_parameters ["num_candidate_samples" ] = (
@@ -194,9 +194,8 @@ def log_prob(
194
194
`len($\theta$)`-shaped log-probability.
195
195
"""
196
196
warn (
197
- """`.log_prob()` is deprecated for methods that can only evaluate the
198
- log-probability up to a normalizing constant. Use `.potential()`
199
- instead.""" ,
197
+ "`.log_prob()` is deprecated for methods that can only evaluate the "
198
+ "log-probability up to a normalizing constant. Use `.potential()` instead." ,
200
199
stacklevel = 2 ,
201
200
)
202
201
warn ("The log-probability is unnormalized!" , stacklevel = 2 )
@@ -264,9 +263,9 @@ def sample(
264
263
)
265
264
if init_strategy_num_candidates is not None :
266
265
warn (
267
- """ Passing `init_strategy_num_candidates` is deprecated as of sbi
268
- v0.19.0. Instead, use e.g.,
269
- `init_strategy_parameters={"num_candidate_samples": 1000}`"" " ,
266
+ "Passing `init_strategy_num_candidates` is deprecated as of sbi"
267
+ " v0.19.0. Instead, use e.g.,"
268
+ f" `init_strategy_parameters={ "num_candidate_samples" : 1000} `" ,
270
269
stacklevel = 2 ,
271
270
)
272
271
self .init_strategy_parameters ["num_candidate_samples" ] = (
@@ -275,7 +274,7 @@ def sample(
275
274
if sample_with is not None :
276
275
raise ValueError (
277
276
f"You set `sample_with={ sample_with } `. As of sbi v0.18.0, setting "
278
- f "`sample_with` is no longer supported. You have to rerun "
277
+ "`sample_with` is no longer supported. You have to rerun "
279
278
f"`.build_posterior(sample_with={ sample_with } ).`"
280
279
)
281
280
if mcmc_method is not None :
@@ -426,9 +425,9 @@ def sample_batched(
426
425
# warn if num_chains is larger than num requested samples
427
426
if num_chains > torch .Size (sample_shape ).numel ():
428
427
warnings .warn (
429
- f"""Passed num_chains { num_chains } is larger than the number of
430
- requested samples { torch .Size (sample_shape ).numel ()} , resetting
431
- it to { torch .Size (sample_shape ).numel ()} ."" " ,
428
+ "The passed number of MCMC chains is larger than the number of "
429
+ f" requested samples: { num_chains } > { torch .Size (sample_shape ).numel ()} ,"
430
+ f" resetting it to { torch .Size (sample_shape ).numel ()} ." ,
432
431
stacklevel = 2 ,
433
432
)
434
433
num_chains = torch .Size (sample_shape ).numel ()
@@ -453,12 +452,11 @@ def sample_batched(
453
452
num_chains_extended = batch_size * num_chains
454
453
if num_chains_extended > 100 :
455
454
warnings .warn (
456
- f"""Note that for batched sampling, we use { num_chains } for each
457
- x in the batch. With the given settings, this results in a
458
- large number of chains ({ num_chains_extended } ), This can be
459
- large number of chains ({ num_chains_extended } ), which can be
460
- slow and memory-intensive. Consider reducing the number of
461
- chains.""" ,
455
+ "Note that for batched sampling, we use num_chains many chains for each"
456
+ " x in the batch. With the given settings, this results in a large "
457
+ f"number large number of chains ({ num_chains_extended } ), which can be "
458
+ "slow and memory-intensive for vectorized MCMC. Consider reducing the "
459
+ "number of chains." ,
462
460
stacklevel = 2 ,
463
461
)
464
462
init_strategy_parameters ["num_return_samples" ] = num_chains_extended
@@ -905,8 +903,8 @@ def _prepare_potential(self, method: str) -> Callable:
905
903
else :
906
904
if "hmc" in method or "nuts" in method :
907
905
warn (
908
- """ The kwargs " hmc" and " nuts" are deprecated. Use " hmc_pyro",
909
- "nuts_pyro", " hmc_pymc" , or " nuts_pymc" instead."" " ,
906
+ "The kwargs ' hmc' and ' nuts' are deprecated. Use ' hmc_pyro',"
907
+ "' nuts_pyro', ' hmc_pymc' , or ' nuts_pymc' instead." ,
910
908
DeprecationWarning ,
911
909
stacklevel = 2 ,
912
910
)
0 commit comments