mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-20 14:28:54 +00:00
Model: Auto detect model backend from config
* Use exllamav3 for exl3 models, exllamav2 otherwise
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import aiofiles
|
||||
import json
|
||||
import pathlib
|
||||
from typing import List, Optional, Union
|
||||
from typing import Dict, List, Optional, Union
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ class HuggingFaceConfig(BaseModel):
|
||||
Will be expanded as needed.
|
||||
"""
|
||||
|
||||
quantization_config: Optional[Dict] = None
|
||||
|
||||
@classmethod
|
||||
async def from_file(cls, model_directory: pathlib.Path):
|
||||
"""Create an instance from a generation config file."""
|
||||
@@ -54,6 +56,14 @@ class HuggingFaceConfig(BaseModel):
|
||||
hf_config_dict = json.loads(contents)
|
||||
return cls.model_validate(hf_config_dict)
|
||||
|
||||
def quant_method(self):
|
||||
"""Wrapper method to fetch quant type"""
|
||||
|
||||
if isinstance(self.quantization_config, Dict):
|
||||
return self.quantization_config.get("quant_method")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
class TokenizerConfig(BaseModel):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user