Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set log quietness based on supplied verbosity #79

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

zouharvi
Copy link
Contributor

@zouharvi zouharvi commented Dec 5, 2024

Verbosity level

Currently the verbosity that's passed to IRT trainer is not being used to actually set the log levels. This PR simply disables the logging (to stdout) when verbosity is False.

I intentionally did not set the global logging level based on it to not interfere with external settings.

With verbose=True:

[16:33:13] Vocab size: None                                                                                                                                                                                                                    training.py:88
           args: {'device': 'cuda', 'num_items': 1098, 'num_subjects': 15}                                                                                                                                                                    training.py:138
           Parsed Model Args: {'device': 'cuda', 'num_items': 1098, 'num_subjects': 15, 'priors': 'hiearchical', 'dropout': 0.5, 'hidden': 100, 'vocab_size': None}                                                                           training.py:151
Training Pyro IRT Model for 1000 epochs
┏━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Epoch ┃ Loss          ┃ Best Loss     ┃ New LR ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ 1     │ 15368753.7445 │ 15368753.7445 │ 0.1000 │
│ 101   │ 2712.7741     │ 739.3411      │ 0.0990 │
│ 201   │ 1598.0891     │ 6189.5899     │ 0.0980 │
│ 301   │ 6240.3468     │ 8079.3051     │ 0.0970 │
│ 401   │ 26.3337       │ 9961.7676     │ 0.0961 │
│ 501   │ 547.3202      │ 9961.7676     │ 0.0951 │
│ 601   │ 8407.2171     │ 10649.3742    │ 0.0942 │
│ 701   │ 2794.7242     │ 11118.6016    │ 0.0932 │
│ 801   │ 5368.1425     │ 11118.6016    │ 0.0923 │
│ 901   │ 4193.7541     │ 11697.0671    │ 0.0914 │
│ 1000  │ 4457.7534     │ 11697.0671    │ 0.0905 │
└───────┴───────────────┴───────────────┴────────┘

With verbose=False:

Misc other change

I also removed the print(subjects.size(), items.size()) because it looks more like a forgotten debug statement than anything aimed at the user. The same information is already available in the parsed model args anyway.

Misc other chagne

I also removed the enumerated improtes because they're alredy collected when importing py_irt_models (__init__.py). This way when one wants to add a new model, there's only one place that needs to have it imported, the module init file.

Technically also the import py_irt.models is not needed because of the from py_irt.models import abstract_model but it's better to be explicit.

@jplalor jplalor merged commit ef317c1 into nd-ball:master Dec 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants