adjust to hf model
Browse files- server/setup.py +4 -3
server/setup.py
CHANGED
@@ -5,13 +5,13 @@ import ctranslate2
|
|
5 |
|
6 |
def download_model():
|
7 |
model_id = "JustFrederik/sugoi-v4-ja-en-ct2"
|
8 |
-
local_folder = snapshot_download(repo_id=model_id, local_dir="./
|
9 |
print(f"Files downloaded in: {local_folder}")
|
10 |
|
11 |
def convert_model():
|
12 |
model_dir = "./fairseq_model"
|
13 |
output_dir = "./server/ctranslate2_model"
|
14 |
-
if os.path.exists(output_dir) and "-overwrite" not in sys.argv: return
|
15 |
|
16 |
print("Converting...")
|
17 |
converter = ctranslate2.converters.FairseqConverter(model_dir)
|
@@ -22,4 +22,5 @@ def convert_model():
|
|
22 |
|
23 |
if __name__ == "__name__":
|
24 |
if "-download" in sys.argv: download_model()
|
25 |
-
convert_model()
|
|
|
|
5 |
|
6 |
def download_model():
|
7 |
model_id = "JustFrederik/sugoi-v4-ja-en-ct2"
|
8 |
+
local_folder = snapshot_download(repo_id=model_id, local_dir="./server/model")
|
9 |
print(f"Files downloaded in: {local_folder}")
|
10 |
|
11 |
def convert_model():
|
12 |
model_dir = "./fairseq_model"
|
13 |
output_dir = "./server/ctranslate2_model"
|
14 |
+
if (os.path.exists(output_dir) and "-overwrite" not in sys.argv) or not os.path.exists(model_dir): return
|
15 |
|
16 |
print("Converting...")
|
17 |
converter = ctranslate2.converters.FairseqConverter(model_dir)
|
|
|
22 |
|
23 |
if __name__ == "__name__":
|
24 |
if "-download" in sys.argv: download_model()
|
25 |
+
if "-convert" in sys.argv: convert_model()
|
26 |
+
|