18739-hws/hw4/w2v_utils.py
def load_saved_params():
    """ A helper function that loads previously saved parameters and resets iteration start """
    st = 0
    for f in glob.glob("saved_params_*.npy"):
        iter = int(op.splitext(op.basename(f))[0].split("_")[2])
        if (iter > st):
            st = iter
            
    if st > 0:
        with open("saved_params_%d.npy" % st, "rb") as f:
            params = pickle.load(f)
            state = pickle.load(f)
        return st, params, state
    else:
        return st, None, None
 A helper function that loads previously saved parameters and resets iteration start 
A helper function that loads previously saved parameters and resets iteration start
A helper function that loads previously saved parameters and resets iteration start
def load_saved_params():
    st = 0
    for f in glob.glob("saved_params_*.npy"):
        iter = int(op.splitext(op.basename(f))[0].split("_")[2])
        if (iter > st):
            st = iter
    if st > 0:
        with open("saved_params_%d.npy" % st, "rb") as f:
            params = pickle.load(f)
            state = pickle.load(f)
        return st, params, state
    else:
        return st, None, None
def load_saved_params ( ) : st = 0 for f in glob . glob ( "saved_params_*.npy" ) : iter = int ( op . splitext ( op . basename ( f ) ) [ 0 ] . split ( "_" ) [ 2 ] ) if ( iter > st ) : st = iter if st > 0 : with open ( "saved_params_%d.npy" % st , "rb" ) as f : params = pickle . load ( f ) state = pickle . load ( f ) return st , params , state else : return st , None , None
A helper function that loads previously saved parameters and resets iteration start
A helper function that loads previously saved parameters and resets iteration start
""" A helper function that loads previously saved parameters and resets iteration start """