From 308edbc4260d45907b4a9d3a45ec21d83e48aacb Mon Sep 17 00:00:00 2001 From: hiyouga Date: Thu, 16 May 2024 18:39:08 +0800 Subject: [PATCH] rename package --- Dockerfile | 2 +- README.md | 7 +++---- README_zh.md | 7 +++---- pyproject.toml | 2 +- scripts/cal_flops.py | 2 +- scripts/cal_lr.py | 8 ++++---- scripts/cal_ppl.py | 8 ++++---- scripts/length_cdf.py | 6 +++--- setup.py | 6 +++--- src/api.py | 4 ++-- src/{llmtuner => llamafactory}/__init__.py | 0 src/{llmtuner => llamafactory}/api/__init__.py | 0 src/{llmtuner => llamafactory}/api/app.py | 0 src/{llmtuner => llamafactory}/api/chat.py | 0 src/{llmtuner => llamafactory}/api/common.py | 0 src/{llmtuner => llamafactory}/api/protocol.py | 0 src/{llmtuner => llamafactory}/chat/__init__.py | 0 src/{llmtuner => llamafactory}/chat/base_engine.py | 0 src/{llmtuner => llamafactory}/chat/chat_model.py | 0 src/{llmtuner => llamafactory}/chat/hf_engine.py | 0 src/{llmtuner => llamafactory}/chat/vllm_engine.py | 0 src/{llmtuner => llamafactory}/cli.py | 0 src/{llmtuner => llamafactory}/data/__init__.py | 0 src/{llmtuner => llamafactory}/data/aligner.py | 0 src/{llmtuner => llamafactory}/data/collator.py | 0 src/{llmtuner => llamafactory}/data/formatter.py | 0 src/{llmtuner => llamafactory}/data/loader.py | 0 src/{llmtuner => llamafactory}/data/parser.py | 2 ++ src/{llmtuner => llamafactory}/data/preprocess.py | 0 src/{llmtuner => llamafactory}/data/template.py | 0 src/{llmtuner => llamafactory}/data/utils.py | 2 +- src/{llmtuner => llamafactory}/eval/__init__.py | 0 src/{llmtuner => llamafactory}/eval/evaluator.py | 0 src/{llmtuner => llamafactory}/eval/template.py | 0 src/{llmtuner => llamafactory}/extras/__init__.py | 0 src/{llmtuner => llamafactory}/extras/callbacks.py | 0 src/{llmtuner => llamafactory}/extras/constants.py | 0 src/{llmtuner => llamafactory}/extras/logging.py | 0 src/{llmtuner => llamafactory}/extras/misc.py | 2 +- src/{llmtuner => llamafactory}/extras/packages.py | 0 src/{llmtuner => llamafactory}/extras/ploting.py | 0 src/{llmtuner => llamafactory}/hparams/__init__.py | 0 src/{llmtuner => llamafactory}/hparams/data_args.py | 0 src/{llmtuner => llamafactory}/hparams/evaluation_args.py | 0 src/{llmtuner => llamafactory}/hparams/finetuning_args.py | 0 src/{llmtuner => llamafactory}/hparams/generating_args.py | 0 src/{llmtuner => llamafactory}/hparams/model_args.py | 0 src/{llmtuner => llamafactory}/hparams/parser.py | 0 src/{llmtuner => llamafactory}/model/__init__.py | 0 src/{llmtuner => llamafactory}/model/adapter.py | 0 src/{llmtuner => llamafactory}/model/loader.py | 0 src/{llmtuner => llamafactory}/model/patcher.py | 0 src/{llmtuner => llamafactory}/model/utils/__init__.py | 0 src/{llmtuner => llamafactory}/model/utils/attention.py | 0 .../model/utils/checkpointing.py | 0 src/{llmtuner => llamafactory}/model/utils/embedding.py | 0 src/{llmtuner => llamafactory}/model/utils/longlora.py | 0 src/{llmtuner => llamafactory}/model/utils/misc.py | 0 src/{llmtuner => llamafactory}/model/utils/mod.py | 0 src/{llmtuner => llamafactory}/model/utils/moe.py | 0 .../model/utils/quantization.py | 0 src/{llmtuner => llamafactory}/model/utils/rope.py | 0 src/{llmtuner => llamafactory}/model/utils/unsloth.py | 0 src/{llmtuner => llamafactory}/model/utils/valuehead.py | 0 src/{llmtuner => llamafactory}/model/utils/visual.py | 0 src/{llmtuner => llamafactory}/train/__init__.py | 0 src/{llmtuner => llamafactory}/train/dpo/__init__.py | 0 src/{llmtuner => llamafactory}/train/dpo/trainer.py | 0 src/{llmtuner => llamafactory}/train/dpo/workflow.py | 0 src/{llmtuner => llamafactory}/train/orpo/__init__.py | 0 src/{llmtuner => llamafactory}/train/orpo/trainer.py | 0 src/{llmtuner => llamafactory}/train/orpo/workflow.py | 0 src/{llmtuner => llamafactory}/train/ppo/__init__.py | 0 src/{llmtuner => llamafactory}/train/ppo/trainer.py | 0 src/{llmtuner => llamafactory}/train/ppo/utils.py | 0 src/{llmtuner => llamafactory}/train/ppo/workflow.py | 0 src/{llmtuner => llamafactory}/train/pt/__init__.py | 0 src/{llmtuner => llamafactory}/train/pt/trainer.py | 0 src/{llmtuner => llamafactory}/train/pt/workflow.py | 0 src/{llmtuner => llamafactory}/train/rm/__init__.py | 0 src/{llmtuner => llamafactory}/train/rm/metric.py | 0 src/{llmtuner => llamafactory}/train/rm/trainer.py | 0 src/{llmtuner => llamafactory}/train/rm/workflow.py | 0 src/{llmtuner => llamafactory}/train/sft/__init__.py | 0 src/{llmtuner => llamafactory}/train/sft/metric.py | 0 src/{llmtuner => llamafactory}/train/sft/trainer.py | 0 src/{llmtuner => llamafactory}/train/sft/workflow.py | 0 src/{llmtuner => llamafactory}/train/tuner.py | 0 src/{llmtuner => llamafactory}/train/utils.py | 0 src/{llmtuner => llamafactory}/webui/__init__.py | 0 src/{llmtuner => llamafactory}/webui/chatter.py | 0 src/{llmtuner => llamafactory}/webui/common.py | 0 .../webui/components/__init__.py | 0 .../webui/components/chatbot.py | 0 src/{llmtuner => llamafactory}/webui/components/data.py | 0 src/{llmtuner => llamafactory}/webui/components/eval.py | 0 src/{llmtuner => llamafactory}/webui/components/export.py | 0 src/{llmtuner => llamafactory}/webui/components/infer.py | 0 src/{llmtuner => llamafactory}/webui/components/top.py | 0 src/{llmtuner => llamafactory}/webui/components/train.py | 0 src/{llmtuner => llamafactory}/webui/css.py | 0 src/{llmtuner => llamafactory}/webui/engine.py | 0 src/{llmtuner => llamafactory}/webui/interface.py | 0 src/{llmtuner => llamafactory}/webui/locales.py | 0 src/{llmtuner => llamafactory}/webui/manager.py | 0 src/{llmtuner => llamafactory}/webui/runner.py | 0 src/{llmtuner => llamafactory}/webui/utils.py | 0 src/train.py | 2 +- src/webui.py | 2 +- 109 files changed, 31 insertions(+), 31 deletions(-) rename src/{llmtuner => llamafactory}/__init__.py (100%) rename src/{llmtuner => llamafactory}/api/__init__.py (100%) rename src/{llmtuner => llamafactory}/api/app.py (100%) rename src/{llmtuner => llamafactory}/api/chat.py (100%) rename src/{llmtuner => llamafactory}/api/common.py (100%) rename src/{llmtuner => llamafactory}/api/protocol.py (100%) rename src/{llmtuner => llamafactory}/chat/__init__.py (100%) rename src/{llmtuner => llamafactory}/chat/base_engine.py (100%) rename src/{llmtuner => llamafactory}/chat/chat_model.py (100%) rename src/{llmtuner => llamafactory}/chat/hf_engine.py (100%) rename src/{llmtuner => llamafactory}/chat/vllm_engine.py (100%) rename src/{llmtuner => llamafactory}/cli.py (100%) rename src/{llmtuner => llamafactory}/data/__init__.py (100%) rename src/{llmtuner => llamafactory}/data/aligner.py (100%) rename src/{llmtuner => llamafactory}/data/collator.py (100%) rename src/{llmtuner => llamafactory}/data/formatter.py (100%) rename src/{llmtuner => llamafactory}/data/loader.py (100%) rename src/{llmtuner => llamafactory}/data/parser.py (98%) rename src/{llmtuner => llamafactory}/data/preprocess.py (100%) rename src/{llmtuner => llamafactory}/data/template.py (100%) rename src/{llmtuner => llamafactory}/data/utils.py (98%) rename src/{llmtuner => llamafactory}/eval/__init__.py (100%) rename src/{llmtuner => llamafactory}/eval/evaluator.py (100%) rename src/{llmtuner => llamafactory}/eval/template.py (100%) rename src/{llmtuner => llamafactory}/extras/__init__.py (100%) rename src/{llmtuner => llamafactory}/extras/callbacks.py (100%) rename src/{llmtuner => llamafactory}/extras/constants.py (100%) rename src/{llmtuner => llamafactory}/extras/logging.py (100%) rename src/{llmtuner => llamafactory}/extras/misc.py (99%) rename src/{llmtuner => llamafactory}/extras/packages.py (100%) rename src/{llmtuner => llamafactory}/extras/ploting.py (100%) rename src/{llmtuner => llamafactory}/hparams/__init__.py (100%) rename src/{llmtuner => llamafactory}/hparams/data_args.py (100%) rename src/{llmtuner => llamafactory}/hparams/evaluation_args.py (100%) rename src/{llmtuner => llamafactory}/hparams/finetuning_args.py (100%) rename src/{llmtuner => llamafactory}/hparams/generating_args.py (100%) rename src/{llmtuner => llamafactory}/hparams/model_args.py (100%) rename src/{llmtuner => llamafactory}/hparams/parser.py (100%) rename src/{llmtuner => llamafactory}/model/__init__.py (100%) rename src/{llmtuner => llamafactory}/model/adapter.py (100%) rename src/{llmtuner => llamafactory}/model/loader.py (100%) rename src/{llmtuner => llamafactory}/model/patcher.py (100%) rename src/{llmtuner => llamafactory}/model/utils/__init__.py (100%) rename src/{llmtuner => llamafactory}/model/utils/attention.py (100%) rename src/{llmtuner => llamafactory}/model/utils/checkpointing.py (100%) rename src/{llmtuner => llamafactory}/model/utils/embedding.py (100%) rename src/{llmtuner => llamafactory}/model/utils/longlora.py (100%) rename src/{llmtuner => llamafactory}/model/utils/misc.py (100%) rename src/{llmtuner => llamafactory}/model/utils/mod.py (100%) rename src/{llmtuner => llamafactory}/model/utils/moe.py (100%) rename src/{llmtuner => llamafactory}/model/utils/quantization.py (100%) rename src/{llmtuner => llamafactory}/model/utils/rope.py (100%) rename src/{llmtuner => llamafactory}/model/utils/unsloth.py (100%) rename src/{llmtuner => llamafactory}/model/utils/valuehead.py (100%) rename src/{llmtuner => llamafactory}/model/utils/visual.py (100%) rename src/{llmtuner => llamafactory}/train/__init__.py (100%) rename src/{llmtuner => llamafactory}/train/dpo/__init__.py (100%) rename src/{llmtuner => llamafactory}/train/dpo/trainer.py (100%) rename src/{llmtuner => llamafactory}/train/dpo/workflow.py (100%) rename src/{llmtuner => llamafactory}/train/orpo/__init__.py (100%) rename src/{llmtuner => llamafactory}/train/orpo/trainer.py (100%) rename src/{llmtuner => llamafactory}/train/orpo/workflow.py (100%) rename src/{llmtuner => llamafactory}/train/ppo/__init__.py (100%) rename src/{llmtuner => llamafactory}/train/ppo/trainer.py (100%) rename src/{llmtuner => llamafactory}/train/ppo/utils.py (100%) rename src/{llmtuner => llamafactory}/train/ppo/workflow.py (100%) rename src/{llmtuner => llamafactory}/train/pt/__init__.py (100%) rename src/{llmtuner => llamafactory}/train/pt/trainer.py (100%) rename src/{llmtuner => llamafactory}/train/pt/workflow.py (100%) rename src/{llmtuner => llamafactory}/train/rm/__init__.py (100%) rename src/{llmtuner => llamafactory}/train/rm/metric.py (100%) rename src/{llmtuner => llamafactory}/train/rm/trainer.py (100%) rename src/{llmtuner => llamafactory}/train/rm/workflow.py (100%) rename src/{llmtuner => llamafactory}/train/sft/__init__.py (100%) rename src/{llmtuner => llamafactory}/train/sft/metric.py (100%) rename src/{llmtuner => llamafactory}/train/sft/trainer.py (100%) rename src/{llmtuner => llamafactory}/train/sft/workflow.py (100%) rename src/{llmtuner => llamafactory}/train/tuner.py (100%) rename src/{llmtuner => llamafactory}/train/utils.py (100%) rename src/{llmtuner => llamafactory}/webui/__init__.py (100%) rename src/{llmtuner => llamafactory}/webui/chatter.py (100%) rename src/{llmtuner => llamafactory}/webui/common.py (100%) rename src/{llmtuner => llamafactory}/webui/components/__init__.py (100%) rename src/{llmtuner => llamafactory}/webui/components/chatbot.py (100%) rename src/{llmtuner => llamafactory}/webui/components/data.py (100%) rename src/{llmtuner => llamafactory}/webui/components/eval.py (100%) rename src/{llmtuner => llamafactory}/webui/components/export.py (100%) rename src/{llmtuner => llamafactory}/webui/components/infer.py (100%) rename src/{llmtuner => llamafactory}/webui/components/top.py (100%) rename src/{llmtuner => llamafactory}/webui/components/train.py (100%) rename src/{llmtuner => llamafactory}/webui/css.py (100%) rename src/{llmtuner => llamafactory}/webui/engine.py (100%) rename src/{llmtuner => llamafactory}/webui/interface.py (100%) rename src/{llmtuner => llamafactory}/webui/locales.py (100%) rename src/{llmtuner => llamafactory}/webui/manager.py (100%) rename src/{llmtuner => llamafactory}/webui/runner.py (100%) rename src/{llmtuner => llamafactory}/webui/utils.py (100%) diff --git a/Dockerfile b/Dockerfile index d757d618..0a35e355 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ COPY requirements.txt /app/ RUN pip install -r requirements.txt COPY . /app/ -RUN pip install -e .[deepspeed,metrics,bitsandbytes,qwen] +RUN pip install -e .[metrics,bitsandbytes,qwen] VOLUME [ "/root/.cache/huggingface/", "/app/data", "/app/output" ] EXPOSE 7860 diff --git a/README.md b/README.md index dfbaa92c..d392b19b 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,7 @@ [![GitHub Repo stars](https://img.shields.io/github/stars/hiyouga/LLaMA-Factory?style=social)](https://github.com/hiyouga/LLaMA-Factory/stargazers) [![GitHub Code License](https://img.shields.io/github/license/hiyouga/LLaMA-Factory)](LICENSE) [![GitHub last commit](https://img.shields.io/github/last-commit/hiyouga/LLaMA-Factory)](https://github.com/hiyouga/LLaMA-Factory/commits/main) -[![PyPI](https://img.shields.io/pypi/v/llmtuner)](https://pypi.org/project/llmtuner/) -[![Downloads](https://static.pepy.tech/badge/llmtuner)](https://pypi.org/project/llmtuner/) +[![PyPI](https://img.shields.io/pypi/v/llamafactory)](https://pypi.org/project/llamafactory/) [![Citation](https://img.shields.io/badge/citation-44-green)](#projects-using-llama-factory) [![GitHub pull request](https://img.shields.io/badge/PRs-welcome-blue)](https://github.com/hiyouga/LLaMA-Factory/pulls) [![Discord](https://dcbadge.vercel.app/api/server/rKfvV9r9FK?compact=true&style=flat)](https://discord.gg/rKfvV9r9FK) @@ -176,9 +175,9 @@ Compared to ChatGLM's [P-Tuning](https://github.com/THUDM/ChatGLM2-6B/tree/main/ > > Remember to use the **SAME** template in training and inference. -Please refer to [constants.py](src/llmtuner/extras/constants.py) for a full list of models we supported. +Please refer to [constants.py](src/llamafactory/extras/constants.py) for a full list of models we supported. -You also can add a custom chat template to [template.py](src/llmtuner/data/template.py). +You also can add a custom chat template to [template.py](src/llamafactory/data/template.py). ## Supported Training Approaches diff --git a/README_zh.md b/README_zh.md index 4e03f3c6..58398a31 100644 --- a/README_zh.md +++ b/README_zh.md @@ -3,8 +3,7 @@ [![GitHub Repo stars](https://img.shields.io/github/stars/hiyouga/LLaMA-Factory?style=social)](https://github.com/hiyouga/LLaMA-Factory/stargazers) [![GitHub Code License](https://img.shields.io/github/license/hiyouga/LLaMA-Factory)](LICENSE) [![GitHub last commit](https://img.shields.io/github/last-commit/hiyouga/LLaMA-Factory)](https://github.com/hiyouga/LLaMA-Factory/commits/main) -[![PyPI](https://img.shields.io/pypi/v/llmtuner)](https://pypi.org/project/llmtuner/) -[![Downloads](https://static.pepy.tech/badge/llmtuner)](https://pypi.org/project/llmtuner/) +[![PyPI](https://img.shields.io/pypi/v/llamafactory)](https://pypi.org/project/llamafactory/) [![Citation](https://img.shields.io/badge/citation-44-green)](#使用了-llama-factory-的项目) [![GitHub pull request](https://img.shields.io/badge/PRs-welcome-blue)](https://github.com/hiyouga/LLaMA-Factory/pulls) [![Discord](https://dcbadge.vercel.app/api/server/rKfvV9r9FK?compact=true&style=flat)](https://discord.gg/rKfvV9r9FK) @@ -176,9 +175,9 @@ https://github.com/hiyouga/LLaMA-Factory/assets/16256802/ec36a9dd-37f4-4f72-81bd > > 请务必在训练和推理时使用**完全一致**的模板。 -项目所支持模型的完整列表请参阅 [constants.py](src/llmtuner/extras/constants.py)。 +项目所支持模型的完整列表请参阅 [constants.py](src/llamafactory/extras/constants.py)。 -您也可以在 [template.py](src/llmtuner/data/template.py) 中添加自己的对话模板。 +您也可以在 [template.py](src/llamafactory/data/template.py) 中添加自己的对话模板。 ## 训练方法 diff --git a/pyproject.toml b/pyproject.toml index 0316276b..62e77e1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ select = ["C", "E", "F", "I", "W"] [tool.ruff.lint.isort] lines-after-imports = 2 -known-first-party = ["llmtuner"] +known-first-party = ["llamafactory"] known-third-party = [ "accelerate", "datasets", diff --git a/scripts/cal_flops.py b/scripts/cal_flops.py index 19414ce5..ac87e0ab 100644 --- a/scripts/cal_flops.py +++ b/scripts/cal_flops.py @@ -8,7 +8,7 @@ import torch from deepspeed.accelerator import get_accelerator # type: ignore from deepspeed.profiling.flops_profiler import get_model_profile # type: ignore -from llmtuner.chat import ChatModel +from llamafactory.chat import ChatModel def calculate_flops( diff --git a/scripts/cal_lr.py b/scripts/cal_lr.py index dd864162..bfa32cc9 100644 --- a/scripts/cal_lr.py +++ b/scripts/cal_lr.py @@ -12,10 +12,10 @@ from torch.utils.data import DataLoader from tqdm import tqdm from transformers import DataCollatorForLanguageModeling, DataCollatorForSeq2Seq -from llmtuner.data import get_dataset -from llmtuner.extras.constants import IGNORE_INDEX -from llmtuner.hparams import get_train_args -from llmtuner.model import load_tokenizer +from llamafactory.data import get_dataset +from llamafactory.extras.constants import IGNORE_INDEX +from llamafactory.hparams import get_train_args +from llamafactory.model import load_tokenizer BASE_LR = 3e-4 # 1.5e-4 for 30B-70B models diff --git a/scripts/cal_ppl.py b/scripts/cal_ppl.py index 9eebc57d..387b756c 100644 --- a/scripts/cal_ppl.py +++ b/scripts/cal_ppl.py @@ -12,10 +12,10 @@ from torch.utils.data import DataLoader from tqdm import tqdm from transformers import DataCollatorForLanguageModeling, DataCollatorForSeq2Seq -from llmtuner.data import get_dataset -from llmtuner.extras.constants import IGNORE_INDEX -from llmtuner.hparams import get_train_args -from llmtuner.model import load_model, load_tokenizer +from llamafactory.data import get_dataset +from llamafactory.extras.constants import IGNORE_INDEX +from llamafactory.hparams import get_train_args +from llamafactory.model import load_model, load_tokenizer @dataclass diff --git a/scripts/length_cdf.py b/scripts/length_cdf.py index da41a942..7739dcf0 100644 --- a/scripts/length_cdf.py +++ b/scripts/length_cdf.py @@ -7,9 +7,9 @@ from collections import defaultdict import fire from tqdm import tqdm -from llmtuner.data import get_dataset -from llmtuner.hparams import get_train_args -from llmtuner.model import load_tokenizer +from llamafactory.data import get_dataset +from llamafactory.hparams import get_train_args +from llamafactory.model import load_tokenizer def length_cdf( diff --git a/setup.py b/setup.py index 1b83c373..4d948450 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import find_packages, setup def get_version(): - with open(os.path.join("src", "llmtuner", "cli.py"), "r", encoding="utf-8") as f: + with open(os.path.join("src", "llamafactory", "cli.py"), "r", encoding="utf-8") as f: file_content = f.read() pattern = r"{}\W*=\W*\"([^\"]+)\"".format("VERSION") (version,) = re.findall(pattern, file_content) @@ -38,7 +38,7 @@ extra_require = { def main(): setup( - name="llmtuner", + name="llamafactory", version=get_version(), author="hiyouga", author_email="hiyouga" "@" "buaa.edu.cn", @@ -53,7 +53,7 @@ def main(): python_requires=">=3.8.0", install_requires=get_requires(), extras_require=extra_require, - entry_points={"console_scripts": ["llamafactory-cli = llmtuner.cli:main"]}, + entry_points={"console_scripts": ["llamafactory-cli = llamafactory.cli:main"]}, classifiers=[ "Development Status :: 4 - Beta", "Intended Audience :: Developers", diff --git a/src/api.py b/src/api.py index 277920ac..3655e393 100644 --- a/src/api.py +++ b/src/api.py @@ -2,8 +2,8 @@ import os import uvicorn -from llmtuner.api.app import create_app -from llmtuner.chat import ChatModel +from llamafactory.api.app import create_app +from llamafactory.chat import ChatModel def main(): diff --git a/src/llmtuner/__init__.py b/src/llamafactory/__init__.py similarity index 100% rename from src/llmtuner/__init__.py rename to src/llamafactory/__init__.py diff --git a/src/llmtuner/api/__init__.py b/src/llamafactory/api/__init__.py similarity index 100% rename from src/llmtuner/api/__init__.py rename to src/llamafactory/api/__init__.py diff --git a/src/llmtuner/api/app.py b/src/llamafactory/api/app.py similarity index 100% rename from src/llmtuner/api/app.py rename to src/llamafactory/api/app.py diff --git a/src/llmtuner/api/chat.py b/src/llamafactory/api/chat.py similarity index 100% rename from src/llmtuner/api/chat.py rename to src/llamafactory/api/chat.py diff --git a/src/llmtuner/api/common.py b/src/llamafactory/api/common.py similarity index 100% rename from src/llmtuner/api/common.py rename to src/llamafactory/api/common.py diff --git a/src/llmtuner/api/protocol.py b/src/llamafactory/api/protocol.py similarity index 100% rename from src/llmtuner/api/protocol.py rename to src/llamafactory/api/protocol.py diff --git a/src/llmtuner/chat/__init__.py b/src/llamafactory/chat/__init__.py similarity index 100% rename from src/llmtuner/chat/__init__.py rename to src/llamafactory/chat/__init__.py diff --git a/src/llmtuner/chat/base_engine.py b/src/llamafactory/chat/base_engine.py similarity index 100% rename from src/llmtuner/chat/base_engine.py rename to src/llamafactory/chat/base_engine.py diff --git a/src/llmtuner/chat/chat_model.py b/src/llamafactory/chat/chat_model.py similarity index 100% rename from src/llmtuner/chat/chat_model.py rename to src/llamafactory/chat/chat_model.py diff --git a/src/llmtuner/chat/hf_engine.py b/src/llamafactory/chat/hf_engine.py similarity index 100% rename from src/llmtuner/chat/hf_engine.py rename to src/llamafactory/chat/hf_engine.py diff --git a/src/llmtuner/chat/vllm_engine.py b/src/llamafactory/chat/vllm_engine.py similarity index 100% rename from src/llmtuner/chat/vllm_engine.py rename to src/llamafactory/chat/vllm_engine.py diff --git a/src/llmtuner/cli.py b/src/llamafactory/cli.py similarity index 100% rename from src/llmtuner/cli.py rename to src/llamafactory/cli.py diff --git a/src/llmtuner/data/__init__.py b/src/llamafactory/data/__init__.py similarity index 100% rename from src/llmtuner/data/__init__.py rename to src/llamafactory/data/__init__.py diff --git a/src/llmtuner/data/aligner.py b/src/llamafactory/data/aligner.py similarity index 100% rename from src/llmtuner/data/aligner.py rename to src/llamafactory/data/aligner.py diff --git a/src/llmtuner/data/collator.py b/src/llamafactory/data/collator.py similarity index 100% rename from src/llmtuner/data/collator.py rename to src/llamafactory/data/collator.py diff --git a/src/llmtuner/data/formatter.py b/src/llamafactory/data/formatter.py similarity index 100% rename from src/llmtuner/data/formatter.py rename to src/llamafactory/data/formatter.py diff --git a/src/llmtuner/data/loader.py b/src/llamafactory/data/loader.py similarity index 100% rename from src/llmtuner/data/loader.py rename to src/llamafactory/data/loader.py diff --git a/src/llmtuner/data/parser.py b/src/llamafactory/data/parser.py similarity index 98% rename from src/llmtuner/data/parser.py rename to src/llamafactory/data/parser.py index 3170fd8a..848fd66c 100644 --- a/src/llmtuner/data/parser.py +++ b/src/llamafactory/data/parser.py @@ -32,6 +32,8 @@ class DatasetAttr: prompt: Optional[str] = "instruction" query: Optional[str] = "input" response: Optional[str] = "output" + chosen: Optional[str] = "chosen" + rejected: Optional[str] = "rejected" history: Optional[str] = None """ columns for the sharegpt format """ messages: Optional[str] = "conversations" diff --git a/src/llmtuner/data/preprocess.py b/src/llamafactory/data/preprocess.py similarity index 100% rename from src/llmtuner/data/preprocess.py rename to src/llamafactory/data/preprocess.py diff --git a/src/llmtuner/data/template.py b/src/llamafactory/data/template.py similarity index 100% rename from src/llmtuner/data/template.py rename to src/llamafactory/data/template.py diff --git a/src/llmtuner/data/utils.py b/src/llamafactory/data/utils.py similarity index 98% rename from src/llmtuner/data/utils.py rename to src/llamafactory/data/utils.py index aaa5bdc0..9b313112 100644 --- a/src/llmtuner/data/utils.py +++ b/src/llamafactory/data/utils.py @@ -10,7 +10,7 @@ if TYPE_CHECKING: from datasets import Dataset, IterableDataset from transformers import Seq2SeqTrainingArguments - from llmtuner.hparams import DataArguments + from ..hparams import DataArguments logger = get_logger(__name__) diff --git a/src/llmtuner/eval/__init__.py b/src/llamafactory/eval/__init__.py similarity index 100% rename from src/llmtuner/eval/__init__.py rename to src/llamafactory/eval/__init__.py diff --git a/src/llmtuner/eval/evaluator.py b/src/llamafactory/eval/evaluator.py similarity index 100% rename from src/llmtuner/eval/evaluator.py rename to src/llamafactory/eval/evaluator.py diff --git a/src/llmtuner/eval/template.py b/src/llamafactory/eval/template.py similarity index 100% rename from src/llmtuner/eval/template.py rename to src/llamafactory/eval/template.py diff --git a/src/llmtuner/extras/__init__.py b/src/llamafactory/extras/__init__.py similarity index 100% rename from src/llmtuner/extras/__init__.py rename to src/llamafactory/extras/__init__.py diff --git a/src/llmtuner/extras/callbacks.py b/src/llamafactory/extras/callbacks.py similarity index 100% rename from src/llmtuner/extras/callbacks.py rename to src/llamafactory/extras/callbacks.py diff --git a/src/llmtuner/extras/constants.py b/src/llamafactory/extras/constants.py similarity index 100% rename from src/llmtuner/extras/constants.py rename to src/llamafactory/extras/constants.py diff --git a/src/llmtuner/extras/logging.py b/src/llamafactory/extras/logging.py similarity index 100% rename from src/llmtuner/extras/logging.py rename to src/llamafactory/extras/logging.py diff --git a/src/llmtuner/extras/misc.py b/src/llamafactory/extras/misc.py similarity index 99% rename from src/llmtuner/extras/misc.py rename to src/llamafactory/extras/misc.py index 53140efa..8955acd1 100644 --- a/src/llmtuner/extras/misc.py +++ b/src/llamafactory/extras/misc.py @@ -30,7 +30,7 @@ except Exception: if TYPE_CHECKING: from trl import AutoModelForCausalLMWithValueHead - from llmtuner.hparams import ModelArguments + from ..hparams import ModelArguments logger = get_logger(__name__) diff --git a/src/llmtuner/extras/packages.py b/src/llamafactory/extras/packages.py similarity index 100% rename from src/llmtuner/extras/packages.py rename to src/llamafactory/extras/packages.py diff --git a/src/llmtuner/extras/ploting.py b/src/llamafactory/extras/ploting.py similarity index 100% rename from src/llmtuner/extras/ploting.py rename to src/llamafactory/extras/ploting.py diff --git a/src/llmtuner/hparams/__init__.py b/src/llamafactory/hparams/__init__.py similarity index 100% rename from src/llmtuner/hparams/__init__.py rename to src/llamafactory/hparams/__init__.py diff --git a/src/llmtuner/hparams/data_args.py b/src/llamafactory/hparams/data_args.py similarity index 100% rename from src/llmtuner/hparams/data_args.py rename to src/llamafactory/hparams/data_args.py diff --git a/src/llmtuner/hparams/evaluation_args.py b/src/llamafactory/hparams/evaluation_args.py similarity index 100% rename from src/llmtuner/hparams/evaluation_args.py rename to src/llamafactory/hparams/evaluation_args.py diff --git a/src/llmtuner/hparams/finetuning_args.py b/src/llamafactory/hparams/finetuning_args.py similarity index 100% rename from src/llmtuner/hparams/finetuning_args.py rename to src/llamafactory/hparams/finetuning_args.py diff --git a/src/llmtuner/hparams/generating_args.py b/src/llamafactory/hparams/generating_args.py similarity index 100% rename from src/llmtuner/hparams/generating_args.py rename to src/llamafactory/hparams/generating_args.py diff --git a/src/llmtuner/hparams/model_args.py b/src/llamafactory/hparams/model_args.py similarity index 100% rename from src/llmtuner/hparams/model_args.py rename to src/llamafactory/hparams/model_args.py diff --git a/src/llmtuner/hparams/parser.py b/src/llamafactory/hparams/parser.py similarity index 100% rename from src/llmtuner/hparams/parser.py rename to src/llamafactory/hparams/parser.py diff --git a/src/llmtuner/model/__init__.py b/src/llamafactory/model/__init__.py similarity index 100% rename from src/llmtuner/model/__init__.py rename to src/llamafactory/model/__init__.py diff --git a/src/llmtuner/model/adapter.py b/src/llamafactory/model/adapter.py similarity index 100% rename from src/llmtuner/model/adapter.py rename to src/llamafactory/model/adapter.py diff --git a/src/llmtuner/model/loader.py b/src/llamafactory/model/loader.py similarity index 100% rename from src/llmtuner/model/loader.py rename to src/llamafactory/model/loader.py diff --git a/src/llmtuner/model/patcher.py b/src/llamafactory/model/patcher.py similarity index 100% rename from src/llmtuner/model/patcher.py rename to src/llamafactory/model/patcher.py diff --git a/src/llmtuner/model/utils/__init__.py b/src/llamafactory/model/utils/__init__.py similarity index 100% rename from src/llmtuner/model/utils/__init__.py rename to src/llamafactory/model/utils/__init__.py diff --git a/src/llmtuner/model/utils/attention.py b/src/llamafactory/model/utils/attention.py similarity index 100% rename from src/llmtuner/model/utils/attention.py rename to src/llamafactory/model/utils/attention.py diff --git a/src/llmtuner/model/utils/checkpointing.py b/src/llamafactory/model/utils/checkpointing.py similarity index 100% rename from src/llmtuner/model/utils/checkpointing.py rename to src/llamafactory/model/utils/checkpointing.py diff --git a/src/llmtuner/model/utils/embedding.py b/src/llamafactory/model/utils/embedding.py similarity index 100% rename from src/llmtuner/model/utils/embedding.py rename to src/llamafactory/model/utils/embedding.py diff --git a/src/llmtuner/model/utils/longlora.py b/src/llamafactory/model/utils/longlora.py similarity index 100% rename from src/llmtuner/model/utils/longlora.py rename to src/llamafactory/model/utils/longlora.py diff --git a/src/llmtuner/model/utils/misc.py b/src/llamafactory/model/utils/misc.py similarity index 100% rename from src/llmtuner/model/utils/misc.py rename to src/llamafactory/model/utils/misc.py diff --git a/src/llmtuner/model/utils/mod.py b/src/llamafactory/model/utils/mod.py similarity index 100% rename from src/llmtuner/model/utils/mod.py rename to src/llamafactory/model/utils/mod.py diff --git a/src/llmtuner/model/utils/moe.py b/src/llamafactory/model/utils/moe.py similarity index 100% rename from src/llmtuner/model/utils/moe.py rename to src/llamafactory/model/utils/moe.py diff --git a/src/llmtuner/model/utils/quantization.py b/src/llamafactory/model/utils/quantization.py similarity index 100% rename from src/llmtuner/model/utils/quantization.py rename to src/llamafactory/model/utils/quantization.py diff --git a/src/llmtuner/model/utils/rope.py b/src/llamafactory/model/utils/rope.py similarity index 100% rename from src/llmtuner/model/utils/rope.py rename to src/llamafactory/model/utils/rope.py diff --git a/src/llmtuner/model/utils/unsloth.py b/src/llamafactory/model/utils/unsloth.py similarity index 100% rename from src/llmtuner/model/utils/unsloth.py rename to src/llamafactory/model/utils/unsloth.py diff --git a/src/llmtuner/model/utils/valuehead.py b/src/llamafactory/model/utils/valuehead.py similarity index 100% rename from src/llmtuner/model/utils/valuehead.py rename to src/llamafactory/model/utils/valuehead.py diff --git a/src/llmtuner/model/utils/visual.py b/src/llamafactory/model/utils/visual.py similarity index 100% rename from src/llmtuner/model/utils/visual.py rename to src/llamafactory/model/utils/visual.py diff --git a/src/llmtuner/train/__init__.py b/src/llamafactory/train/__init__.py similarity index 100% rename from src/llmtuner/train/__init__.py rename to src/llamafactory/train/__init__.py diff --git a/src/llmtuner/train/dpo/__init__.py b/src/llamafactory/train/dpo/__init__.py similarity index 100% rename from src/llmtuner/train/dpo/__init__.py rename to src/llamafactory/train/dpo/__init__.py diff --git a/src/llmtuner/train/dpo/trainer.py b/src/llamafactory/train/dpo/trainer.py similarity index 100% rename from src/llmtuner/train/dpo/trainer.py rename to src/llamafactory/train/dpo/trainer.py diff --git a/src/llmtuner/train/dpo/workflow.py b/src/llamafactory/train/dpo/workflow.py similarity index 100% rename from src/llmtuner/train/dpo/workflow.py rename to src/llamafactory/train/dpo/workflow.py diff --git a/src/llmtuner/train/orpo/__init__.py b/src/llamafactory/train/orpo/__init__.py similarity index 100% rename from src/llmtuner/train/orpo/__init__.py rename to src/llamafactory/train/orpo/__init__.py diff --git a/src/llmtuner/train/orpo/trainer.py b/src/llamafactory/train/orpo/trainer.py similarity index 100% rename from src/llmtuner/train/orpo/trainer.py rename to src/llamafactory/train/orpo/trainer.py diff --git a/src/llmtuner/train/orpo/workflow.py b/src/llamafactory/train/orpo/workflow.py similarity index 100% rename from src/llmtuner/train/orpo/workflow.py rename to src/llamafactory/train/orpo/workflow.py diff --git a/src/llmtuner/train/ppo/__init__.py b/src/llamafactory/train/ppo/__init__.py similarity index 100% rename from src/llmtuner/train/ppo/__init__.py rename to src/llamafactory/train/ppo/__init__.py diff --git a/src/llmtuner/train/ppo/trainer.py b/src/llamafactory/train/ppo/trainer.py similarity index 100% rename from src/llmtuner/train/ppo/trainer.py rename to src/llamafactory/train/ppo/trainer.py diff --git a/src/llmtuner/train/ppo/utils.py b/src/llamafactory/train/ppo/utils.py similarity index 100% rename from src/llmtuner/train/ppo/utils.py rename to src/llamafactory/train/ppo/utils.py diff --git a/src/llmtuner/train/ppo/workflow.py b/src/llamafactory/train/ppo/workflow.py similarity index 100% rename from src/llmtuner/train/ppo/workflow.py rename to src/llamafactory/train/ppo/workflow.py diff --git a/src/llmtuner/train/pt/__init__.py b/src/llamafactory/train/pt/__init__.py similarity index 100% rename from src/llmtuner/train/pt/__init__.py rename to src/llamafactory/train/pt/__init__.py diff --git a/src/llmtuner/train/pt/trainer.py b/src/llamafactory/train/pt/trainer.py similarity index 100% rename from src/llmtuner/train/pt/trainer.py rename to src/llamafactory/train/pt/trainer.py diff --git a/src/llmtuner/train/pt/workflow.py b/src/llamafactory/train/pt/workflow.py similarity index 100% rename from src/llmtuner/train/pt/workflow.py rename to src/llamafactory/train/pt/workflow.py diff --git a/src/llmtuner/train/rm/__init__.py b/src/llamafactory/train/rm/__init__.py similarity index 100% rename from src/llmtuner/train/rm/__init__.py rename to src/llamafactory/train/rm/__init__.py diff --git a/src/llmtuner/train/rm/metric.py b/src/llamafactory/train/rm/metric.py similarity index 100% rename from src/llmtuner/train/rm/metric.py rename to src/llamafactory/train/rm/metric.py diff --git a/src/llmtuner/train/rm/trainer.py b/src/llamafactory/train/rm/trainer.py similarity index 100% rename from src/llmtuner/train/rm/trainer.py rename to src/llamafactory/train/rm/trainer.py diff --git a/src/llmtuner/train/rm/workflow.py b/src/llamafactory/train/rm/workflow.py similarity index 100% rename from src/llmtuner/train/rm/workflow.py rename to src/llamafactory/train/rm/workflow.py diff --git a/src/llmtuner/train/sft/__init__.py b/src/llamafactory/train/sft/__init__.py similarity index 100% rename from src/llmtuner/train/sft/__init__.py rename to src/llamafactory/train/sft/__init__.py diff --git a/src/llmtuner/train/sft/metric.py b/src/llamafactory/train/sft/metric.py similarity index 100% rename from src/llmtuner/train/sft/metric.py rename to src/llamafactory/train/sft/metric.py diff --git a/src/llmtuner/train/sft/trainer.py b/src/llamafactory/train/sft/trainer.py similarity index 100% rename from src/llmtuner/train/sft/trainer.py rename to src/llamafactory/train/sft/trainer.py diff --git a/src/llmtuner/train/sft/workflow.py b/src/llamafactory/train/sft/workflow.py similarity index 100% rename from src/llmtuner/train/sft/workflow.py rename to src/llamafactory/train/sft/workflow.py diff --git a/src/llmtuner/train/tuner.py b/src/llamafactory/train/tuner.py similarity index 100% rename from src/llmtuner/train/tuner.py rename to src/llamafactory/train/tuner.py diff --git a/src/llmtuner/train/utils.py b/src/llamafactory/train/utils.py similarity index 100% rename from src/llmtuner/train/utils.py rename to src/llamafactory/train/utils.py diff --git a/src/llmtuner/webui/__init__.py b/src/llamafactory/webui/__init__.py similarity index 100% rename from src/llmtuner/webui/__init__.py rename to src/llamafactory/webui/__init__.py diff --git a/src/llmtuner/webui/chatter.py b/src/llamafactory/webui/chatter.py similarity index 100% rename from src/llmtuner/webui/chatter.py rename to src/llamafactory/webui/chatter.py diff --git a/src/llmtuner/webui/common.py b/src/llamafactory/webui/common.py similarity index 100% rename from src/llmtuner/webui/common.py rename to src/llamafactory/webui/common.py diff --git a/src/llmtuner/webui/components/__init__.py b/src/llamafactory/webui/components/__init__.py similarity index 100% rename from src/llmtuner/webui/components/__init__.py rename to src/llamafactory/webui/components/__init__.py diff --git a/src/llmtuner/webui/components/chatbot.py b/src/llamafactory/webui/components/chatbot.py similarity index 100% rename from src/llmtuner/webui/components/chatbot.py rename to src/llamafactory/webui/components/chatbot.py diff --git a/src/llmtuner/webui/components/data.py b/src/llamafactory/webui/components/data.py similarity index 100% rename from src/llmtuner/webui/components/data.py rename to src/llamafactory/webui/components/data.py diff --git a/src/llmtuner/webui/components/eval.py b/src/llamafactory/webui/components/eval.py similarity index 100% rename from src/llmtuner/webui/components/eval.py rename to src/llamafactory/webui/components/eval.py diff --git a/src/llmtuner/webui/components/export.py b/src/llamafactory/webui/components/export.py similarity index 100% rename from src/llmtuner/webui/components/export.py rename to src/llamafactory/webui/components/export.py diff --git a/src/llmtuner/webui/components/infer.py b/src/llamafactory/webui/components/infer.py similarity index 100% rename from src/llmtuner/webui/components/infer.py rename to src/llamafactory/webui/components/infer.py diff --git a/src/llmtuner/webui/components/top.py b/src/llamafactory/webui/components/top.py similarity index 100% rename from src/llmtuner/webui/components/top.py rename to src/llamafactory/webui/components/top.py diff --git a/src/llmtuner/webui/components/train.py b/src/llamafactory/webui/components/train.py similarity index 100% rename from src/llmtuner/webui/components/train.py rename to src/llamafactory/webui/components/train.py diff --git a/src/llmtuner/webui/css.py b/src/llamafactory/webui/css.py similarity index 100% rename from src/llmtuner/webui/css.py rename to src/llamafactory/webui/css.py diff --git a/src/llmtuner/webui/engine.py b/src/llamafactory/webui/engine.py similarity index 100% rename from src/llmtuner/webui/engine.py rename to src/llamafactory/webui/engine.py diff --git a/src/llmtuner/webui/interface.py b/src/llamafactory/webui/interface.py similarity index 100% rename from src/llmtuner/webui/interface.py rename to src/llamafactory/webui/interface.py diff --git a/src/llmtuner/webui/locales.py b/src/llamafactory/webui/locales.py similarity index 100% rename from src/llmtuner/webui/locales.py rename to src/llamafactory/webui/locales.py diff --git a/src/llmtuner/webui/manager.py b/src/llamafactory/webui/manager.py similarity index 100% rename from src/llmtuner/webui/manager.py rename to src/llamafactory/webui/manager.py diff --git a/src/llmtuner/webui/runner.py b/src/llamafactory/webui/runner.py similarity index 100% rename from src/llmtuner/webui/runner.py rename to src/llamafactory/webui/runner.py diff --git a/src/llmtuner/webui/utils.py b/src/llamafactory/webui/utils.py similarity index 100% rename from src/llmtuner/webui/utils.py rename to src/llamafactory/webui/utils.py diff --git a/src/train.py b/src/train.py index 6a3212cb..b20aa9d2 100644 --- a/src/train.py +++ b/src/train.py @@ -1,4 +1,4 @@ -from llmtuner.train.tuner import run_exp +from llamafactory.train.tuner import run_exp def main(): diff --git a/src/webui.py b/src/webui.py index 7a43039d..8da69497 100644 --- a/src/webui.py +++ b/src/webui.py @@ -1,6 +1,6 @@ import os -from llmtuner.webui.interface import create_ui +from llamafactory.webui.interface import create_ui def main():