import gradio as gr import os os.system('CMAKE_ARGS="-DLLAMA_OPENBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python') import wget from llama_cpp import Llama import random import os import multiprocessing def get_num_cores(): """Get the number of CPU cores.""" return os.cpu_count() def get_num_threads(): """Get the number of threads available to the current process.""" return multiprocessing.cpu_count() if __name__ == "__main__": num_cores = get_num_cores() num_threads = get_num_threads() print(f"Number of CPU cores: {num_cores}") print(f"Number of threads available to the current process: {num_threads}") #url = 'https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/resolve/main/llama-2-7b-chat.ggmlv3.q2_K.bin' #filename = wget.download(url) model_path= hf_hub_download(repo_id="TheBloke/llama2-7b-chat-codeCherryPop-qLoRA-GGML", filename="llama-2-7b-chat-codeCherryPop.ggmlv3.q2_K.bin") llm2 = Llama(model_path=model_path, seed=random.randint(1, 2**31), lora_path="ggml-adapter-model (1).bin", use_mlock=True, n_threads=2) filename = wget.download(url) theme = gr.themes.Soft( primary_hue=gr.themes.Color("#ededed", "#fee2e2", "#fecaca", "#fca5a5", "#f87171", "#ef4444", "#dc2626", "#b91c1c", "#991b1b", "#7f1d1d", "#6c1e1e"), neutral_hue="red", ) title = """