首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows上的TensorFlow tensorflow_transform.beam问题

Windows上的TensorFlow tensorflow_transform.beam问题
EN

Stack Overflow用户
提问于 2021-12-25 23:36:49
回答 1查看 100关注 0票数 0

在本地Win10计算机上运行以下代码并面临错误。

进口下列包装:

代码语言:javascript
复制
import tensorflow as tf
import tensorflow_transform as tft
import tensorflow_transform.beam as tft_beam

from tensorflow_transform.tf_metadata import dataset_metadata
from tensorflow_transform.tf_metadata import schema_utils

import pprint
import tempfile

python: 3.7.11;windows: 10;tensorflow-transform: 1.5.0

代码语言:javascript
复制
# Ignore the warnings
tf.get_logger().setLevel('ERROR')

# a temporary directory is needed when analyzing the data
with tft_beam.Context(temp_dir=tempfile.mkdtemp()):
    
    # define the pipeline using Apache Beam syntax
    transformed_dataset, transform_fn = (
        
        # analyze and transform the dataset using the preprocessing function
        (raw_data, raw_data_metadata) | tft_beam.AnalyzeAndTransformDataset(
            preprocessing_fn)
    )

# unpack the transformed dataset
transformed_data, transformed_metadata = transformed_dataset

# print the results
print('\nRaw data:\n{}\n'.format(pprint.pformat(raw_data)))
print('Transformed data:\n{}'.format(pprint.pformat(transformed_data)))

错误快照:

代码语言:javascript
复制
usage: ipykernel_launcher.py [-h] [--dataflow_endpoint DATAFLOW_ENDPOINT]
                             [--project PROJECT] [--job_name JOB_NAME]
                             [--staging_location STAGING_LOCATION]
                             [--temp_location TEMP_LOCATION] [--region REGION]
                             [--service_account_email SERVICE_ACCOUNT_EMAIL]
                             [--no_auth]
                             [--template_location TEMPLATE_LOCATION]
                             [--label LABELS] [--update]
                             [--transform_name_mapping TRANSFORM_NAME_MAPPING]
                             [--enable_streaming_engine]
                             [--dataflow_kms_key DATAFLOW_KMS_KEY]
                             [--create_from_snapshot CREATE_FROM_SNAPSHOT]
                             [--flexrs_goal {COST_OPTIMIZED,SPEED_OPTIMIZED}]
                             [--dataflow_service_option DATAFLOW_SERVICE_OPTIONS]
                             [--enable_hot_key_logging]
ipykernel_launcher.py: error: argument --flexrs_goal: invalid choice: 'C:\\Users\\abc\\AppData\\Local\\Temp\\tmp-17163boS9n25ijAn.json' (choose from 'COST_OPTIMIZED', 'SPEED_OPTIMIZED')
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

有人能帮忙吗?

EN

回答 1

Stack Overflow用户

发布于 2022-01-02 16:09:00

此问题可能是VS代码特有的。我在macOS上遇到了同样的问题。由于某些原因,ipykernel似乎不能很好地与tft_beam一起工作。

这里有几个对我有用的解决办法。

  1. 从终端运行一个木星笔记本,并使用远程选项

将VS代码连接到它。

  1. 使用it转换将笔记本转换为python文件并运行它。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70483424

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档