diff --git a/flux/mlx_flux/__init__.py b/flux/mlx_flux/__init__.py index b1122d75..08c272ae 100644 --- a/flux/mlx_flux/__init__.py +++ b/flux/mlx_flux/__init__.py @@ -1,5 +1,6 @@ # Copyright © 2024 Apple Inc. +from ._version import __version__ from .datasets import Dataset, load_dataset from .flux import FluxPipeline from .lora import LoRALinear diff --git a/flux/mlx_flux/_version.py b/flux/mlx_flux/_version.py new file mode 100644 index 00000000..87ee07a7 --- /dev/null +++ b/flux/mlx_flux/_version.py @@ -0,0 +1,3 @@ +# Copyright © 2023-2024 Apple Inc. + +__version__ = "0.1.0" diff --git a/flux/setup.py b/flux/setup.py new file mode 100644 index 00000000..7a92f78b --- /dev/null +++ b/flux/setup.py @@ -0,0 +1,61 @@ +# Copyright © 2024 Apple Inc. + +import os +import sys +from pathlib import Path + +from setuptools import find_namespace_packages, setup + +# 获取当前文件的父目录(项目根目录) +ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) +package_dir = os.path.join(ROOT_DIR, "mlx_flux") + +# 定义依赖列表 +requirements = [] +if os.path.exists(os.path.join(ROOT_DIR, "requirements.txt")): + with open(os.path.join(ROOT_DIR, "requirements.txt")) as fid: + requirements = [l.strip() for l in fid.readlines() if l.strip()] + +# 添加包路径 +sys.path.append(package_dir) + +from _version import __version__ + +try: + with open(os.path.join(ROOT_DIR, "README.md"), encoding="utf-8") as f: + long_description = f.read() +except FileNotFoundError: + long_description = "FLUX.1 on Apple silicon with MLX and the Hugging Face Hub" + +setup( + name="mlx-flux", + version=__version__, + description="FLUX.1 on Apple silicon with MLX and the Hugging Face Hub", + long_description=open("README.md", encoding="utf-8").read(), + long_description_content_type="text/markdown", + readme="README.md", + author_email="mlx@group.apple.com", + author="MLX Contributors", + url="https://github.com/ml-explore/mlx-examples", + license="MIT", + install_requires=requirements, + + # Package configuration + packages=find_namespace_packages(include=["mlx_flux", "mlx_flux.*"]), # 明确指定包含的包 + package_data={ + "mlx_flux": ["*.py"], + }, + include_package_data=True, + + python_requires=">=3.8", + entry_points={ + "console_scripts": [ + # generate images + "mlx_flux.generate = mlx_flux.txt2image:main", + "mlx_flux.txt2image = mlx_flux.txt2image:main", + # fine-tuning model + "mlx_flux.lora = mlx_flux.dreambooth:main", + "mlx_flux.dreambooth = mlx_flux.dreambooth:main", + ] + }, +)