logging levels not set comprehensively (still get INFO messages with WARNING set)
評価
調査の方向性
binomial-rng.stan と bug.py を使って報告を再現し、logging.getLogger('cmdstanpy') の設定と CmdStanModel.sample の呼び出しから開始します。報告されたメッセージに使用されているロガー名を追跡し、WARNING を設定するとモデルの実行に影響を与えずに INFO の出力が抑制されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Summary:
I set the logger level to WARNING before compiling and running a model, but I still see INFO level warning messages.
Description:
Here's a simple reproducible example consisting of a Stan program and a Python script that can go in the same directory and run as shown below.
binomial-rng.stan:
data {
int<lower=0> N;
real<lower=0, upper=1> theta;
}
generated quantities {
int<lower=0, upper=N> y = binomial_rng(N, theta);
}
bug.py
import cmdstanpy
import logging
logging.getLogger('cmdstanpy').setLevel(logging.WARNING)
N = 100
theta = 0.3
data = {'N': N, 'theta': theta}
model = cmdstanpy.CmdStanModel(stan_file = 'binomial-rng.stan')
sample = model.sample(data = data, seed=123,
iter_sampling = 10, iter_warmup = 0, chains = 1,
show_progress = False, show_console = False)
~/temp2$ python3 bug.py
14:43:39 - cmdstanpy - INFO - CmdStan start processing
14:43:39 - cmdstanpy - INFO - Chain [1] start processing
14:43:39 - cmdstanpy - INFO - Chain [1] done processing
14:43:39 - cmdstanpy - INFO - deleting tmpfiles dir: /var/folders/b3/6h4t41094vz281j7nn48ws900001jv/T/tmpojw6vov9
14:43:39 - cmdstanpy - INFO - done
The same error arises if you set logging.ERROR instead of logging.WARNING.
@WardBrian suggested the problem might be that there are several loggers being used by CmdStanPy, but only some of them are getting their level set.
Context
I would like to silence all the DEBUG and INFO level messages in the context of constructing a quarto tutorial.
Current Version:
>>> import cmdstanpy
>>> cmdstanpy.show_versions()
INSTALLED VERSIONS
---------------------
python: 3.9.4 (default, Apr 5 2021, 01:47:16)
[Clang 11.0.0 (clang-1100.0.33.17)]
python-bits: 64
OS: Darwin
OS-release: 22.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
cmdstan_folder: /Users/bcarpenter/.cmdstan/cmdstan-2.31.0
cmdstan: (2, 31)
cmdstanpy: 1.0.4
pandas: 1.4.3
xarray: 2023.1.0
tdqm: None
numpy: 1.24.1
ujson: 5.4.0
' '
- 主要言語
- Python
- スター
- 198
- フォーク
- 82
- 平均マージ
- 6日 15時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stan-dev/cmdstanpy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
laplace_sample: expose CmdStan's diagnostic_file (the Hessian at the mode)対応中かも @atarutin が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
-
log_prob leaves a temporary output directory per call until interpreter exit対応中かも @atarutin が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 22/100
-
Release 2.0オープン
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
stan-dev/cmdstanpy の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
awslabs/visual-asset-management-system#414 ·
メンテナーはふだん 1 日以内に返信
-
bug v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
modelcontextprotocol/python-sdk#3670 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aicell-lab/bioengine#232 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
modelscope/evalscope#1836 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100