Git Product home page Git Product logo

Comments (4)

graviraja avatar graviraja commented on May 18, 2024 1

@renatoviolin convert them into list first and then zip it. Provide the key in sorted function. I modified the compute_pred_dict function as follows.

    raw_results_by_id = [(int(res["unique_id"] + 1), dict(res)) for res in raw_results]

    # Cast example id to int32 for each example, similarly to the raw results.
    sess = tf.Session()
    all_candidates = candidates_dict.items()
    example_ids = tf.to_int32(np.array([int(k) for k, _ in all_candidates
                                        ])).eval(session=sess)
    examples_by_id = list(zip(example_ids, all_candidates))

    # Cast unique_id also to int32 for features.
    feature_ids = []
    features = []
    for f in dev_features:
        feature_ids.append(f.features.feature["unique_ids"].int64_list.value[0] + 1)
        features.append(dict(f.features.feature))
    feature_ids = tf.to_int32(np.array(feature_ids)).eval(session=sess)
    features_by_id = list(zip(feature_ids, features))

    # Join examplew with features and raw results.
    examples = []
    merged = sorted(examples_by_id + raw_results_by_id + features_by_id, key=lambda x: x[0])

from language.

g-vallejo avatar g-vallejo commented on May 18, 2024

@graviraja did you manage to solve this issue? This is because you're probably using python3. I got over it changing a couple of lines, there are other python3 issues. For this one just replace "r" with "rb" in
lines 865 and 867. The reason why is here. I meant in run_nq.py

from language.

graviraja avatar graviraja commented on May 18, 2024

@gisvl yes i solved it. Thank you for your input.

from language.

renatoviolin avatar renatoviolin commented on May 18, 2024

@graviraja How did you solve the "TypeError: unsupported operand type(s) for +: 'zip' and 'list'" ?
I tried to cast to list, but fails inside sorted.
I remove the sorted and fails at end predictions.

from language.

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.