Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -36,7 +36,9 @@ class WebAIConfig:
|
|
| 36 |
storage_bucket: str = os.getenv("SUPABASE_STORAGE_BUCKET", "tender-documents")
|
| 37 |
|
| 38 |
# WebAI Model Configuration
|
|
|
|
| 39 |
model_name: str = "webAI-Official/webAI-ColVec1-4b"
|
|
|
|
| 40 |
use_8bit_quantization: bool = True
|
| 41 |
use_4bit_quantization: bool = False
|
| 42 |
use_flash_attention_2: bool = True
|
|
@@ -93,12 +95,19 @@ def setup_model():
|
|
| 93 |
bnb_4bit_use_double_quant=True,
|
| 94 |
)
|
| 95 |
|
| 96 |
-
# Load processor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
processor = AutoProcessor.from_pretrained(
|
| 98 |
-
CONFIG.
|
| 99 |
trust_remote_code=True,
|
| 100 |
)
|
| 101 |
|
|
|
|
|
|
|
| 102 |
# Configure model kwargs for FlashAttention-2
|
| 103 |
model_kwargs = {
|
| 104 |
"quantization_config": quantization_config,
|
|
|
|
| 36 |
storage_bucket: str = os.getenv("SUPABASE_STORAGE_BUCKET", "tender-documents")
|
| 37 |
|
| 38 |
# WebAI Model Configuration
|
| 39 |
+
# Using 4b model weights with 9b processor (shared Qwen 3.5 architecture)
|
| 40 |
model_name: str = "webAI-Official/webAI-ColVec1-4b"
|
| 41 |
+
processor_name: str = "webAI-Official/webAI-ColVec1-9b" # Has working config
|
| 42 |
use_8bit_quantization: bool = True
|
| 43 |
use_4bit_quantization: bool = False
|
| 44 |
use_flash_attention_2: bool = True
|
|
|
|
| 95 |
bnb_4bit_use_double_quant=True,
|
| 96 |
)
|
| 97 |
|
| 98 |
+
# Load processor from 9b repo (has working config) + model from 4b repo
|
| 99 |
+
log_event("model.setup.using_processor_workaround", {
|
| 100 |
+
"model": CONFIG.model_name,
|
| 101 |
+
"processor_source": CONFIG.processor_name
|
| 102 |
+
})
|
| 103 |
+
|
| 104 |
processor = AutoProcessor.from_pretrained(
|
| 105 |
+
CONFIG.processor_name, # Use 9b config
|
| 106 |
trust_remote_code=True,
|
| 107 |
)
|
| 108 |
|
| 109 |
+
# Note: processor is tied to model architecture, both use Qwen 3.5-VL base
|
| 110 |
+
|
| 111 |
# Configure model kwargs for FlashAttention-2
|
| 112 |
model_kwargs = {
|
| 113 |
"quantization_config": quantization_config,
|