<jupyter_start><jupyter_text>Doc2Vec<jupyter_code>def set_seed(seed: int, random_seed: int):
    """
    Set the random seed for modules torch, numpy and random.
    :param seed: random seed
    """
    torch.manual_seed(seed)
    np.random.seed(seed)
    random.seed(random_seed)

class Config:
    def __init__(self, name_model):
        self.model_dir = "/content/drive/MyDrive/altegrad_datachallenge/"
        self.data_path = "data"
        self.splitpaths = ['d2v.train', 'd2v.valid', 'd2v.test']
        self.seed = 42
        self.author_dim = 128
        self.paper_dim = 256
        self.use_cuda = True
        # Training Parameters
        self.epochs = 60
        self.batch_size = 64
        self.eval_batch_size = 64
        self.validation_freq = 150
        self.training_freq = 50
        # Learning Rate Tunable
        self.lr = 0.0007
        self.patience = 1
        self.factor = 0.8
        # Model
        self.num_heads = 8
        self.num_layers = 2
        self.dropout = 0.4
        self.name_model = name_model
cfg_data = Config(None)
train_data, dev_data = load_data(cfg_data)
total_data = data.Dataset(train_data.examples + dev_data.examples, train_data.fields)<jupyter_output><empty_output><jupyter_text>**In order to do a ensemble model, we are going to split in 5 different way the labeled data into train/dev split.We can add more but we just need to insure that they have approximately the same performance.**<jupyter_code>cfg = Config(f'model_d2v_normal')
model = build_model(cfg)
trainer = TrainManager(model, cfg)
trainer.train_and_validate(train_data, dev_data)
split_seeds = [0, 5, 10, 15]
for split_seed in split_seeds:
    cfg = Config(f'model_d2v_{split_seed}')
    set_seed(cfg.seed, split_seed)
    train_data_, dev_data_ = total_data.split(split_ratio=0.9, random_state=random.getstate())
    model = build_model(cfg)
    trainer = TrainManager(model, cfg)
    trainer.train_and_validate(train_data_, dev_data_)<jupyter_output><empty_output><jupyter_text>SentenceTransformers<jupyter_code>def set_seed(seed: int, random_seed: int):
    """
    Set the random seed for modules torch, numpy and random.
    :param seed: random seed
    """
    torch.manual_seed(seed)
    np.random.seed(seed)
    random.seed(random_seed)

class Config:
    def __init__(self, name_model):
        self.model_dir = "/content/drive/MyDrive/altegrad_datachallenge/"
        self.data_path = "data"
        self.splitpaths = ['data.train', 'data.valid', 'data.test']
        self.seed = 42
        self.author_dim = 128
        self.paper_dim = 256
        self.use_cuda = True
        # Training Parameters
        self.epochs = 60
        self.batch_size = 64
        self.eval_batch_size = 64
        self.validation_freq = 150
        self.training_freq = 50
        # Learning Rate Tunable
        self.lr = 0.0007
        self.patience = 1
        self.factor = 0.8
        # Model
        self.num_heads = 8
        self.num_layers = 2
        self.dropout = 0.4
        self.name_model = name_model
cfg_data = Config(None)
train_data, dev_data = load_data(cfg_data)
total_data = data.Dataset(train_data.examples + dev_data.examples, train_data.fields)
cfg = Config(f'model_ST_normal')
model = build_model(cfg)
trainer = TrainManager(model, cfg)
trainer.train_and_validate(train_data, dev_data)
split_seeds = [0, 5, 10, 15]
for split_seed in split_seeds:
    cfg = Config(f'model_ST_{split_seed}')
    set_seed(cfg.seed, split_seed)
    train_data_, dev_data_ = total_data.split(split_ratio=0.9, random_state=random.getstate())
    model = build_model(cfg)
    trainer = TrainManager(model, cfg)
    trainer.train_and_validate(train_data_, dev_data_)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10067294751009422, 'fraction_numerical': 0.02288021534320323, 'mean_word_length': 3.1473214285714284, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '419696', 'license': 'MIT', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1245, 'n_words': 265, 'path': 'training_notebook.ipynb', 'repo_name': 'omarsou/altegrad_challenge_hindex', 'size': '3715'}