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

[BUG] Basic client: 'Syncer' has no attribute 'instance' #259

Closed
ThanhTran81 opened this issue Aug 4, 2017 · 4 comments
Closed

[BUG] Basic client: 'Syncer' has no attribute 'instance' #259

ThanhTran81 opened this issue Aug 4, 2017 · 4 comments
Assignees

Comments

@ThanhTran81
Copy link

i was able to setup the server and successfully ran all the code in https://github.com/mitdbg/modeldb/tree/master/client/python/samples/sklearn.
However when i tried the basic client, all the samples code in here https://github.com/mitdbg/modeldb/tree/master/client/python/samples/basic yields this error Syncer.instance.add_to_buffer(fit_event)
AttributeError: type object 'Syncer' has no attribute 'instance'

@AndrewDotson
Copy link

I also seem to be to having this issue. I'm trying to run a slightly modified version of the BasicWorkflow.py. My file dies on the line "syncer_obj.sync_model("train", model_config1, mdb_model1)" with the same error as reported above.

Everything else works just fine; I'm able to sync and view the model.

I'm running ModelDB on an Ubuntu 16 VM. I have attached the file I'm trying to run below.

from modeldb.basic.Structs import (
    Model, ModelConfig, ModelMetrics, Dataset)
from modeldb.basic.ModelDbSyncerBase import *
import pyspark

# Create a syncer using a convenience API
# syncer_obj = Syncer.create_syncer("gensim test", "test_user", \
#     "using modeldb light logging")

# Example: Create a syncer from a config file
syncer_obj = Syncer.create_syncer_from_config("/home/testuser/modeldb/client/syncer.json")

# Create a syncer using a convenience API
#syncer_obj = Syncer.create_syncer("Sample Project", "test_user", "sample description")
# or
# Create a syncer explicitly
#syncer_obj = Syncer(
#    NewOrExistingProject("PySpark_test", "Andrew", "pyspark test using modeldb light logging"),
#    DefaultExperiment(),
#    NewExperimentRun("", "sha_A1B2C3D4"))

# Example: Create a syncer from an existing experiment run
# experiment_run_id = int(sys.argv[len(sys.argv) - 1])
# syncer_obj = Syncer.create_syncer_for_experiment_run(experiment_run_id)

print "I'm training some model"

# create Datasets by specifying their filepaths and optional metadata
# associate a tag (key) for each Dataset (value)
datasets = {
    "train": Dataset("/home/testuser/modeldb/data/titanic_train.csv", {"num_cols": 12,}),
    "test": Dataset("/home/testuser/modeldb/data/titanic_test.csv", {"num_cols": 12,})
}

# create the Model, ModelConfig, and ModelMetrics instances
model = "model_obj"
mdb_model1 = Model("LogReg", model, "client/python/samples/sklearn/Titanic-LogisticRegression.py")
model_config1 = ModelConfig("NN", {"l1": 10})
model_metrics1 = ModelMetrics({"accuracy": 0.8})

#mdb_model2 = Model("NN", model, "/path/to/model2")
#model_config2 = ModelConfig("NN", {"l1": 20})
#model_metrics2 = ModelMetrics({"accuracy": 0.9})

syncer_obj.sync_datasets(datasets)

syncer_obj.sync_model("train", model_config1, mdb_model1)
syncer_obj.sync_metrics("test", mdb_model1, model_metrics1)

#syncer_obj.sync_model("train", model_config2, mdb_model2)
#syncer_obj.sync_metrics("test", mdb_model2, model_metrics2)

syncer_obj.sync()

@AndrewDotson
Copy link

I was able to fix this problem by modifying the 'sync_model' and 'sync_metrics' methods in /usr/local/lib/python2.7/dist-packages/modeldb/basic/ModelDbSyncerBase.py. I changed Syncer.instance.add_to_buffer() to self.add_to_buffer() and the script ran.

I don't know what other issues this fix may cause, but so far I've not noticed any.

@justinanderson
Copy link
Contributor

It looks like this is a problem with the pip distribution of modeldb. If you build from source it works without modification.

I'll see about updating the PyPi distribution.

@justinanderson justinanderson self-assigned this Aug 25, 2017
@justinanderson
Copy link
Contributor

Resolved by updating the PyPi distribution. New version is 0.0.1a29.

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

3 participants