-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdynet_helper.py
27 lines (24 loc) · 985 Bytes
/
dynet_helper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
try:
assert '--dynet-viz' not in sys.argv and \
'--dynet-gpu' not in sys.argv and \
not ('--dynet-gpus' in sys.argv or '--dynet-gpu-ids' in sys.argv)
from _dynet import *
except AssertionError:
if '--dynet-viz' in sys.argv:
sys.argv.remove('--dynet-viz')
from dynet_viz import *
elif '--dynet-gpu' in sys.argv: # the python gpu switch.
sys.argv.remove('--dynet-gpu')
def print_graphviz(**kwarge):
print("Run with --dynet-viz to get the visualization behavior.")
from _gdynet import *
elif '--dynet-gpus' in sys.argv or '--dynet-gpu-ids' in sys.argv: # but using the c++ gpu switches suffices to trigger gpu.
def print_graphviz(**kwarge):
print("Run with --dynet-viz to get the visualization behavior.")
from _gdynet import *
__version__ = 2.0
params = DynetParams()
params.set_random_seed(42)
params.set_weight_decay(1e-6)
init_from_params(params)