AirLLM 2.8T LLM inference with single 4GB GPU
Python chinese-llmchinese-nlpfinetunegenerative-aiinstruct-gptinstruction-setllamallmloraopen-modelsopen-sourceopen-source-modelsqlora
Fix import airllm failing on clean installs (3.0.1)
Yu Li6436dce1547c
diff --git a/air_llm/airllm/__init__.py b/air_llm/airllm/__init__.pyindex bf189e3..c86ba93 100644--- a/air_llm/airllm/__init__.py+++ b/air_llm/airllm/__init__.py@@ -9,16 +9,35 @@ if is_on_mac_os:from .airllm_llama_mlx import AirLLMLlamaMlxfrom .auto_model import AutoModelelse:- from .airllm import AirLLMLlama2- from .airllm_chatglm import AirLLMChatGLM- from .airllm_qwen import AirLLMQWen- from .airllm_qwen2 import AirLLMQWen2- from .airllm_baichuan import AirLLMBaichuan- from .airllm_internlm import AirLLMInternLM- from .airllm_mistral import AirLLMMistral- from .airllm_mixtral import AirLLMMixtral+ # Core entry points. These have no model-specific optional dependencies, so a plain+ # `import airllm` always works as long as torch/transformers are installed.from .airllm_base import AirLLMBaseModelfrom .auto_model import AutoModelfrom .utils import split_and_save_layersfrom .utils import NotEnoughSpaceException+ # Dedicated subclasses for a handful of custom-architecture models. Some of them pull in+ # optional extras (e.g. the Baichuan tokenizer needs `sentencepiece`). Import them defensively+ # so a missing optional dependency for one niche family never breaks the whole package; the+ # generic AirLLMBaseModel path keeps working regardless.+ import warnings as _warnings++ for _name, _module in (+ ("AirLLMLlama2", ".airllm"),+ ("AirLLMChatGLM", ".airllm_chatglm"),+ ("AirLLMQWen", ".airllm_qwen"),+ ("AirLLMQWen2", ".airllm_qwen2"),+ ("AirLLMBaichuan", ".airllm_baichuan"),+ ("AirLLMInternLM", ".airllm_internlm"),+ ("AirLLMMistral", ".airllm_mistral"),+ ("AirLLMMixtral", ".airllm_mixtral"),+ ):+ try:+ _mod = __import__(__name__ + _module, fromlist=[_name])+ globals()[_name] = getattr(_mod, _name)+ except Exception as _e: # noqa: BLE001 - optional family, keep package importable+ _warnings.warn(+ f"airllm: optional model class {_name} is unavailable ({_e}). "+ f"This only affects that specific model family; the generic streaming path still works."+ )+diff --git a/air_llm/setup.py b/air_llm/setup.pyindex a3e50ba..e1a8a62 100644--- a/air_llm/setup.py+++ b/air_llm/setup.py@@ -15,7 +15,7 @@ for _readme in (os.path.join(here, "README.md"), os.path.join(here, os.pardir, "setuptools.setup(name="airllm",- version="3.0.0",+ version="3.0.1",author="Gavin Li",author_email="[email protected]",description="AirLLM runs 70B large language models on a single 4GB GPU without quantization, "@@ -34,6 +34,7 @@ setuptools.setup('safetensors','huggingface-hub','scipy',+ 'sentencepiece',# 'bitsandbytes' is optional (used only for --compression); we fall back gracefully when absent.],classifiers=[