python里config_Python config.get_config方法代码示例
本文整理汇总了Python中config.get_config方法的典型用法代码示例。如果您正苦于以下问题:Python config.get_config方法的具体用法?Python config.get_config怎么用?Python config.get_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块config的用法示例。
在下文中一共展示了config.get_config方法的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: main
点赞 6
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def main(_):
gpu_options = tf.GPUOptions(
per_process_gpu_memory_fraction=calc_gpu_fraction(FLAGS.gpu_fraction))
with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) as sess:
config = get_config(FLAGS) or FLAGS
if config.env_type == 'simple':
env = SimpleGymEnvironment(config)
else:
env = GymEnvironment(config)
if not tf.test.is_gpu_available() and FLAGS.use_gpu:
raise Exception("use_gpu flag is true when no GPUs are available")
if not FLAGS.use_gpu:
config.cnn_format = 'NHWC'
agent = Agent(config, env, sess)
if FLAGS.is_train:
agent.train()
else:
agent.play()
开发者ID:devsisters,项目名称:DQN-tensorflow,代码行数:26,
示例2: init
点赞 6
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def init(browser_type):
""" Initialize the uwsgi worker which will read urls to archive from redis queue
and use associated web driver to connect to remote web browser
"""
logging.basicConfig(format='%(asctime)s: [%(levelname)s]: %(message)s',
level=logging.DEBUG)
logging.debug('WebDriver Worker Started')
config = get_config()
archives = config['archives']
rc = init_redis(config)
browser = get_avail_browser(config, rc, browser_type)
run(rc, browser, archives, config, browser_type)
开发者ID:ikreymer,项目名称:browsertrix,代码行数:19,
示例3: test
点赞 6
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def test(self):
from torch.utils.data import DataLoader
from lib.utils import Timer
from config import get_config
config = get_config()
dataset = SynthiaVoxelizationDataset(config)
timer = Timer()
data_loader = DataLoader(
dataset=dataset,
collate_fn=cfl_collate_fn_factory(limit_numpoints=False),
num_workers=0,
batch_size=4,
shuffle=True)
# Start from index 1
# for i, batch in enumerate(data_loader, 1):
iter = data_loader.__iter__()
for i in range(100):
timer.tic()
batch = iter.next()
print(batch, timer.toc())
开发者ID:chrischoy,项目名称:SpatioTemporalSegmentation,代码行数:25,
示例4: add_towel_mode
点赞 6
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def add_towel_mode(upd: Updater, handlers_group: int):
logger.info("registering towel-mode handlers")
dp = upd.dispatcher
# catch all new users and drop the towel
dp.add_handler(MessageHandler(Filters.status_update.new_chat_members, catch_new_user),
handlers_group)
# check for reply or remove messages
dp.add_handler(MessageHandler(
Filters.group & ~Filters.status_update, catch_reply),
handlers_group
)
# "i am a bot button"
dp.add_handler(CallbackQueryHandler(i_am_a_bot_btn), handlers_group)
# ban quarantine users, if time is gone
upd.job_queue.run_repeating(ban_user, interval=60, first=60, context={
"chat_id": get_config()["GROUP_CHAT_ID"]
})
开发者ID:egregors,项目名称:vldc-bot,代码行数:23,
示例5: destalinate_job
点赞 6
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def destalinate_job():
raven_client = RavenClient()
logging.info("Destalinating")
if not get_config().sb_token or not get_config().api_token:
logging.error(
"Missing at least one required Slack environment variable.\n"
"Make sure to set DESTALINATOR_SB_TOKEN and DESTALINATOR_API_TOKEN."
)
else:
try:
archiver.Archiver().archive()
warner.Warner().warn()
announcer.Announcer().announce()
flagger.Flagger().flag()
logging.info("OK: destalinated")
except Exception as e: # pylint: disable=W0703
raven_client.captureException()
if not get_config().sentry_dsn:
raise e
logging.info("END: destalinate_job")
开发者ID:randsleadershipslack,项目名称:destalinator,代码行数:23,
示例6: get_model
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def get_model(config=None):
if not None:
config, unparsed = get_config()
return get_trainer(config)
开发者ID:mkocaoglu,项目名称:CausalGAN,代码行数:6,
示例7: connect
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def connect(self):
config = get_config()
self.client = MongoClient(config['db.dsn'])
self.db = self.client[config['db.database']]
开发者ID:itspoma,项目名称:audio-fingerprint-identifying-python,代码行数:7,
示例8: connect
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def connect(self):
config = get_config()
self.conn = sqlite3.connect(config['db.file'])
self.conn.text_factory = str
self.cur = self.conn.cursor()
print(colored('sqlite - connection opened','white',attrs=['dark']))
开发者ID:itspoma,项目名称:audio-fingerprint-identifying-python,代码行数:11,
示例9: init
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def init():
""" Init the application and add routes """
logging.basicConfig(format='%(asctime)s: [%(levelname)s]: %(message)s',
level=logging.DEBUG)
global theconfig
theconfig = get_config()
global rc
rc = init_redis(theconfig)
app = default_app()
return app
开发者ID:ikreymer,项目名称:browsertrix,代码行数:17,
示例10: test_get_config
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def test_get_config(self):
c: Dict = get_config()
self.assertEqual(c["DEBUG"], self.env_debug)
self.assertEqual(c["GROUP_CHAT_ID"], self.env_chat_id)
self.assertEqual(c["TOKEN"], self.env_token)
self.assertEqual(c["MONGO_USER"], self.env_mongo_initdb_root_username)
self.assertEqual(c["MONGO_PASS"], self.env_mongo_initdb_root_password)
开发者ID:egregors,项目名称:vldc-bot,代码行数:9,
示例11: __init__
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def __init__(self, satoshis=0):
super(Amount, self).__init__()
self.satoshis = satoshis
self.config = config.get_config()
self.fmt = self.config.get_option('amount_format', 'satoshis')
开发者ID:mazaclub,项目名称:hashmal,代码行数:7,
示例12: main
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def main(_):
with tf.Session() as sess:
config = get_config(FLAGS)
env = MyEnvironment(config)
agent = Agent(config, env, sess)
if FLAGS.is_train:
agent.train()
else:
if FLAGS.dataset == 'mine':
agent.play_mine()
else:
agent.play()
开发者ID:yuke93,项目名称:RL-Restore,代码行数:15,
示例13: predictByPart
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def predictByPart(data, peaks):
classesM = ['N','Ventricular','Paced','A','F','Noise']#,'L','R','f','j','E','a','J','Q','e','S']
predicted = list()
result = ""
counter = [0]* len(classesM)
from keras.models import load_model
model = load_model('models/MLII-latest.hdf5')
config = get_config()
for i, peak in enumerate(peaks[3:-1]):
total_n =len(peaks)
start, end = peak-config.input_size//2 , peak+config.input_size//2
prob = model.predict(data[:, start:end])
prob = prob[:,0]
ann = np.argmax(prob)
counter[ann]+=1
if classesM[ann] != "N":
print("The {}/{}-record classified as {} with {:3.1f}% certainty".format(i,total_n,classesM[ann],100*prob[0,ann]))
result += "("+ classesM[ann] +":" + str(round(100*prob[0,ann],1)) + "%)"
predicted.append([classesM[ann],prob])
if classesM[ann] != 'N' and prob[0,ann] > 0.95:
import matplotlib.pyplot as plt
plt.plot(data[:, start:end][0,:,0],)
mkdir_recursive('results')
plt.savefig('results/hazard-'+classesM[ann]+'.png', format="png", dpi = 300)
plt.close()
result += "{}-N, {}-Venticular, {}-Paced, {}-A, {}-F, {}-Noise".format(counter[0], counter[1], counter[2], counter[3], counter[4], counter[5])
return predicted, result
开发者ID:physhik,项目名称:ecg-mit-bih,代码行数:29,
示例14: main
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def main():
testing_file = "./new_data/test.ann.json"
trained_model = "./checkpoints/model.ckpt"
embedding_file = "D:/DataMining/QASystem/wiki/wiki.zh.text.vector"
# embedding_file = "./wiki.zh.text.vector"
embedding_size = 60 # Word embedding dimension
batch_size = 64 # Batch data size
sequence_length = 150 # Sentence length
learning_rate = 0.01
gpu_mem_usage = 0.75
gpu_device = "/gpu:0"
cpu_device = "/cpu:0"
config = get_config() # Not used yet
embeddings, word2idx = load_embedding(embedding_file)
questions, evidences, y1, y2 = load_data(testing_file, word2idx, sequence_length)
with tf.Graph().as_default(), tf.device(gpu_device):
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_mem_usage)
session_conf = tf.ConfigProto(allow_soft_placement=True, gpu_options=gpu_options)
with tf.variable_scope('Model'):
model = DGCNN(config, embeddings, sequence_length, embedding_size)
with tf.Session(config=session_conf).as_default() as sess:
saver = tf.train.Saver()
print("Start loading the model")
saver.restore(sess, trained_model)
print("The model is loaded")
acc1, acc2 = [], []
for batch_questions, batch_evidences, batch_y1, batch_y2 in next_batch(questions, evidences, y1, y2, batch_size):
feed_dict = {
model.e: batch_evidences,
model.q: batch_questions,
model.y1: batch_y1,
model.y2: batch_y2,
model.is_train: False
}
acc1_, acc2_ = sess.run([model.acc1, model.acc2], feed_dict)
acc1.append(acc1_)
acc2.append(acc2_)
print('Acc1 %2.3f\tAcc2 %2.3f' % (acc1_, acc2_))
print('Average: Acc1 %2.3f\tAcc2 %2.3f' % (np.mean(acc1), np.mean(acc2)))
开发者ID:Chiang97912,项目名称:DGCNN,代码行数:42,
示例15: main
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def main ():
# parse configuration
config, _ = get_config()
# set visible GPUs
os.environ['CUDA_VISIBLE_DEVICES'] = config.gpu
if config.test:
run_test (config)
else:
run_train (config)
# end of main
开发者ID:TAMU-VITA,项目名称:ALISTA,代码行数:13,
示例16: schedule_job
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def schedule_job():
# When testing changes, set the "TEST_SCHEDULE" envvar to run more often
if get_config().test_schedule:
schedule_kwargs = {"hour": "*", "minute": "*/10"}
else:
schedule_kwargs = {"hour": get_config().schedule_hour}
sched = BlockingScheduler()
sched.add_job(destalinate_job, "cron", **schedule_kwargs)
sched.start()
开发者ID:randsleadershipslack,项目名称:destalinator,代码行数:12,
示例17: main
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def main():
# Use RUN_ONCE to only run the destalinate job once immediately
if get_config().run_once:
destalinate_job()
else:
schedule_job()
开发者ID:randsleadershipslack,项目名称:destalinator,代码行数:8,
示例18: set_up_slack_logger
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def set_up_slack_logger(slackbot=None):
"""
Sets up a handler and formatter on a given `logging.Logger` object.
* `log_level_env_var` - Grabs logging level from this ENV var. Possible values are standard: "debug", "error", etc.
* `log_to_slack_env_var` - Points to an ENV var that indicates whether to log to a Slack channel.
* `log_channel` - Indicates the name of the Slack channel to which we'll send logs.
* `default_level` - The default log level if one is not set in the environment.
* `slackbot` - A slackbot.Slackbot() object ready to send messages to a Slack channel.
"""
logger = logging.getLogger()
if logger.handlers:
# We've likely already ran through the rest of this method:
return
_config = get_config()
slack_log_level = getattr(logging, _config.log_level.upper(), logging.INFO)
formatter = logging.Formatter('%(asctime)s [%(levelname)s]: %(message)s')
logger.setLevel(logging.DEBUG)
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(formatter)
logger.addHandler(stream_handler)
if _config.log_to_channel and _config.log_channel and slackbot:
logger.debug("Logging to slack channel: %s", _config.log_channel)
slack_handler = SlackHandler(slackbot=slackbot, level=slack_log_level)
slack_handler.setFormatter(formatter)
logger.addHandler(slack_handler)
开发者ID:randsleadershipslack,项目名称:destalinator,代码行数:36,
示例19: test_environment_variable_configs
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def test_environment_variable_configs(self):
self.assertEqual(get_config().string_variable, 'test')
self.assertListEqual(get_config().list_variable, ['test'])
开发者ID:randsleadershipslack,项目名称:destalinator,代码行数:5,
示例20: mocked_slacker_object
点赞 5
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def mocked_slacker_object(channels_list=None, users_list=None, messages_list=None, emoji_list=None):
slacker_obj = slacker.Slacker(get_config().slack_name, token='token', init=False)
slacker_obj.get_all_channel_objects = mock.MagicMock(return_value=channels_list or [])
slacker_obj.get_channels()
slacker_obj.get_all_user_objects = mock.MagicMock(return_value=users_list or [])
slacker_obj.get_users()
slacker_obj.get_messages_in_time_range = mock.MagicMock(return_value=messages_list or [])
slacker_obj.get_emojis = mock.MagicMock(return_value=emoji_list or [])
return slacker_obj
开发者ID:randsleadershipslack,项目名称:destalinator,代码行数:15,
示例21: get_trainer
点赞 4
# 需要导入模块: import config [as 别名]
# 或者: from config import get_config [as 别名]
def get_trainer():
print('tf: resetting default graph!')
tf.reset_default_graph()#for repeated calls in ipython
####GET CONFIGURATION####
#TODO:load configurations from previous model when loading previous model
##if load_path:
#load config files from dir
#except if pt_load_path, get cc_config from before
#overwrite is_train, is_pretrain with current args--sort of a mess
##else:
config,_=get_config()
cc_config,_=get_cc_config()
dcgan_config,_=get_dcgan_config()
began_config,_=get_began_config()
###SEEDS###
np.random.seed(config.seed)
#tf.set_random_seed(config.seed) # Not working right now.
prepare_dirs_and_logger(config)
if not config.load_path:
print('saving config because load path not given')
save_configs(config,cc_config,dcgan_config,began_config)
#Resolve model differences and batch_size
if config.model_type:
if config.model_type=='dcgan':
config.batch_size=dcgan_config.batch_size
cc_config.batch_size=dcgan_config.batch_size # make sure the batch size of cc is the same as the image model
config.Model=CausalGAN.CausalGAN
model_config=dcgan_config
if config.model_type=='began':
config.batch_size=began_config.batch_size
cc_config.batch_size=began_config.batch_size # make sure the batch size of cc is the same as the image model
config.Model=CausalBEGAN.CausalBEGAN
model_config=began_config
else:#no image model
model_config=None
config.batch_size=cc_config.batch_size
if began_config.is_train or dcgan_config.is_train:
raise ValueError('need to specify model_type for is_train=True')
#Interpret causal_model keyword
cc_config.graph=get_causal_graph(config.causal_model)
#Builds and loads specified models:
trainer=Trainer(config,cc_config,model_config)
return trainer
开发者ID:mkocaoglu,项目名称:CausalGAN,代码行数:55,
注:本文中的config.get_config方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。
python里config_Python config.get_config方法代码示例相关推荐
- python里defoults_Python Part.Compound方法代码示例
本文整理汇总了Python中Part.Compound方法的典型用法代码示例.如果您正苦于以下问题:Python Part.Compound方法的具体用法?Python Part.Compound怎么 ...
- python batch_size_Python config.batch_size方法代码示例
本文整理汇总了Python中config.batch_size方法的典型用法代码示例.如果您正苦于以下问题:Python config.batch_size方法的具体用法?Python config. ...
- python cpu count_Python multiprocessing.cpu_count方法代码示例
本文整理汇总了Python中multiprocessing.cpu_count方法的典型用法代码示例.如果您正苦于以下问题:Python multiprocessing.cpu_count方法的具体用 ...
- python socket send_Python socket.send方法代码示例
本文整理汇总了Python中socket.send方法的典型用法代码示例.如果您正苦于以下问题:Python socket.send方法的具体用法?Python socket.send怎么用?Pyth ...
- python apache benchmark_Python cudnn.benchmark方法代码示例
本文整理汇总了Python中torch.backends.cudnn.benchmark方法的典型用法代码示例.如果您正苦于以下问题:Python cudnn.benchmark方法的具体用法?Pyt ...
- python logger.exception_Python logger.warn方法代码示例
本文整理汇总了Python中pip.log.logger.warn方法的典型用法代码示例.如果您正苦于以下问题:Python logger.warn方法的具体用法?Python logger.warn ...
- python logging logger_Python logging.Logger方法代码示例
本文整理汇总了Python中logging.Logger方法的典型用法代码示例.如果您正苦于以下问题:Python logging.Logger方法的具体用法?Python logging.Logge ...
- g的python实现_Python flask.g方法代码示例
本文整理汇总了Python中flask.g方法的典型用法代码示例.如果您正苦于以下问题:Python flask.g方法的具体用法?Python flask.g怎么用?Python flask.g使用 ...
- python yaml dump_Python yaml.safe_dump方法代码示例
本文整理汇总了Python中ruamel.yaml.safe_dump方法的典型用法代码示例.如果您正苦于以下问题:Python yaml.safe_dump方法的具体用法?Python yaml.s ...
最新文章
- 架构设计开发方式汇总
- eclipse打包项目为aar_Eclipse中使用AAR
- PHP快速获取MySQL数据库表结构
- 【AI面试题】GBDT原理、如何用于分类、常用损失函数
- 反转字符串中的元音字符
- 提高linux运行速度,教你如何提高Linux操作系统的运行速度
- 网站部署——基于Django框架的天天生鲜电商网站项目系列博客(十六)
- GD32移植FATFS文件系统
- win7计算机序列号在哪里,win7系统如何查看主板序列号?win7系统查看主板序列号的详细步骤图文教程...
- 林业病虫害数据集介绍
- 宽带服务器光信号亮红灯,宽带的光信号一直闪红灯是为什么
- 2022年下半场,Plug and Play重点关注的品牌和零售创新是?
- 交付管理——怎样控制项目进度
- 离散数学与组合数学-02二元关系上
- C语言:树与二叉树的转换
- Unity无缝地图研究
- 风扇--DLTAP703SC--单片机--杰力科创
- java p12证书验证_p12格式的安全证书在Java项目中使用
- Socket的通信原理和使用
- Elasticsearch 权威教程 - 入门
热门文章
- 在计算机网络的定义中,一个计算机网络包含多台具,计算机网络本1412模拟卷2_答案...
- linux系统下扩容vg大小
- Winter my wiffffe!
- RTOS系列文章(2):PendSV功能,为什么需要PendSV
- Winform中DataGridView设置前景色、单元格背景色、标题栏样式、禁止改变高宽、不显示空白行、清除选中样式、填充数据源、设置标题、设置单列宽度
- java criteria创建_Java hibernate如何创建一个Criteria对象?
- 用eclipse和Tomcat写一个简易聊天室
- ubuntu18.04 muduo编译安装
- 新媒体月薪4.5万?看完人民日报的招聘我傻了
- 情迁QQ机器人已具备图片发送能力