tiny fix
This commit is contained in:
parent
d0e6059902
commit
41086059b1
|
@ -4,10 +4,11 @@
|
||||||
.venv
|
.venv
|
||||||
cache
|
cache
|
||||||
data
|
data
|
||||||
|
docker
|
||||||
|
examples
|
||||||
|
saves
|
||||||
hf_cache
|
hf_cache
|
||||||
output
|
output
|
||||||
examples
|
|
||||||
.dockerignore
|
.dockerignore
|
||||||
.gitattributes
|
.gitattributes
|
||||||
.gitignore
|
.gitignore
|
||||||
Dockerfile
|
|
||||||
|
|
10
README.md
10
README.md
|
@ -360,7 +360,7 @@ To enable FlashAttention-2 on the Windows platform, you need to install the prec
|
||||||
|
|
||||||
<details><summary>For Ascend NPU users</summary>
|
<details><summary>For Ascend NPU users</summary>
|
||||||
|
|
||||||
To install LLaMA Factory on Ascend NPU devices, please specify extra dependencies: `pip install -e '.[torch-npu,metrics]'`. Additionally, you need to install the **[Ascend CANN Toolkit and Kernels](https://www.hiascend.com/developer/download/community/result?module=cann)**. Please follow the [installation tutorial](https://www.hiascend.com/document/detail/en/CANNCommunityEdition/600alphaX/softwareinstall/instg/atlasdeploy_03_0031.html) or use the following commands:
|
To install LLaMA Factory on Ascend NPU devices, please specify extra dependencies: `pip install -e ".[torch-npu,metrics]"`. Additionally, you need to install the **[Ascend CANN Toolkit and Kernels](https://www.hiascend.com/developer/download/community/result?module=cann)**. Please follow the [installation tutorial](https://www.hiascend.com/document/detail/en/CANNCommunityEdition/600alphaX/softwareinstall/instg/atlasdeploy_03_0031.html) or use the following commands:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# replace the url according to your CANN version and devices
|
# replace the url according to your CANN version and devices
|
||||||
|
@ -422,14 +422,16 @@ llamafactory-cli webui
|
||||||
For CUDA users:
|
For CUDA users:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose -f ./docker/docker-cuda/docker-compose.yml up -d
|
cd docker/docker-cuda/
|
||||||
|
docker-compose up -d
|
||||||
docker-compose exec llamafactory bash
|
docker-compose exec llamafactory bash
|
||||||
```
|
```
|
||||||
|
|
||||||
For Ascend NPU users:
|
For Ascend NPU users:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose -f ./docker/docker-npu/docker-compose.yml up -d
|
cd docker/docker-npu/
|
||||||
|
docker-compose up -d
|
||||||
docker-compose exec llamafactory bash
|
docker-compose exec llamafactory bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -461,7 +463,7 @@ docker exec -it llamafactory bash
|
||||||
For Ascend NPU users:
|
For Ascend NPU users:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Change docker image upon your environment
|
# Choose docker image upon your environment
|
||||||
docker build -f ./docker/docker-npu/Dockerfile \
|
docker build -f ./docker/docker-npu/Dockerfile \
|
||||||
--build-arg INSTALL_DEEPSPEED=false \
|
--build-arg INSTALL_DEEPSPEED=false \
|
||||||
--build-arg PIP_INDEX=https://pypi.org/simple \
|
--build-arg PIP_INDEX=https://pypi.org/simple \
|
||||||
|
|
|
@ -422,14 +422,16 @@ llamafactory-cli webui
|
||||||
CUDA 用户:
|
CUDA 用户:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose -f ./docker/docker-cuda/docker-compose.yml up -d
|
cd docker/docker-cuda/
|
||||||
|
docker-compose up -d
|
||||||
docker-compose exec llamafactory bash
|
docker-compose exec llamafactory bash
|
||||||
```
|
```
|
||||||
|
|
||||||
昇腾 NPU 用户:
|
昇腾 NPU 用户:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose -f ./docker/docker-npu/docker-compose.yml up -d
|
cd docker/docker-npu/
|
||||||
|
docker-compose up -d
|
||||||
docker-compose exec llamafactory bash
|
docker-compose exec llamafactory bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ class ToolFormatter(Formatter):
|
||||||
self._tool_formatter = glm4_tool_formatter
|
self._tool_formatter = glm4_tool_formatter
|
||||||
self._tool_extractor = glm4_tool_extractor
|
self._tool_extractor = glm4_tool_extractor
|
||||||
else:
|
else:
|
||||||
raise ValueError("Tool format was not found.")
|
raise NotImplementedError("Tool format {} was not found.".format(self.tool_format))
|
||||||
|
|
||||||
def apply(self, **kwargs) -> SLOTS:
|
def apply(self, **kwargs) -> SLOTS:
|
||||||
content = kwargs.pop("content")
|
content = kwargs.pop("content")
|
||||||
|
|
|
@ -388,7 +388,8 @@ def get_template_and_fix_tokenizer(
|
||||||
if template is None:
|
if template is None:
|
||||||
raise ValueError("Template {} does not exist.".format(name))
|
raise ValueError("Template {} does not exist.".format(name))
|
||||||
|
|
||||||
if tool_format:
|
if tool_format is not None:
|
||||||
|
logger.info("Using tool format: {}.".format(tool_format))
|
||||||
template.format_tools = ToolFormatter(tool_format=tool_format)
|
template.format_tools = ToolFormatter(tool_format=tool_format)
|
||||||
|
|
||||||
stop_words = template.stop_words
|
stop_words = template.stop_words
|
||||||
|
@ -625,7 +626,6 @@ _register_template(
|
||||||
|
|
||||||
_register_template(
|
_register_template(
|
||||||
name="empty",
|
name="empty",
|
||||||
format_prefix=EmptyFormatter(slots=[{"bos_token"}]),
|
|
||||||
efficient_eos=True,
|
efficient_eos=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,6 @@ class DataArguments:
|
||||||
default=None,
|
default=None,
|
||||||
metadata={"help": "Which template to use for constructing prompts in training and inference."},
|
metadata={"help": "Which template to use for constructing prompts in training and inference."},
|
||||||
)
|
)
|
||||||
tool_format: Optional[str] = field(
|
|
||||||
default=None,
|
|
||||||
metadata={"help": "Specifies the tool format template for function calling ."},
|
|
||||||
)
|
|
||||||
dataset: Optional[str] = field(
|
dataset: Optional[str] = field(
|
||||||
default=None,
|
default=None,
|
||||||
metadata={"help": "The name of provided dataset(s) to use. Use commas to separate multiple datasets."},
|
metadata={"help": "The name of provided dataset(s) to use. Use commas to separate multiple datasets."},
|
||||||
|
@ -105,6 +101,10 @@ class DataArguments:
|
||||||
"help": "Whether or not to pack the sequences in training. Will automatically enable in pre-training."
|
"help": "Whether or not to pack the sequences in training. Will automatically enable in pre-training."
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
tool_format: Optional[str] = field(
|
||||||
|
default=None,
|
||||||
|
metadata={"help": "Tool format to use for constructing function calling examples."},
|
||||||
|
)
|
||||||
tokenized_path: Optional[str] = field(
|
tokenized_path: Optional[str] = field(
|
||||||
default=None,
|
default=None,
|
||||||
metadata={"help": "Path to save or load the tokenized datasets."},
|
metadata={"help": "Path to save or load the tokenized datasets."},
|
||||||
|
|
|
@ -291,7 +291,7 @@ def create_train_tab(engine: "Engine") -> Dict[str, "Component"]:
|
||||||
with gr.Column(scale=1):
|
with gr.Column(scale=1):
|
||||||
loss_viewer = gr.Plot()
|
loss_viewer = gr.Plot()
|
||||||
|
|
||||||
input_elems.update({output_dir, config_path, device_count, ds_stage, ds_offload})
|
input_elems.update({output_dir, config_path, ds_stage, ds_offload})
|
||||||
elem_dict.update(
|
elem_dict.update(
|
||||||
dict(
|
dict(
|
||||||
cmd_preview_btn=cmd_preview_btn,
|
cmd_preview_btn=cmd_preview_btn,
|
||||||
|
|
|
@ -306,7 +306,7 @@ class Runner:
|
||||||
|
|
||||||
def _form_config_dict(self, data: Dict["Component", Any]) -> Dict[str, Any]:
|
def _form_config_dict(self, data: Dict["Component", Any]) -> Dict[str, Any]:
|
||||||
config_dict = {}
|
config_dict = {}
|
||||||
skip_ids = ["top.lang", "top.model_path", "train.output_dir", "train.config_path", "train.device_count"]
|
skip_ids = ["top.lang", "top.model_path", "train.output_dir", "train.config_path"]
|
||||||
for elem, value in data.items():
|
for elem, value in data.items():
|
||||||
elem_id = self.manager.get_id_by_elem(elem)
|
elem_id = self.manager.get_id_by_elem(elem)
|
||||||
if elem_id not in skip_ids:
|
if elem_id not in skip_ids:
|
||||||
|
|
Loading…
Reference in New Issue