<commit_before>import torch
from torch.autograd import Variable
from torch import nn
import numpy as np
import qelos as q
from qelos.util import isnumber, isstring, ticktock, issequence


class var(object):
    all_cuda = False

    def __init__(self, torchtensor):
        self.v = Variable(torchtensor)

    def cuda(self, crit=None):
        if crit is False:
            if self.v.is_cuda:
                self.v = self.v.cpu()
        elif crit is True:
            if not self.v.is_cuda:
                self.v = self.v.cuda()
        elif hasattr(crit, "is_cuda"):
            self.cuda(crit=crit.is_cuda)
        elif crit is None:
            self.cuda(crit=var.all_cuda)
        return self


class Aggregator(object):
    def __init__(self, mode="mean"):
        super(Aggregator, self).__init__()<commit_msg>* init state cuda fix<commit_after>import torch
from torch.autograd import Variable
from torch.utils.data.dataset import Dataset
from torch import nn
import numpy as np
import qelos as q
from qelos.util import isnumber, isstring, ticktock, issequence


class var(object):
    all_cuda = False

    def __init__(self, torchtensor):
        self.v = Variable(torchtensor)

    def cuda(self, crit=None):
        if crit is False:
            if self.v.is_cuda:
                self.v = self.v.cpu()
        elif crit is True:
            if not self.v.is_cuda:
                self.v = self.v.cuda()
        elif hasattr(crit, "is_cuda"):
            self.cuda(crit=crit.is_cuda)
        elif crit is None:
            self.cuda(crit=var.all_cuda)
        return self


class MultiTensorDataset(Dataset):      # TODO
    def __init__(self, *x):
        """
        :param x: tensors in torch or numpy (converted to tensors). Last tensor must be gold.
        """
        super(MultiTensorDataset, self).__init__()
        self.tensors = x

    def __getitem__(self, index):
        pass

    def __len__(self):
        pass





class Aggregator(object):
    def __init__(self, mode="mean"):
        super(Aggregator, self).__init__()
{'fraction_non_alphanumeric': 0.09551656920077972, 'fraction_numerical': 0.0, 'mean_word_length': 2.2381703470031544, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6365224', 'n_tokens_mistral': 665, 'n_tokens_neox': 649, 'n_words': 183}