![](/img/trans.png)
[英]Running self defined function shows “AttributeError: 'module' object has no attribute ”
[英]Google Dataflow shows AttributeError: 'module' object has no attribute 'Read'
我正在使用Google Cloud進行測試,我按照指南對BigQuery進行了測試。 https://cloud.google.com/solutions/using-cloud-dataflow-for-batch-predictions-with-tensorflow
當我運行腳本時:
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
表明
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'**
看起來apache_beam軟件包不包含屬性“ Read”。 我認為Google在github中提供的示例可能是錯誤的。 您可以查看第98行的代碼。
有沒有人使用本指南進行測試?
沒錯,代碼中有一個小錯誤。 在第98
行中說:
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(...))
它也應該像:
predictions | 'WriteToBQ' >> beam.io.Write(beam.io.BigQuerySink(...))
PCollection的讀/寫資源來自io
模塊,而不是apache_beam
本身。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.