Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ class Config:
|
|
20 |
|
21 |
hf_token: str
|
22 |
hf_username: str
|
23 |
-
transformers_version: str = "
|
24 |
hf_base_url: str = "https://huggingface.co"
|
25 |
transformers_base_url: str = (
|
26 |
"https://github.com/xenova/transformers.js/archive/refs"
|
@@ -95,6 +95,12 @@ class ModelConverter:
|
|
95 |
def convert_model(self, input_model_id: str) -> Tuple[bool, Optional[str]]:
|
96 |
"""Convert the model to ONNX format."""
|
97 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
result = subprocess.run(
|
99 |
[
|
100 |
sys.executable,
|
@@ -103,6 +109,8 @@ class ModelConverter:
|
|
103 |
"--quantize",
|
104 |
"--model_id",
|
105 |
input_model_id,
|
|
|
|
|
106 |
],
|
107 |
cwd=self.config.repo_path,
|
108 |
capture_output=True,
|
|
|
20 |
|
21 |
hf_token: str
|
22 |
hf_username: str
|
23 |
+
transformers_version: str = "4.47.0" # Updated to latest version
|
24 |
hf_base_url: str = "https://huggingface.co"
|
25 |
transformers_base_url: str = (
|
26 |
"https://github.com/xenova/transformers.js/archive/refs"
|
|
|
95 |
def convert_model(self, input_model_id: str) -> Tuple[bool, Optional[str]]:
|
96 |
"""Convert the model to ONNX format."""
|
97 |
try:
|
98 |
+
# Ensure accelerate is installed for weight deduplication
|
99 |
+
subprocess.run(
|
100 |
+
[sys.executable, "-m", "pip", "install", "accelerate"],
|
101 |
+
check=True,
|
102 |
+
)
|
103 |
+
|
104 |
result = subprocess.run(
|
105 |
[
|
106 |
sys.executable,
|
|
|
109 |
"--quantize",
|
110 |
"--model_id",
|
111 |
input_model_id,
|
112 |
+
"--atol", # Adjust tolerance for numerical precision
|
113 |
+
"1e-04", # Increased tolerance to 1e-04
|
114 |
],
|
115 |
cwd=self.config.repo_path,
|
116 |
capture_output=True,
|