Update app.py
Browse files
app.py
CHANGED
@@ -96,21 +96,24 @@ class ModelConverter:
|
|
96 |
"""Convert the model to ONNX format."""
|
97 |
try:
|
98 |
if trust_remote_code:
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
114 |
else:
|
115 |
result = subprocess.run(
|
116 |
[
|
|
|
96 |
"""Convert the model to ONNX format."""
|
97 |
try:
|
98 |
if trust_remote_code:
|
99 |
+
if st.session_state.get("user_hf_token") == st.secrets.get("HF_TOKEN"):
|
100 |
+
result = subprocess.run(
|
101 |
+
[
|
102 |
+
sys.executable,
|
103 |
+
"-m",
|
104 |
+
"scripts.convert",
|
105 |
+
"--quantize",
|
106 |
+
"--trust_remote_code",
|
107 |
+
"--model_id",
|
108 |
+
input_model_id,
|
109 |
+
],
|
110 |
+
cwd=self.config.repo_path,
|
111 |
+
capture_output=True,
|
112 |
+
text=True,
|
113 |
+
env={},
|
114 |
+
)
|
115 |
+
else:
|
116 |
+
raise Exception("Trust Remote Code requires your own HuggingFace token.")
|
117 |
else:
|
118 |
result = subprocess.run(
|
119 |
[
|