Giter Site home page Giter Site logo

Comments (6)

JiyangZhang avatar JiyangZhang commented on May 27, 2024 1

Sweet! I found that I dumped max_contexts rather than max_data_contexts into dictionary. Now it is successfully reading the data.

Thank you very much.

from code2seq.

JiyangZhang avatar JiyangZhang commented on May 27, 2024

Just curious about what results in the error

from code2seq.

urialon avatar urialon commented on May 27, 2024

Hi @JiyangZhang ,
Thank you for your interest in code2seq!

I am aware that sometimes the reader tries to read a batch, and 10 examples are not even enough for a single batch.

But I think that in your case, the error is not even related to the number of examples, but to the number of paths ("contexts") in each example. The reader expects 201 fields, which are 1 target sequence and 200 contexts. Did you preprocess your data with other numbers than the defaults for MAX_CONTEXTS and MAX_DATA_CONTEXTS?

from code2seq.

JiyangZhang avatar JiyangZhang commented on May 27, 2024

Hi @urialon ,

Thanks for the reply and that makes sense. But I used the default value of MAX_CONTEXTS, which is 200 and MAX_DATA_CONTEXTS, which is 1000. I checked my 'data.train.c2s', every context is padded to length of 1000. I am not sure what is the reason.

I still think the reason is the dict, because it works whenever I use your dict. The way I create dict is just dumping three histograms and the numbers (same with preprocess.py).

Thank you very much!

from code2seq.

urialon avatar urialon commented on May 27, 2024

Let's compare the dict files.

Please run the following code separately on the two dictionary files, changing DICT_FILE_PATH every time:

with open(DICT_FILE_PATH, 'rb') as file:
                subtoken_to_count = pickle.load(file)
                node_to_count = pickle.load(file)
                target_to_count = pickle.load(file)
                max_contexts = pickle.load(file)
                self.num_training_examples = pickle.load(file)
                print('Dictionaries loaded.')

what is max_contexts in each case?

from code2seq.

urialon avatar urialon commented on May 27, 2024

Also note that self.config.DATA_NUM_CONTEXTS needs to be 0 such that the value of max_contexts from the dict file will be loaded:
https://github.com/tech-srl/code2seq/blob/master/model.py#L42

from code2seq.

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.