-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Pull Request resolved: #4852 Every time a summary writer object is created it'll end up creating a file in the passed in logdir with just metadata of 40 bytes. This will cause a lot of spam with every rank initializing the file aggressively (I've done this myself when adding support for Adhoc logging to PyPer to a lot of angry complaints). Report at https://fb.workplace.com/groups/723537759122220/posts/745046770304652/ Sample code that accesses "_writer" directly: https://www.internalfb.com/code/fbsource/[6b39948cd8e179fcc49f08526efa5dc26fc00843]/fbcode/mobile-vision/d2go/d2go/utils/visualization.py?lines=180 Reviewed By: Reubend Differential Revision: D43863071 fbshipit-source-id: c007cd8c1f07d7376df278663e12f6164a5777a6
- Loading branch information
1 parent
f70634e
commit eb48da9
Showing
2 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import tempfile | ||
import unittest | ||
|
||
from detectron2.utils.events import TensorboardXWriter | ||
|
||
|
||
# TODO Fix up capitalization | ||
class TestTensorboardXWriter(unittest.TestCase): | ||
def test_no_files_created(self) -> None: | ||
with tempfile.TemporaryDirectory() as tmp_dir: | ||
writer = TensorboardXWriter(tmp_dir) | ||
writer.close() | ||
|
||
self.assertFalse(os.listdir(tmp_dir)) | ||
|
||
def test_single_write(self) -> None: | ||
with tempfile.TemporaryDirectory() as tmp_dir: | ||
writer = TensorboardXWriter(tmp_dir) | ||
writer._writer.add_scalar("testing", 1, 1) | ||
writer.close() | ||
|
||
self.assertTrue(os.listdir(tmp_dir)) |