示例#1
0
def main():
    config = Config('mycfg2.cfg')
    # config.remove_peer('third')
    # config.add_peer('third')
    # config.create('192.168.8.1', 'eth0', 125625, 'ASDA5D5A2AS15D1AS61D61A6D')
    # config.add_peer('shitpost', 'SSD5ASD25C25XV4FGGDC6', '192.168.8.9' )
    config.remove_peer('shitpost')
示例#2
0
def main():
    """Main app process. This controls every step of the process"""
    # TODO: Allow users to supply alt configs?
    try:
        config = Config('./Ripmaster.ini')
    # IOError will raise if iniFile is not found. ValueError will raise if
    # iniFile is missing options.
    except (IOError or ValueError), ex:
        print ex
        return
示例#3
0
 def save(self):  # Update daemon config file
     # Make a new Config object
     fileConfig = Config(self.fileName, load=False)
     # Copy values that could be changed to the new Config object and convert representation
     ro = self.get('read-only', False)
     fileConfig['read-only'] = '' if ro else None
     fileConfig['overwrite'] = '' if self.get('overwrite',
                                              False) and ro else None
     fileConfig['startonstartofindicator'] = self.get(
         'startonstartofindicator', True)
     fileConfig['stoponexitfromindicator'] = self.get(
         'stoponexitfromindicator', False)
     exList = self.get('exclude-dirs', None)
     fileConfig['exclude-dirs'] = (None if exList is None else
                                   ', '.join(v for v in CVal(exList)))
     # Store changed values
     fileConfig.save()
     self.changed = False
示例#4
0
def main():
    if len(sys.argv) < 2:
        print '\nUsage: ' + sys.argv[0] + ' fd.cfg\n'
        sys.exit(-1)
        
    config = Config.Config(sys.argv[1])
    
    global_cfg = {
        'global' : {
            'server.socket_host' : str(config.http_ip),
            'server.socket_port' : int(config.http_port),
            'server.thread_pool' : int(config.thread_pool),
            'server.request_queue_size' : int(config.request_queue_size),
            'server.socket_timeout': int(config.timeout),
            'request.show_tracebacks' : False,
            'response.timeout': int(config.timeout),
            'engine.autoreload_on' : False,
            'log.screen': config.log_output,
            'log.error_file': config.log_error_file,
            'log.access_file': config.log_access_file,
            'environment': config.environment,
            'tools.gzip.on': config.gzip
        }
    }
    
    current_dir = os.path.dirname(os.path.abspath(__file__))
    
    cfg = {
        '/css' : {
            'tools.staticdir.on' : True,
            'tools.staticdir.dir' : "css",
            'tools.staticdir.root' : current_dir
        }
    }
    
    cherrypy.config.update(global_cfg)
    cherrypy.quickstart(FlightDaemon(config), '/', config = cfg)
示例#5
0
import os
import os.path as osp
import torch
from tools import Config, setup_seed, initializeWeights
from BatchData import VD_REGLoader, get_iterator, get_data_file, load_vocab
from Trainer import REGTrainer
from REGer import REGModel

# choose GPU
torch.set_num_threads(3)
os.environ["CUDA_VISIBLE_DEVICES"] = '3'
setup_seed(1234)

# read config
cfg = Config('./configs/BaseModel.yml')

# set datapath
data_root = cfg.DATA_PATH
data_cfg = cfg.DATA
data_path = osp.join(data_root, data_cfg.DATA_SET, data_cfg.SPLIT + '_split')

# load vocab
vocab = load_vocab(data_path)
print('vocab_length:', len(vocab))

# load dataset
train_data = get_iterator(VD_REGLoader(vocab, cfg, split='train'),
                          cfg.TRAIN.T_BS)
eval_data = get_iterator(VD_REGLoader(vocab, cfg, split='val'), cfg.TRAIN.V_BS)
testA_data = get_iterator(VD_REGLoader(vocab, cfg, split='testA'),
                          cfg.TRAIN.V_BS)
