TensorFlow Extended (TFX) 开源项目教程
2024-08-07 07:42:53作者:范靓好Udolf
1. 项目的目录结构及介绍
TensorFlow Extended (TFX) 是一个用于部署生产级机器学习管道的端到端平台。以下是 TFX 项目的主要目录结构及其介绍:
tfx/
├── examples/
├── tfx/
│ ├── components/
│ ├── orchestration/
│ ├── proto/
│ ├── types/
│ ├── utils/
│ └── __init__.py
├── setup.py
└── README.md
- examples/: 包含 TFX 的示例代码和教程。
- tfx/: 核心代码目录,包含 TFX 的各种组件和工具。
- components/: 包含 TFX 的各种组件,如数据验证、特征工程、模型训练等。
- orchestration/: 包含 TFX 的管道编排代码,支持 Apache Airflow 和 Kubeflow Pipelines。
- proto/: 包含 TFX 使用的协议缓冲区定义。
- types/: 包含 TFX 使用的各种类型定义。
- utils/: 包含 TFX 的实用工具函数。
- init.py: 初始化文件,使
tfx目录成为一个 Python 包。
- setup.py: 用于安装 TFX 的配置文件。
- README.md: 项目介绍和使用说明。
2. 项目的启动文件介绍
TFX 项目的启动文件通常是 tfx/orchestration/pipeline.py,该文件定义了如何创建和运行一个 TFX 管道。以下是该文件的主要内容和功能介绍:
from tfx.orchestration import pipeline
from tfx.components import ExampleGen, Trainer, Evaluator, Pusher
def create_pipeline(
pipeline_name: str,
pipeline_root: str,
data_path: str,
module_file: str,
serving_model_dir: str,
metadata_connection_config: Optional[metadata.ConnectionConfigType] = None,
) -> pipeline.Pipeline:
"""Creates a TFX pipeline."""
# 定义数据输入组件
example_gen = ExampleGen(input_base=data_path)
# 定义训练组件
trainer = Trainer(
module_file=module_file,
examples=example_gen.outputs['examples'],
train_args=trainer_pb2.TrainArgs(num_steps=1000),
eval_args=trainer_pb2.EvalArgs(num_steps=500))
# 定义评估组件
evaluator = Evaluator(
examples=example_gen.outputs['examples'],
model=trainer.outputs['model'],
eval_config=eval_config)
# 定义模型推送组件
pusher = Pusher(
model=trainer.outputs['model'],
push_destination=pusher_pb2.PushDestination(
filesystem=pusher_pb2.PushDestination.Filesystem(
base_directory=serving_model_dir)))
return pipeline.Pipeline(
pipeline_name=pipeline_name,
pipeline_root=pipeline_root,
components=[example_gen, trainer, evaluator, pusher],
metadata_connection_config=metadata_connection_config)
该文件定义了一个典型的 TFX 管道,包括数据输入、模型训练、模型评估和模型推送等组件。
3. 项目的配置文件介绍
TFX 项目的配置文件主要是 setup.py,该文件用于安装 TFX 及其依赖项。以下是该文件的主要内容和功能介绍:
from setuptools import find_packages, setup
# 读取 requirements.txt 文件
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name='tfx',
version='1.0.0',
description='TensorFlow Extended (TFX) is an end-to-end platform for deploying production ML pipelines',
author='Google Inc.',
author_email='packages@tensorflow.org',
url='https://www.tensorflow.org/tfx',
packages=find_packages(),
install_requires=requirements,
classifiers=[
'Development Status ::
登录后查看全文
热门项目推荐
相关项目推荐
Kimi-K2.5Kimi K2.5 是一款开源的原生多模态智能体模型,它在 Kimi-K2-Base 的基础上,通过对约 15 万亿混合视觉和文本 tokens 进行持续预训练构建而成。该模型将视觉与语言理解、高级智能体能力、即时模式与思考模式,以及对话式与智能体范式无缝融合。Python00
GLM-4.7-FlashGLM-4.7-Flash 是一款 30B-A3B MoE 模型。作为 30B 级别中的佼佼者,GLM-4.7-Flash 为追求性能与效率平衡的轻量化部署提供了全新选择。Jinja00
VLOOKVLOOK™ 是优雅好用的 Typora/Markdown 主题包和增强插件。 VLOOK™ is an elegant and practical THEME PACKAGE × ENHANCEMENT PLUGIN for Typora/Markdown.Less00
PaddleOCR-VL-1.5PaddleOCR-VL-1.5 是 PaddleOCR-VL 的新一代进阶模型,在 OmniDocBench v1.5 上实现了 94.5% 的全新 state-of-the-art 准确率。 为了严格评估模型在真实物理畸变下的鲁棒性——包括扫描伪影、倾斜、扭曲、屏幕拍摄和光照变化——我们提出了 Real5-OmniDocBench 基准测试集。实验结果表明,该增强模型在新构建的基准测试集上达到了 SOTA 性能。此外,我们通过整合印章识别和文本检测识别(text spotting)任务扩展了模型的能力,同时保持 0.9B 的超紧凑 VLM 规模,具备高效率特性。Python00
KuiklyUI基于KMP技术的高性能、全平台开发框架,具备统一代码库、极致易用性和动态灵活性。 Provide a high-performance, full-platform development framework with unified codebase, ultimate ease of use, and dynamic flexibility. 注意:本仓库为Github仓库镜像,PR或Issue请移步至Github发起,感谢支持!Kotlin07
compass-metrics-modelMetrics model project for the OSS CompassPython00
项目优选
收起
deepin linux kernel
C
27
11
OpenHarmony documentation | OpenHarmony开发者文档
Dockerfile
521
3.71 K
Nop Platform 2.0是基于可逆计算理论实现的采用面向语言编程范式的新一代低代码开发平台,包含基于全新原理从零开始研发的GraphQL引擎、ORM引擎、工作流引擎、报表引擎、规则引擎、批处理引引擎等完整设计。nop-entropy是它的后端部分,采用java语言实现,可选择集成Spring框架或者Quarkus框架。中小企业可以免费商用
Java
12
1
🔥LeetCode solutions in any programming language | 多种编程语言实现 LeetCode、《剑指 Offer(第 2 版)》、《程序员面试金典(第 6 版)》题解
Java
67
20
暂无简介
Dart
762
183
喝着茶写代码!最易用的自托管一站式代码托管平台,包含Git托管,代码审查,团队协作,软件包和CI/CD。
Go
23
0
🎉 (RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue3 & Vite、Element Plus 的前后端分离权限管理系统
Vue
1.32 K
740
无需学习 Kubernetes 的容器平台,在 Kubernetes 上构建、部署、组装和管理应用,无需 K8s 专业知识,全流程图形化管理
Go
16
1
React Native鸿蒙化仓库
JavaScript
302
348
基于golang开发的网关。具有各种插件,可以自行扩展,即插即用。此外,它可以快速帮助企业管理API服务,提高API服务的稳定性和安全性。
Go
22
1