From be92338ea0ca0e8b1d30f7f879b3ef2679dba1d5 Mon Sep 17 00:00:00 2001 From: tangwei Date: Wed, 29 Apr 2020 15:40:06 +0800 Subject: [PATCH] fix forder format --- {fleetrec/dataset => dataset}/__init__.py | 0 {fleetrec/demo => demo}/__init__.py | 0 {fleetrec/demo => demo}/ctr-dnn_train.yaml | 0 .../demo => demo}/user_define_trainer.py | 0 {fleetrec/doc => doc}/__init__.py | 0 {fleetrec/models => models}/__init__.py | 0 {fleetrec/models => models}/ctr/__init__.py | 0 .../models => models}/ctr/criteo_reader.py | 0 .../models => models}/ctr/deepfm/__init__.py | 0 .../models => models}/ctr/dnn/__init__.py | 0 .../ctr/dnn/data/test/sample_test.txt | 0 .../ctr/dnn/data/train/sample_train.txt | 0 .../ctr/dnn/hyper_parameters.yaml | 0 {fleetrec/models => models}/ctr/dnn/model.py | 0 .../models => models}/multi_task/__init__.py | 0 {fleetrec/models => models}/other/__init__.py | 0 .../models => models}/recall/__init__.py | 0 .../recall/word2vec/hyper_parameters.yaml | 0 .../recall/word2vec/model.py | 0 .../recall/word2vec/reader.py | 0 .../recall/word2vec/sample_test.txt | 0 .../recall/word2vec/sample_train.txt | 0 {fleetrec/models => models}/tdm/__init__.py | 0 setup.py | 60 ++++++++++++++----- {fleetrec/tools => tools}/__init__.py | 0 25 files changed, 44 insertions(+), 16 deletions(-) rename {fleetrec/dataset => dataset}/__init__.py (100%) rename {fleetrec/demo => demo}/__init__.py (100%) rename {fleetrec/demo => demo}/ctr-dnn_train.yaml (100%) rename {fleetrec/demo => demo}/user_define_trainer.py (100%) rename {fleetrec/doc => doc}/__init__.py (100%) rename {fleetrec/models => models}/__init__.py (100%) rename {fleetrec/models => models}/ctr/__init__.py (100%) rename {fleetrec/models => models}/ctr/criteo_reader.py (100%) rename {fleetrec/models => models}/ctr/deepfm/__init__.py (100%) rename {fleetrec/models => models}/ctr/dnn/__init__.py (100%) rename {fleetrec/models => models}/ctr/dnn/data/test/sample_test.txt (100%) rename {fleetrec/models => models}/ctr/dnn/data/train/sample_train.txt (100%) rename {fleetrec/models => models}/ctr/dnn/hyper_parameters.yaml (100%) rename {fleetrec/models => models}/ctr/dnn/model.py (100%) rename {fleetrec/models => models}/multi_task/__init__.py (100%) rename {fleetrec/models => models}/other/__init__.py (100%) rename {fleetrec/models => models}/recall/__init__.py (100%) rename {fleetrec/models => models}/recall/word2vec/hyper_parameters.yaml (100%) rename {fleetrec/models => models}/recall/word2vec/model.py (100%) rename {fleetrec/models => models}/recall/word2vec/reader.py (100%) rename {fleetrec/models => models}/recall/word2vec/sample_test.txt (100%) rename {fleetrec/models => models}/recall/word2vec/sample_train.txt (100%) rename {fleetrec/models => models}/tdm/__init__.py (100%) rename {fleetrec/tools => tools}/__init__.py (100%) diff --git a/fleetrec/dataset/__init__.py b/dataset/__init__.py similarity index 100% rename from fleetrec/dataset/__init__.py rename to dataset/__init__.py diff --git a/fleetrec/demo/__init__.py b/demo/__init__.py similarity index 100% rename from fleetrec/demo/__init__.py rename to demo/__init__.py diff --git a/fleetrec/demo/ctr-dnn_train.yaml b/demo/ctr-dnn_train.yaml similarity index 100% rename from fleetrec/demo/ctr-dnn_train.yaml rename to demo/ctr-dnn_train.yaml diff --git a/fleetrec/demo/user_define_trainer.py b/demo/user_define_trainer.py similarity index 100% rename from fleetrec/demo/user_define_trainer.py rename to demo/user_define_trainer.py diff --git a/fleetrec/doc/__init__.py b/doc/__init__.py similarity index 100% rename from fleetrec/doc/__init__.py rename to doc/__init__.py diff --git a/fleetrec/models/__init__.py b/models/__init__.py similarity index 100% rename from fleetrec/models/__init__.py rename to models/__init__.py diff --git a/fleetrec/models/ctr/__init__.py b/models/ctr/__init__.py similarity index 100% rename from fleetrec/models/ctr/__init__.py rename to models/ctr/__init__.py diff --git a/fleetrec/models/ctr/criteo_reader.py b/models/ctr/criteo_reader.py similarity index 100% rename from fleetrec/models/ctr/criteo_reader.py rename to models/ctr/criteo_reader.py diff --git a/fleetrec/models/ctr/deepfm/__init__.py b/models/ctr/deepfm/__init__.py similarity index 100% rename from fleetrec/models/ctr/deepfm/__init__.py rename to models/ctr/deepfm/__init__.py diff --git a/fleetrec/models/ctr/dnn/__init__.py b/models/ctr/dnn/__init__.py similarity index 100% rename from fleetrec/models/ctr/dnn/__init__.py rename to models/ctr/dnn/__init__.py diff --git a/fleetrec/models/ctr/dnn/data/test/sample_test.txt b/models/ctr/dnn/data/test/sample_test.txt similarity index 100% rename from fleetrec/models/ctr/dnn/data/test/sample_test.txt rename to models/ctr/dnn/data/test/sample_test.txt diff --git a/fleetrec/models/ctr/dnn/data/train/sample_train.txt b/models/ctr/dnn/data/train/sample_train.txt similarity index 100% rename from fleetrec/models/ctr/dnn/data/train/sample_train.txt rename to models/ctr/dnn/data/train/sample_train.txt diff --git a/fleetrec/models/ctr/dnn/hyper_parameters.yaml b/models/ctr/dnn/hyper_parameters.yaml similarity index 100% rename from fleetrec/models/ctr/dnn/hyper_parameters.yaml rename to models/ctr/dnn/hyper_parameters.yaml diff --git a/fleetrec/models/ctr/dnn/model.py b/models/ctr/dnn/model.py similarity index 100% rename from fleetrec/models/ctr/dnn/model.py rename to models/ctr/dnn/model.py diff --git a/fleetrec/models/multi_task/__init__.py b/models/multi_task/__init__.py similarity index 100% rename from fleetrec/models/multi_task/__init__.py rename to models/multi_task/__init__.py diff --git a/fleetrec/models/other/__init__.py b/models/other/__init__.py similarity index 100% rename from fleetrec/models/other/__init__.py rename to models/other/__init__.py diff --git a/fleetrec/models/recall/__init__.py b/models/recall/__init__.py similarity index 100% rename from fleetrec/models/recall/__init__.py rename to models/recall/__init__.py diff --git a/fleetrec/models/recall/word2vec/hyper_parameters.yaml b/models/recall/word2vec/hyper_parameters.yaml similarity index 100% rename from fleetrec/models/recall/word2vec/hyper_parameters.yaml rename to models/recall/word2vec/hyper_parameters.yaml diff --git a/fleetrec/models/recall/word2vec/model.py b/models/recall/word2vec/model.py similarity index 100% rename from fleetrec/models/recall/word2vec/model.py rename to models/recall/word2vec/model.py diff --git a/fleetrec/models/recall/word2vec/reader.py b/models/recall/word2vec/reader.py similarity index 100% rename from fleetrec/models/recall/word2vec/reader.py rename to models/recall/word2vec/reader.py diff --git a/fleetrec/models/recall/word2vec/sample_test.txt b/models/recall/word2vec/sample_test.txt similarity index 100% rename from fleetrec/models/recall/word2vec/sample_test.txt rename to models/recall/word2vec/sample_test.txt diff --git a/fleetrec/models/recall/word2vec/sample_train.txt b/models/recall/word2vec/sample_train.txt similarity index 100% rename from fleetrec/models/recall/word2vec/sample_train.txt rename to models/recall/word2vec/sample_train.txt diff --git a/fleetrec/models/tdm/__init__.py b/models/tdm/__init__.py similarity index 100% rename from fleetrec/models/tdm/__init__.py rename to models/tdm/__init__.py diff --git a/setup.py b/setup.py index e9249a4b..1708a6d4 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,23 @@ """ setup for fleet-rec. """ +import os import sys from setuptools import setup, find_packages +import tempfile +import shutil if sys.version_info.major == 2: requires = [ "paddlepaddle == 1.7.2", - "netron >= 5.1.1", - "yaml" + "netron >= 0.0.0", + "yaml >= 5.1.1" ] else: requires = [ "paddlepaddle >= 0.0.0", "netron >= 0.0.0", - "pyyaml" + "pyyaml >= 5.1.1" ] about = {} @@ -27,19 +30,44 @@ about["__url__"] = "https://github.com/seiriosPlus/FleetRec" readme = "..." -setup( - name=about["__title__"], - version=about["__version__"], - description=about["__description__"], - long_description=readme, - author=about["__author__"], - author_email=about["__author_email__"], - url=about["__url__"], - packages=find_packages(), - python_requires=">=2.7", - install_requires=requires, - zip_safe=False -) + +def run_cmd(command): + assert command is not None and isinstance(command, str) + return os.popen(command).read().strip() + + +def build(dirname): + print(dirname) + package_dir = os.path.dirname(os.path.abspath(__file__)) + run_cmd("cp -r {}/* {}".format(package_dir, dirname)) + run_cmd("mv {} {}".format(os.path.join(dirname, "dataset"), os.path.join(dirname, "fleetrec"))) + run_cmd("mv {} {}".format(os.path.join(dirname, "demo"), os.path.join(dirname, "fleetrec"))) + run_cmd("mv {} {}".format(os.path.join(dirname, "doc"), os.path.join(dirname, "fleetrec"))) + run_cmd("mv {} {}".format(os.path.join(dirname, "models"), os.path.join(dirname, "fleetrec"))) + run_cmd("mv {} {}".format(os.path.join(dirname, "tools"), os.path.join(dirname, "fleetrec"))) + + packages = find_packages(dirname) + package_dir = {'': dirname} + + setup( + name=about["__title__"], + version=about["__version__"], + description=about["__description__"], + long_description=readme, + author=about["__author__"], + author_email=about["__author_email__"], + url=about["__url__"], + packages=packages, + package_dir=package_dir, + python_requires=">=2.7", + install_requires=requires, + zip_safe=False + ) + + +dirname = tempfile.mkdtemp() +build(dirname) +shutil.rmtree(dirname) print(''' \033[32m diff --git a/fleetrec/tools/__init__.py b/tools/__init__.py similarity index 100% rename from fleetrec/tools/__init__.py rename to tools/__init__.py -- GitLab