Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,11 +5,19 @@ from typing import List, Optional
|
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
import torch
|
| 8 |
-
from transformers import
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# =========================
|
| 15 |
# CẤU HÌNH MẶC ĐỊNH
|
|
|
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
import torch
|
| 8 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 9 |
+
|
| 10 |
+
# ✅ Import tương thích nhiều phiên bản:
|
| 11 |
+
try:
|
| 12 |
+
# Nhiều bản đặt ở đây
|
| 13 |
+
from transformers.quantizers import CompressedTensorsQuantizationConfig
|
| 14 |
+
except Exception:
|
| 15 |
+
try:
|
| 16 |
+
# Một số bản export ở root (phòng hờ)
|
| 17 |
+
from transformers import CompressedTensorsQuantizationConfig # type: ignore
|
| 18 |
+
except Exception:
|
| 19 |
+
CompressedTensorsQuantizationConfig = None # sẽ fallback qua dict
|
| 20 |
+
|
| 21 |
|
| 22 |
# =========================
|
| 23 |
# CẤU HÌNH MẶC ĐỊNH
|