2017-06-27 9 views
0

私はGoogle Cloudを使用してテストを行っていますが、ガイドに従ってBigQueryをテストしています。私は、スクリプトを実行したときにhttps://cloud.google.com/solutions/using-cloud-dataflow-for-batch-predictions-with-tensorflowGoogle DataflowにAttributeErrorが表示されます: 'モジュール'オブジェクトに '読み取り'属性がありません

python prediction/run.py \ 
--runner DataflowRunner \ 
--project $PROJECT \ 
--staging_location $BUCKET/staging \ 
--temp_location $BUCKET/temp \ 
--job_name $PROJECT-prediction-bq \ 
--setup_file prediction/setup.py \ 
--model $BUCKET/model \ 
--source bq \ 
--input $PROJECT:mnist.images \ 
--output $PROJECT:mnist.predict 

それはapache_beamパッケージは、属性 '読む' を含んでいないように見えます

Traceback (most recent call last): 
    File "prediction/run.py", line 23, in <module> 
    predict.run() 
    File "/home/ahuoo_com/dataflow-prediction-example/prediction/modules/predict.py", line 98, in run 
    images = p | 'ReadFromBQ' >> beam.Read(beam.io.BigQuerySource(known_args.input)) 
**AttributeError: 'module' object has no attribute 'Read'** 

を示しています。私はgithubで提供されているGoogleの例が間違っていると思う。あなたはライン98

https://github.com/GoogleCloudPlatform/dataflow-prediction-example/blob/master/prediction/modules/predict.py

でコードを見てみることができますテストを行うために、このガイドを使用して誰がいますか?

+0

まあ 'apache_beam'は、[行21](https://github.com/GoogleCloudPlatform/dataflow-prediction-example/blob/46dba7abf3da856388b3d08e4ffd46ca56d67b1d/prediction/modules/predict.py#L21)を参照してください、輸入なっています。 モジュールがインストールされていることを確認します。 –

答えて

0

あなたは正しいです、コードに小さな間違いがあります。

images = p | 'ReadFromBQ' >> beam.Read(beam.io.BigQuerySource(known_args.input)) 

それは次のようになります:

images = p | 'ReadFromBQ' >> beam.io.Read(beam.io.BigQuerySource(known_args.input)) 

また、それが言う行100で:

predictions | 'WriteToBQ' >> beam.Write(beam.io.BigQuerySink(...)) 

、それはまたのようにする必要があります:

それが言うライン 98
predictions | 'WriteToBQ' >> beam.io.Write(beam.io.BigQuerySink(...)) 

PCollectionの読み書きリソースは、ioモジュールからであり、apache_beamでは発生しません。

関連する問題