TuringLang / TuringCallbacks.jl

http://turinglang.org/TuringCallbacks.jl/
MIT License
13 stars 8 forks source link

Loosen the logger type in TensorBoardLogger #42

Closed KDr2 closed 1 year ago

KDr2 commented 1 year ago

Loosen the logger type in TensorBoardLogger from TBLogger to AbstractLogger, so we can pass a customized logger type to send the logs to an HTTP API or any other place instead of a file.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.38 :tada:

Comparison is base (d9b2e48) 47.76% compared to head (cee6b02) 48.14%.

:exclamation: Current head cee6b02 differs from pull request most recent head 2e9de56. Consider uploading reports for the commit 2e9de56 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #42 +/- ## ========================================== + Coverage 47.76% 48.14% +0.38% ========================================== Files 6 6 Lines 134 135 +1 ========================================== + Hits 64 65 +1 Misses 70 70 ``` | [Impacted Files](https://app.codecov.io/gh/TuringLang/TuringCallbacks.jl/pull/42?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TuringLang) | Coverage Δ | | |---|---|---| | [src/tensorboardlogger.jl](https://app.codecov.io/gh/TuringLang/TuringCallbacks.jl/pull/42?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TuringLang#diff-c3JjL3RlbnNvcmJvYXJkbG9nZ2VyLmps) | `38.46% <ø> (ø)` | | | [src/callbacks/tensorboard.jl](https://app.codecov.io/gh/TuringLang/TuringCallbacks.jl/pull/42?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=TuringLang#diff-c3JjL2NhbGxiYWNrcy90ZW5zb3Jib2FyZC5qbA==) | `76.47% <100.00%> (+0.47%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

yebai commented 1 year ago

TensorBoardLogger.increment_step!, which expects a TBLogger

@KDr2 Maybe introduce a fallback for increment_step!, then throw an error when not overloaded for concrete logger types?

KDr2 commented 1 year ago

TensorBoardLogger.increment_step!, which expects a TBLogger

@KDr2 Maybe introduce a fallback for increment_step!, then throw an error when not overloaded for concrete logger types?

TensorBoardLogger.increment_step!(::AbstractLogger) =
  throw(ErrorException("Please implement `TensorBoardLogger.increment_step!` for your logger type."))

Like this? I think it would be better if we put it in package TensorBoardLogger?

yebai commented 1 year ago

Like this? I think it would be better if we put it in package TensorBoardLogger?

Sounds good.