Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow no module named official

I am trying to use the nets from the official mnist directory of tensorflows model repository. On my windows system I receive this error:

C:\Users\ry\Desktop\NNTesting\models\official\mnist>mnist_test.py
Traceback (most recent call last):
  File "C:\Users\ry\Desktop\NNTesting\models\official\mnist\mnist_test.py",line 24, in <module>
    from official.mnist import mnist
ModuleNotFoundError: No module named 'official'

I have followed their official directions and set my python path using

set PYTHONPATH="PYTHONPATH:"%cd%"

and can confirm that

PYTHONPATH="$PYTHONPATH:C:\Users\ry\Desktop\NNTesting\models"

and I have also installed the dependencies successfully. Does anyone have experience using these models on a windows system and can help me with this pathing issue? I'm not sure what I have done incorrectly here.

Thanks

like image 727
Ryan Brady Avatar asked May 01 '18 18:05

Ryan Brady


3 Answers

pip install tf-models-official
like image 132
Elvin Aghammadzada Avatar answered Oct 22 '22 01:10

Elvin Aghammadzada


For Google Colab I needed to add the the model dir also to the Systems path:

!git clone https://github.com/tensorflow/models.git

import os
os.environ['PYTHONPATH'] += ":/content/models"

import sys
sys.path.append("/content/models")
like image 27
Paul Bauriegel Avatar answered Oct 22 '22 03:10

Paul Bauriegel


if anyone has this problem make sure that the python path variable doesn't have quotations in it. For some reason, the readme has quotations around it.

Here is the correct way to set it

PYTHONPATH=path\to\models
like image 22
Ryan Brady Avatar answered Oct 22 '22 02:10

Ryan Brady