1TSnakers commited on
Commit
d8b42ac
·
verified ·
1 Parent(s): b0beaf2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -15
app.py CHANGED
@@ -96,21 +96,24 @@ class ModelConverter:
96
  """Convert the model to ONNX format."""
97
  try:
98
  if trust_remote_code:
99
- result = subprocess.run(
100
- [
101
- sys.executable,
102
- "-m",
103
- "scripts.convert",
104
- "--quantize",
105
- "--trust_remote_code",
106
- "--model_id",
107
- input_model_id,
108
- ],
109
- cwd=self.config.repo_path,
110
- capture_output=True,
111
- text=True,
112
- env={},
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
  [