1 Star 0 Fork 0

关云长/ELF

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
train_lstm.py 1.14 KB
Copy Edit Raw Blame History
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from datetime import datetime
import sys
import os
from rlpytorch import LSTMTrainer, Sampler, SingleProcessRun, load_env, ModelLoader, ArgsProvider, ModelInterface
if __name__ == '__main__':
trainer = LSTMTrainer()
runner = SingleProcessRun()
env, all_args = load_env(os.environ, trainer=trainer, runner=runner)
GC = env["game"].initialize()
model = env["model_loaders"][0].load_model(GC.params)
mi = ModelInterface()
mi.add_model("model", model, optim_params={ "lr" : 0.001})
mi.add_model("actor", model, copy=True, cuda=all_args.gpu is not None, gpu_id=all_args.gpu)
trainer.setup(sampler=env["sampler"], mi=mi, rl_method=env["method"])
GC.reg_callback("train", trainer.train)
GC.reg_callback("actor", trainer.actor)
runner.setup(GC, episode_summary=trainer.episode_summary,
episode_start=trainer.episode_start)
runner.run()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/632484753/ELF.git
git@gitee.com:632484753/ELF.git
632484753
ELF
ELF
master

Search

23e8dbc6 1850385 7e0993f3 1850385