Giter Site home page Giter Site logo

Comments (4)

 avatar commented on September 7, 2024

BTW, this is what I used to build the model.npz.pkl for the model argument -

import capgen as cp
import numpy as np
import cPickle as c
from collections import OrderedDict
import theano

options = {'dim_word':100,  # word vector dimensionality
          'ctx_dim':512,  # context vector dimensionality
          'dim':1000,  # the number of LSTM units
          'attn_type':'stochastic',  # [see section 4 from paper]
          'n_layers_att':1,  # number of layers used to compute the attention weights
          'n_layers_out':1,  # number of layers used to compute logit
          'n_layers_lstm':1,  # number of lstm layers
          'n_layers_init':1,  # number of layers to initialize LSTM at time 0
          'lstm_encoder':False,  # if True, run bidirectional LSTM on input units
          'prev2out':False,  # Feed previous word into logit
          'ctx2out':False,  # Feed attention weighted ctx into logit
          'alpha_entropy_c':0.002,  # hard attn param
          'RL_sumCost':True,  # hard attn param
          'semi_sampling_p':0.5,  # hard attn param
          'temperature':1.,  # hard attn param
          'patience':10,
          'max_epochs':5000,
          'dispFreq':100,
          'decay_c':0.,  # weight decay coeff
          'alpha_c':0.,  # doubly stochastic coeff
          'lrate':0.01,  # used only for SGD
          'selector':False,  # selector (see paper)
          'n_words':10000,  # vocab size
          'maxlen':100,  # maximum length of the description
          'optimizer':'adam',
          'batch_size ': 16,
          'valid_batch_size ': 16,
          'saveto':'model.npz',  # relative path of saved model file
          'validFreq':1000,
          'saveFreq':1000,  # save the parameters after every saveFreq updates
          'sampleFreq':100,  # generate some samples after every sampleFreq updates
          'dataset':'flickr30k',
          'dictionary':None,  # word dictionary
          'use_dropout':False,  # setting this true turns on dropout at various points
          'use_dropout_lstm':False,  # dropout on lstm gates
          'reload_':True,
          'save_per_epoch':False}
params = cp.init_params(options)
for kk, pp in options.iteritems():
    params[kk] = options[kk]
tparams = OrderedDict()
print type(tparams)
for kk, pp in params.iteritems():
    tparams[kk] = theano.shared(params[kk], name=kk)
f = open('/home/f0z/feat/flickr30k/model.npz.pkl', 'wb')
c.dump(params, f)

from arctic-captions.

 avatar commented on September 7, 2024

The issue is resolved by importing capgen inside the process.

from arctic-captions.

noureldien avatar noureldien commented on September 7, 2024

@f0z Please, was you able to replicate the results of the paper using these hyperparameters on flickr_30k? How long (how many training epoch) did it take? Thank you.

from arctic-captions.

JunjieHu avatar JunjieHu commented on September 7, 2024

@f0z I have the same problem. Can you describe more specifically where you import capgen? I try import capgen at the beginning of the function gen_model() in the file of generate_caps.py. But it doesn't resolve the problem. Thanks

from arctic-captions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.