示例#6
0
config = Config(
    # augmentation
    sequence_change = 0.3,
    zoom_range = (1.2, 1.2),
    random_shear = 0.2,
    random_rotation = 20,
    # data config
    rectangle_imgs = True,
    path_to_data='./facs',
    saved_paths='./paths.pkl',
    # path_to_data='/mnt/course/datasets/facs/',
    test_size = 0.1,
    batch_size = 16,
    img_height = 224,
    img_width = 224,
    n_emotions = 7,
    n_action_units = 41, # target action units
    landmark_size = 2*136, # number of features that provide dlib + delta coding
    n_frames = 10, # number of images in sequence
    # train config
    path_to_summaries = './summaries',
    path_to_log = './log.csv',
    path_to_models = './models',
    epochs = 100,
    max_queue_size = 100,
    workers = 1,
    au_map = {64.0: 40, 1.0: 0, 2.0: 3, 43.0: 33, 4.0: 4, 5.0: 5, 6.0: 6,
              1.5: 1, 9.0: 8, 10.0: 9, 11.0: 10, 12.0: 11, 13.0: 12, 14.0: 13,
              15.0: 14, 16.0: 15, 17.0: 16, 18.0: 17, 1.7: 2, 21.0: 19, 22.0: 20,
              23.0: 21, 24.0: 22, 25.0: 23, 26.0: 24, 27.0: 25, 28.0: 26,
              29.0: 27, 30.0: 28, 31.0: 29, 34.0: 30, 38.0: 31, 39.0: 32,
              7.0: 7, 44.0: 34, 45.0: 35, 54.0: 36, 20.0: 18, 61.0: 37,
              62.0: 38, 63.0: 39},
    emotion_map = {
        0:'Anger',
        1:'Contempt',
        2:'Disgust',
        3:'Fear',
        4:'Happiness',
        5:'Sadness',
        6:'Surprise'
    }
    )
示例#7
0
文件: master.py 项目: lachinaj/pymosy
 def initialize(self):
     print("Initialize master:")
     self.config = Config.Config("Config/pymosy.conf")
     self.load_modules()
