Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -42,9 +42,6 @@ custom_css = r'''
|
|
| 42 |
}
|
| 43 |
'''
|
| 44 |
|
| 45 |
-
# ========== 存储的路径 ==========
|
| 46 |
-
print('HF_HOME', os.getenv("HF_HOME"))
|
| 47 |
-
|
| 48 |
|
| 49 |
# ========== 适配 SillyTavern 的模版 ==========
|
| 50 |
def text_format(text: str, _env=None, **env):
|
|
@@ -111,21 +108,10 @@ with gr.Blocks() as setting:
|
|
| 111 |
print(f"The file {setting_path.value} exists.")
|
| 112 |
else:
|
| 113 |
from huggingface_hub import snapshot_download
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
def hf_test():
|
| 117 |
-
directory = "/data/.huggingface/"
|
| 118 |
-
# 遍历目录下的所有文件
|
| 119 |
-
for root, dirs, files in os.walk(directory):
|
| 120 |
-
for file in files:
|
| 121 |
-
print(os.path.join(root, file))
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
hf_test()
|
| 125 |
os.mkdir("downloads")
|
| 126 |
os.mkdir("cache")
|
| 127 |
-
|
| 128 |
-
|
| 129 |
|
| 130 |
# ========== 加载模型 ==========
|
| 131 |
model = StreamingLLM(model_path=setting_path.value,
|
|
|
|
| 42 |
}
|
| 43 |
'''
|
| 44 |
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
# ========== 适配 SillyTavern 的模版 ==========
|
| 47 |
def text_format(text: str, _env=None, **env):
|
|
|
|
| 108 |
print(f"The file {setting_path.value} exists.")
|
| 109 |
else:
|
| 110 |
from huggingface_hub import snapshot_download
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
os.mkdir("downloads")
|
| 112 |
os.mkdir("cache")
|
| 113 |
+
snapshot_download(repo_id='TheBloke/CausalLM-7B-GGUF', local_dir=r'downloads',
|
| 114 |
+
allow_patterns='causallm_7b.Q5_K_M.gguf')
|
| 115 |
|
| 116 |
# ========== 加载模型 ==========
|
| 117 |
model = StreamingLLM(model_path=setting_path.value,
|