INNER CODE UNIT · Python

__init__

huggingface/large_language_model_training_playbook · debug/NicerTrace.py:165

    def __init__(self, filename):
        self.stdout = sys.stdout
        self.file = open(filename, "a")

    def __getattr__(self, attr):
        return getattr(self.stdout, attr)

    def write(self, msg):
        # comment out the next line if you don't want to write to stdout
        self.stdout.write(msg)
        self.file.write(msg)
        self.file.flush()

    def flush(self):
        # comment out the next line if you don't want to write to stdout
        self.stdout.flush()
        self.file.flush()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…