<commit_before>import sys

import numpy
import six

import chainer
from chainer.backends import cuda


class _RuntimeInfo(object):

    chainer_version = None
    numpy_version = None
    cupy_info = None

    def __init__(self):
        self.chainer_version = chainer.__version__
        self.numpy_version = numpy.__version__
        self.cupy_info = cuda.get_runtime_info()

    def __str__(self):
        s = six.StringIO()
        s.write('''Chainer: {}\n'''.format(self.chainer_version))
        s.write('''NumPy: {}\n'''.format(self.numpy_version))
        s.write(str(self.cupy_info))
        return s.getvalue()


def get_runtime_info(as_text=False):
    ri = _RuntimeInfo()
    if as_text:
        return str(ri)
    else:
        return ri


def print_runtime_info(out=None):
    if out is None:
        out = sys.stdout
    text = get_runtime_info(as_text=True)
    out.write(text)<commit_msg>cupy -> cuda<commit_after>import sys

import numpy
import six

import chainer
from chainer.backends import cuda


class _RuntimeInfo(object):

    chainer_version = None
    numpy_version = None
    cuda_info = None

    def __init__(self):
        self.chainer_version = chainer.__version__
        self.numpy_version = numpy.__version__
        self.cuda_info = cuda.get_runtime_info()

    def __str__(self):
        s = six.StringIO()
        s.write('''Chainer: {}\n'''.format(self.chainer_version))
        s.write('''NumPy: {}\n'''.format(self.numpy_version))
        s.write(str(self.cuda_info))
        return s.getvalue()


def get_runtime_info(as_text=False):
    ri = _RuntimeInfo()
    if as_text:
        return str(ri)
    else:
        return ri


def print_runtime_info(out=None):
    if out is None:
        out = sys.stdout
    text = get_runtime_info(as_text=True)
    out.write(text)
{'fraction_non_alphanumeric': 0.11055831951354339, 'fraction_numerical': 0.0, 'mean_word_length': 2.8347457627118646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4298515', 'n_tokens_mistral': 619, 'n_tokens_neox': 607, 'n_words': 122}