kingfengji / gcForest

This is the official implementation for the paper 'Deep forest: Towards an alternative to deep neural networks'
http://lamda.nju.edu.cn/code_gcForest.ashx
1.31k stars 425 forks source link

NameError: name 'basestring' is not defined #39

Closed 1earner closed 6 years ago

1earner commented 6 years ago

I download the latest verion of gfForest. and build the environment. When I use the commander as "python examples/demo_mnist.py --model examples/demo_mnist-gc.json", the messager is follow as: Using TensorFlow backend.

Traceback (most recent call last): File "/home/cf/Documents/gcForest/examples/demo_mnist.py", line 55, in gc = GCForest(config) File "lib/gcforest/gcforest.py", line 16, in init self.fg = FGNet(self.config["net"], self.train_config.data_cache) File "lib/gcforest/fgnet.py", line 36, in init layer = get_layer(layer_config, self.data_cache) File "lib/gcforest/layers/init.py", line 32, in get_layer layer = layer_class(layer_config, data_cache) File "lib/gcforest/layers/fg_pool_layer.py", line 27, in init self.pool_method = self.get_value("pool_method", "avg", basestring) NameError: name 'basestring' is not defined

I think maybe the varable 'basestring'. Would you like fix this bug?

Beside this, there is another bug in this version: line 26 in base_layer.py

def get_value(self, key, default_value, value_types, required=False, config=None): return get_config_value(config or self.layer_config, key, default_value, value_types, required=required, config_name=self.name) return value

this function has two return sentence. @kingfengji

kingfengji commented 6 years ago

@1earner hi.

  1. that's the python version problem, a) try py2.7 or b) change basestring to six.string_types (and remember to import six) if you are using py3.5
  2. that's not a bug, I never intended to return the second return(i.e. the second return will never show up, it was for debugging propose). thanks