<commit_before>import logging
import collections
import copy
import logging
import random
import time
import math

import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_sequence

from .input_event import KeyEvent, IntentEvent, TouchEvent, UIEvent, KillAppEvent
from .input_policy import UtgBasedInputPolicy

logging.basicConfig(level=logging.INFO, format="%(asctime)s %(name)-12s %(levelname)-8s %(message)s")
DEBUG = True
ACTION_INEFFECTIVE = 'ineffective'

CLOSER_ACTION_ENCOURAGEMENT = 0.1
RANDOM_EXPLORE_PROB = 0.3
N_ACTIONS_TRAINING = 32

MAX_NUM_STEPS_OUTSIDE = 3
MAX_NUM_STEPS_OUTSIDE_KILL = 5
MAX_NAV_STEPS = 10


class UIEmbedLSTM(nn.Module):
    def __init__(self):
        super().__init__()
        self.text_encoder = TextEncoder(method='bert')
        input_size = 18 + self.text_encoder.embed_size
        embed_size = 100
        output_size = 50
        self.lstm = nn.LSTM(
            input_size=input_size,
            hidden_size=int(embed_size/2),
            num_layers=2,
            batch_first=True,
            bidirectional=True
        )
        self.fc = nn.Linear(embed_size, output_size)
        # self.fc = nn.Linear(input_size, output_size)

    def encode_state(self, state, views):
        return torch.stack([self._encode_view(state, view) for view in views])

    def _encode_view(self, state, view):
        # print(view)<commit_msg>slight change of hyperparameter<commit_after>import logging
import collections
import copy
import logging
import random
import time
import math

import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_sequence

from .input_event import KeyEvent, IntentEvent, TouchEvent, UIEvent, KillAppEvent
from .input_policy import UtgBasedInputPolicy

logging.basicConfig(level=logging.INFO, format="%(asctime)s %(name)-12s %(levelname)-8s %(message)s")
DEBUG = True
ACTION_INEFFECTIVE = 'ineffective'

CLOSER_ACTION_ENCOURAGEMENT = 0.01
RANDOM_EXPLORE_PROB = 0.4
N_ACTIONS_TRAINING = 32

MAX_NUM_STEPS_OUTSIDE = 3
MAX_NUM_STEPS_OUTSIDE_KILL = 5
MAX_NAV_STEPS = 10


class UIEmbedLSTM(nn.Module):
    def __init__(self):
        super().__init__()
        self.text_encoder = TextEncoder(method='bert')
        input_size = 18 + self.text_encoder.embed_size
        embed_size = 100
        output_size = 50
        self.lstm = nn.LSTM(
            input_size=input_size,
            hidden_size=int(embed_size/2),
            num_layers=2,
            batch_first=True,
            bidirectional=True
        )
        self.fc = nn.Linear(embed_size, output_size)
        # self.fc = nn.Linear(input_size, output_size)

    def encode_state(self, state, views):
        return torch.stack([self._encode_view(state, view) for view in views])

    def _encode_view(self, state, view):
        # print(view)
{'fraction_non_alphanumeric': 0.08767690714532275, 'fraction_numerical': 0.015533310321021747, 'mean_word_length': 3.4584615384615383, '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': '6854895', 'n_tokens_mistral': 997, 'n_tokens_neox': 946, 'n_words': 218}