Commit 8c11c85a authored by chenpangpang's avatar chenpangpang
Browse files

feat: fix bug

parent 58e1892d
......@@ -17,7 +17,10 @@ COPY chenyh/$IMAGE/frpc_linux_amd64_v0.2 /opt/conda/lib/python3.10/site-packages
RUN chmod +x /opt/conda/lib/python3.10/site-packages/gradio/frpc_linux_amd64_v0.2
COPY chenyh/$IMAGE/model_real_esran /root/$IMAGE_UPPER/model_real_esran
COPY chenyh/$IMAGE/model_rife /root/$IMAGE_UPPER/model_rife
COPY chenyh/$IMAGE/THUDM/CogVideoX-5b /root/$IMAGE_UPPER/THUDM/CogVideoX-5b
RUN apt-get update && apt-get install -y libglib2.0-0 libgl1-mesa-glx && apt-get clean
COPY --from=base /opt/conda/lib/python3.10/site-packages /opt/conda/lib/python3.10/site-packages
COPY --from=base /root/$IMAGE/$IMAGE_UPPER /root/$IMAGE_UPPER
COPY --from=base /root/$IMAGE/启动器.ipynb /root/$IMAGE/start.sh /root/
COPY --from=base /root/$IMAGE/assets /root/
\ No newline at end of file
COPY --from=base /root/$IMAGE/assets /root/assets
# CogVideoX-5B
- 在scnet上需要运行
```python
transformers.utils.move_cache()
```
\ No newline at end of file
import os
import shutil
MODEL_NAME = "THUDM/CogVideoX-5b"
HF_CACHE_DIR = "/root/.cache/huggingface/hub/"
hash_code = None
for cache_model_name in os.listdir(HF_CACHE_DIR):
flag = False
for model_name_str_split in MODEL_NAME.split("/"):
if model_name_str_split in cache_model_name:
flag = True
else:
flag = False
break
if flag:
if hash_code is None:
full_path = os.path.join(HF_CACHE_DIR, cache_model_name, "snapshots",
os.listdir(os.path.join(HF_CACHE_DIR, cache_model_name, "snapshots"))[0])
else:
full_path = os.path.join(HF_CACHE_DIR, cache_model_name, "snapshots", hash_code)
os.makedirs(MODEL_NAME, exist_ok=True)
for filename in os.listdir(full_path):
print("copy: ", os.path.join(full_path, filename), " to ", os.path.join(MODEL_NAME, filename))
if os.path.isdir(os.path.join(full_path, filename)):
shutil.copytree(os.path.join(full_path, filename), os.path.join(MODEL_NAME, filename))
elif os.path.isfile(os.path.join(full_path, filename)):
shutil.copy(os.path.join(full_path, filename), os.path.join(MODEL_NAME, filename))
else:
raise Exception("path is not a file or directory: ", os.path.join(full_path, filename))
......@@ -8,3 +8,13 @@ from huggingface_hub import hf_hub_download, snapshot_download
hf_hub_download(repo_id="ai-forever/Real-ESRGAN", filename="RealESRGAN_x4.pth", local_dir="model_real_esran")
snapshot_download(repo_id="AlexWortega/RIFE", local_dir="model_rife")
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
model_list = [
"THUDM/CogVideoX-5b"
]
for model_path in model_list:
os.system(
f"huggingface-cli download --resume-download {model_path} --local-dir ./{model_path} --local-dir-use-symlinks False")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment