Skip to content

Commit

Permalink
Personal/ranxia/change max new tokens (#199)
Browse files Browse the repository at this point in the history
* set multimodal llm max_new_tokens

* set multimodal llm max_new_tokens
  • Loading branch information
Ceceliachenen authored Sep 5, 2024
1 parent 6c399b2 commit 0a90ee6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pai_rag/modules/llm/multi_modal_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
logger = logging.getLogger(__name__)

DEFAULT_DASHSCOPE_API_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1"
DEFAULT_DASHSCOPE_MAX_NEW_TOKENS = 1500
DEFAULT_EAS_MAX_NEW_TOKENS = 1500


class MultiModalLlmModule(ConfigurableModule):
Expand All @@ -34,6 +36,7 @@ def _create_new_instance(self, new_params: Dict[str, Any]):
model=model_name,
api_base=DEFAULT_DASHSCOPE_API_BASE,
api_key=os.environ.get("DASHSCOPE_API_KEY"),
max_new_tokens=DEFAULT_DASHSCOPE_MAX_NEW_TOKENS,
)
elif llm_config.source.lower() == "paieas" and llm_config.get("endpoint"):
logger.info("Using PAI-EAS Multi-Modal-LLM.")
Expand All @@ -43,6 +46,7 @@ def _create_new_instance(self, new_params: Dict[str, Any]):
), # TODO: change model path
api_base=llm_config.endpoint,
api_key=llm_config.token,
max_new_tokens=DEFAULT_EAS_MAX_NEW_TOKENS,
)
else:
logger.info("Don't use Multi-Modal-LLM.")
Expand Down

0 comments on commit 0a90ee6

Please sign in to comment.