示例#8
0
      autostart, notifications, theme, fmextensions and daemons.

    The dictionary 'config' stores the config settings for usage in code. Its values are saved to
    config file on exit from the Menu.Preferences dialogue or when there is no configuration file
    when application starts.

    Note that daemon settings ('dir', 'read-only', 'overwrite' and 'exclude_dir') are stored
    in ~/ .config/yandex-disk/config.cfg file. They are read in YDDaemon.__init__() method
    (in dictionary YDDaemon.config). Their values are saved to daemon config file also
    on exit from Menu.Preferences dialogue.

    Additionally 'startonstartofindicator' and 'stoponexitfromindicator' values are added into daemon
    configuration file to provide the functionality of obsolete 'startonstart' and 'stoponexit'
    values for each daemon individually.
    """
    APPCONF = Config(pathJoin(APPCONFPATH, APPNAME + '.conf'))
    # Read some settings to variables, set default values and update some values
    APPCONF['autostart'] = checkAutoStart(APPAUTOSTARTDST)
    # Setup on-screen notification settings from config value
    APPCONF.setdefault('notifications', True)
    APPCONF.setdefault('theme', False)
    APPCONF.setdefault('fmextensions', True)
    APPCONF.setdefault('daemons', '~/.config/yandex-disk/config.cfg')
    # Is it a first run?
    if not APPCONF.readSuccess:
        LOGGER.info('No config, probably it is a first run.')
        # Create application config folders in ~/.config
        try:
            makeDirs(APPCONFPATH)
            makeDirs(pathJoin(APPCONFPATH, 'icons/light'))
            makeDirs(pathJoin(APPCONFPATH, 'icons/dark'))
示例#9
0
文件: config.py 项目: nau/arvi_course
from tools import Config

data_config = Config(path_to_train='./autoria/train',
                     path_to_test='./autoria/test',
                     valid_size=0.1,
                     batch_size=64,
                     img_height=224,
                     img_width=224)

train_config = Config(lr_min=1e-5,
                      lr_max=1e-3,
                      n_fozen_layers=[5, 15, 25],
                      path_to_summaries='./summaries',
                      path_to_log='./log.csv',
                      path_to_models='./models',
                      epochs=10,
                      max_queue_size=100,
                      workers=1)

config = Config(
    scope='classifier',
    data=data_config,
    train=train_config,
)
示例#10
0
            logging.info('dial_id %s:' % (ref_id))
            logging.info('Pred: %s' % (pred_sent))
            logging.info('Dialog Pred: %s' % (dialog_list))
            logging.info('Dialog: %s' % (dialog))
            logging.info('REs: %s' % (sents))
            logging.info('Entities: %s' % (entities))

        return all_refer


eval_path = os.path.join(SAVE_PATH, 'eval')
os.makedirs(eval_path, exist_ok=True)

#'''
config_path = osp.join(SAVE_PATH, 'config', 'trainer_config.yml')
cfg = Config(config_path)
print('load model from ', SAVE_PATH)
check_point = torch.load(os.path.join(
    SAVE_PATH, 'checkpoints', CHECKPOINT))  #,map_location = lambda _1,_2,:_1)

# load dataset
data_root = cfg.DATA_PATH
data_cfg = cfg.DATA
data_path = osp.join(data_root, data_cfg.DATA_SET, data_cfg.SPLIT + '_split')
vocab = load_vocab(data_path)
print('vocab_length:', len(vocab))
test_loader = VD_REGLoader(vocab, cfg, split=SPLIT)

model_cfg = cfg.MODEL
model = REGModel(vocab, cfg).cuda()
model.load_state_dict(check_point['state_dict'])
示例#11
0
from tools import Config

data_config = Config(
    path_to_data='/mnt/course/datasets/portraits/imgs',
    path_to_masks='/mnt/course/datasets/portraits/masks',
    test_size=0.1,
    batch_size=16,
    img_height=480,  #after resize
    img_width=400,  # after resize
    image_shape=(800, 600, 3)  # original
)

train_config = Config(lr_min=1e-5,
                      lr_max=1e-3,
                      n_fozen_layers=[5, 15, 25],
                      path_to_summaries='./summaries',
                      path_to_log='./log.csv',
                      path_to_models='./models',
                      epochs=10,
                      max_queue_size=100,
                      workers=1)

config = Config(
    scope='classifier',
    data=data_config,
    train=train_config,
)
示例#12
0
from tools import Config

config = Config(
    # data config
    path_to_train_data='./facs',
    test_size=0.1,
    batch_size=2,  ############################################
    img_height=48,  ############################################
    img_width=48,  ###############################################
    n_emotions=7,
    n_action_units=65,  # target action units
    landmark_size=136,  # number of features that provide dlib
    img_shape=(640, 490, 3),  # original image shape
    n_frames=10,  # number of images in sequence
    # train config
    path_to_summaries='./summaries',
    path_to_log='./log.csv',
    path_to_models='./models',
    epochs=100,
    max_queue_size=100,
    workers=1)
示例#13
0
文件: config.py 项目: nau/arvi_course
from tools import Config

config = Config(
    path_to_train_imgs='/mnt/course/datasets/coco/train2017',
    path_to_train_json='/mnt/course/datasets/coco/annotations/instances_train2017.json',
    path_to_test_imgs='/mnt/course/datasets/coco/val2017',
    path_to_test_json='/mnt/course/datasets/coco/annotations/instances_val2017.json',
    test_size = 0.1,
    batch_size = 2,
    img_height = 240, #after resize
    img_width = 320, # after resize
    n_classes = 80, # 80 classes
    n_obj = 10,

    #train config
    path_to_summaries = './summaries',
    path_to_log = './log.csv',
    path_to_models = './models',
    epochs = 100,
    max_queue_size = 100,
    workers = 1
    )

示例#14
0
from tools import Config

config = Config(
    path_to_texts='./OE',
    test_size = 0.1,
    batch_size = 1024,
    max_len = 100,


    #train config
    path_to_summaries = './summaries',
    path_to_log = './log.csv',
    path_to_models = './models',
    epochs = 200,
    max_queue_size = 100,
    workers = 1
    )