From 5b2284a51def01857059015cc999d9a8b256486c Mon Sep 17 00:00:00 2001 From: hoshi-hiyouga Date: Tue, 22 Oct 2024 11:06:22 +0800 Subject: [PATCH 1/2] fix #5768 Former-commit-id: 9f9e3fd186ce917f0b323c8cd42cf050ed238c58 --- src/llamafactory/extras/constants.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/llamafactory/extras/constants.py b/src/llamafactory/extras/constants.py index c6ddd61b..7c58e2c5 100644 --- a/src/llamafactory/extras/constants.py +++ b/src/llamafactory/extras/constants.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os from collections import OrderedDict, defaultdict from enum import Enum from typing import Dict, Optional @@ -47,7 +48,7 @@ FILEEXT2TYPE = { IGNORE_INDEX = -100 -IMAGE_PLACEHOLDER = "" +IMAGE_PLACEHOLDER = os.environ.get("IMAGE_PLACEHOLDER", "") LAYERNORM_NAMES = {"norm", "ln"} @@ -95,7 +96,7 @@ SUPPORTED_CLASS_FOR_BLOCK_DIAG_ATTN = { SUPPORTED_CLASS_FOR_S2ATTN = {"llama"} -VIDEO_PLACEHOLDER = "