{"id":21428293,"url":"https://github.com/mlverse/tfevents","last_synced_at":"2025-07-14T10:31:50.971Z","repository":{"id":65858825,"uuid":"560214544","full_name":"mlverse/tfevents","owner":"mlverse","description":"Write events for TensorBoard","archived":false,"fork":false,"pushed_at":"2024-06-27T13:07:54.000Z","size":15337,"stargazers_count":10,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-09T03:19:14.210Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://mlverse.github.io/tfevents/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlverse.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-01T01:25:39.000Z","updated_at":"2024-06-27T13:02:20.000Z","dependencies_parsed_at":"2024-05-06T14:29:39.744Z","dependency_job_id":"3060173f-3c6f-47ac-a49b-27c2cb2c5c97","html_url":"https://github.com/mlverse/tfevents","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mlverse/tfevents","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlverse%2Ftfevents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlverse%2Ftfevents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlverse%2Ftfevents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlverse%2Ftfevents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlverse","download_url":"https://codeload.github.com/mlverse/tfevents/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlverse%2Ftfevents/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265280699,"owners_count":23739853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T22:12:29.259Z","updated_at":"2025-07-14T10:31:45.958Z","avatar_url":"https://github.com/mlverse.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\ntemp \u003c- tempfile(\"logdir\")\ndir.create(temp)\nknitr::opts_knit$set(root.dir = temp)\n```\n\n# tfevents\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/mlverse/tfevents/actions/workflows/check.yaml/badge.svg)](https://github.com/mlverse/tfevents/actions/workflows/check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/mlverse/tfevents/branch/main/graph/badge.svg)](https://app.codecov.io/gh/mlverse/tfevents?branch=main)\n[![CRAN status](https://www.r-pkg.org/badges/version/tfevents)](https://CRAN.R-project.org/package=tfevents)\n[![](https://cranlogs.r-pkg.org/badges/tfevents)](https://cran.r-project.org/package=tfevents)\n\u003c!-- badges: end --\u003e\n\ntfevents allows logging data from machine learning experiments to a file\nformat that can be later consumed by [TensorBoard](https://www.tensorflow.org/tensorboard) in order to generate visualizations.\n\n## Installation\n\nYou can install tfevents from CRAN with:\n\n``` r\ninstall.packages(\"tfevents\")\n```\n\nYou can install the development version of tfevents from [GitHub](https://github.com/) with:\n\nYou need to have `cmake` on your path. See installation instructions in the [cmake install\nwebpage](https://cmake.org/resources/) - or:\n\nIf you use `brew` on MacOS you can run:\n\n``` shell\nbrew install cmake\n```\n\nOr on linux install the `cmake` library, for example on Debian systems:\n\n``` shell\nsudo apt install cmake\n```\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"mlverse/tfevents\")\n```\n\n## Example\n\nThe main entrypoint in tfevents API is the `log_event` function. It can be used\nto log **summaries** like scalars, images, audio (Coming soon), histograms (Coming soon)\nand arbitrary tensors (soon) to a log directory, which we like to call `logdir`.\nYou can later point TensorBoard to this `logdir` to visualize the results.\n\n```{r example}\nlibrary(tfevents)\n```\n\nSummaries are always associated to a step in the TensorBoard API, and `log_event`\nautomatically increases the **`step`** everytime it's called, unless you provide\nthe `step` argument.\n\nLet's start by logging some metrics:\n\n```{r cars}\nepochs \u003c- 10\nfor (i in seq_len(epochs)) {\n  # training code would go here\n  log_event(\n    train = list(loss = runif(1), acc = runif(1)),\n    valid = list(loss = runif(1), acc = runif(1))\n  )\n}\n```\n\nBy default this will create a `logs` directory in your working directory and write\nmetrics to it - you can change the default `logdir` using context like `with_logdir`\nor globally with `set_default_logdir()`. \n\nSince we passed a nested list of metrics, `log_event` will create \nsubdirectories under `logs` to write metrics for each group.\n\n```{r}\nfs::dir_tree(\"logs\")\n```\n\nYou can later point TensorBoard to that logdir using TensorBoard's command line\ninterface or tensorflow's utility function `tensorboard()`\n\n```{r}\ntensorflow::tensorboard(normalizePath(\"logs\"), port = 6060)\n```\n\nTensorBoard will display the results in a dashbboard, similar to one you can see\nin the screenshot below:\n\n```{r tensorboard, echo=FALSE, out.width=\"100%\"}\nwebshot2::webshot(url = \"http://127.0.0.1:6060/?darkMode=false\")\n```\n\nYou can learn more in the [tfevents website](#TODO).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlverse%2Ftfevents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlverse%2Ftfevents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlverse%2Ftfevents/lists"}