Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 0 #37

Closed
RygarNelson opened this issue Mar 9, 2021 · 2 comments
Closed

KeyError: 0 #37

RygarNelson opened this issue Mar 9, 2021 · 2 comments

Comments

@RygarNelson
Copy link

I'm trying to run the example provided by the tool in the README file. After many fixed error, I have found this one and I have no solution.

The error

Traceback (most recent call last):
  File "d:/Tesi_Magistrale/google_model_search/test.py", line 14, in <module>
    trainer.try_models(
  File "d:\Tesi_Magistrale\google_model_search\model_search\single_trainer.py", line 56, in try_models
    phoenix_instance = phoenix.Phoenix(
  File "d:\Tesi_Magistrale\google_model_search\model_search\phoenix.py", line 244, in __init__
    self._controller = controller.InProcessController(
  File "d:\Tesi_Magistrale\google_model_search\model_search\controller.py", line 147, in __init__
    self._search_candidate_generator = SearchCandidateGenerator(
  File "d:\Tesi_Magistrale\google_model_search\model_search\generators\search_candidate_generator.py", line 57, in __init__
    self._search_algorithm = search_algorithms[phoenix_spec.search_type]
KeyError: 0

The code I'm running

import model_search
from model_search import constants
from model_search import single_trainer
from model_search.data import csv_data

trainer = single_trainer.SingleTrainer(
    data=csv_data.Provider(
    label_index=0,
    logits_dimension=2,
    record_defaults=[0, 0, 0, 0],
    filename="model_search/data/testdata/csv_random_data.csv"),
    spec=constants.DEFAULT_DNN)

trainer.try_models(
    number_models=200,
    train_steps=1000,
    eval_steps=100,
    root_dir="/tmp/run_example",
    batch_size=32,
    experiment_name="example",
    experiment_owner="model_search_user")

I have no idea on what I need to check for the resolution.

@praneethkv
Copy link

praneethkv commented Mar 11, 2021

import sys
from absl import app

#Addresses UnrecognizedFlagError: Unknown command line flag 'f'
sys.argv = sys.argv[:1]

#app.runcallssys.exit`
try:
app.run(lambda argv: None)
except:
pass

Paste the above code after you import packages and before initializing the trainer,
and also change the spec to "model_search/configs/dnn_config.pbtxt"

This should work
PS: Do the indentation part with try and except as indents are not allowed in text comment

@RygarNelson
Copy link
Author

Thank you very much. The problem has been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants