dalejn / cleanBib

Probabilistically assign gender and race proportions of first/last authors pairs in bibliography entries
MIT License
149 stars 31 forks source link

AttributeError: 'str' object has no attribute 'decode' #22

Closed danizoeller closed 3 years ago

danizoeller commented 3 years ago

Hi, first, thank you so much for providing this tool! I have used it before without any issues, but when I tried to run it today I got the error message below in Step 4. Do know know what could be the issue? Thanks a lot! Daniela

grafik

first author is Daniela Zöller last author is Dimitri Van~De~Ville we don't count these, but check the predictions file to ensure your names did not slip through! looping through your references, predicting gender and race


AttributeError Traceback (most recent call last)

in 114 names = [{'lname': fa_lname,'fname':fa_fname}] 115 fa_df = pd.DataFrame(names,columns=['fname','lname']) --> 116 asian,hispanic,black,white = pred_fl_reg_name(fa_df,'lname','fname').values[0][-4:] 117 fa_race = [white,asian,hispanic,black] 118 /srv/conda/envs/notebook/lib/python3.7/site-packages/ethnicolr/pred_fl_reg_name.py in pred_fl_reg_name(cls, df, lname_col, fname_col) 74 cls.race = rdf.race.tolist() 75 ---> 76 cls.model = load_model(MODEL) 77 78 # build X from index of n-gram sequence /srv/conda/envs/notebook/lib/python3.7/site-packages/tensorflow/python/keras/saving/save.py in load_model(filepath, custom_objects, compile, options) 180 if (h5py is not None and ( 181 isinstance(filepath, h5py.File) or h5py.is_hdf5(filepath))): --> 182 return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile) 183 184 filepath = path_to_string(filepath) /srv/conda/envs/notebook/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py in load_model_from_hdf5(filepath, custom_objects, compile) 174 if model_config is None: 175 raise ValueError('No model found in config file.') --> 176 model_config = json.loads(model_config.decode('utf-8')) 177 model = model_config_lib.model_from_config(model_config, 178 custom_objects=custom_objects) AttributeError: 'str' object has no attribute 'decode'
dalejn commented 3 years ago

Hi Daniela,

Great to hear from you! Thanks for using the tool :)

Could you send me your .bib file by attaching it as a .txt file, sending a Dropbox or Google Drive link, or emailing it to me? I'll take a look.

dalejn commented 3 years ago

Until I figure it out, please use this Binder link to the previous commit that still worked:

https://mybinder.org/v2/gh/dalejn/cleanBib/fde08d31b90cba48e42fb2cccf4695b725048eea

dalejn commented 3 years ago

Fixed--issue was some requirements not being set, so new versions were installed by default on rebuild that broke prior dependencies. Tested and it works with the main link now.