Instructions to use NoQuest/LLmSave with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use NoQuest/LLmSave with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="NoQuest/LLmSave", filename="LLamandementFineTuneSansNotation16Q.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use NoQuest/LLmSave with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf NoQuest/LLmSave:Q8_0 # Run inference directly in the terminal: llama-cli -hf NoQuest/LLmSave:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf NoQuest/LLmSave:Q8_0 # Run inference directly in the terminal: llama-cli -hf NoQuest/LLmSave:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf NoQuest/LLmSave:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf NoQuest/LLmSave:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf NoQuest/LLmSave:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf NoQuest/LLmSave:Q8_0
Use Docker
docker model run hf.co/NoQuest/LLmSave:Q8_0
- LM Studio
- Jan
- Ollama
How to use NoQuest/LLmSave with Ollama:
ollama run hf.co/NoQuest/LLmSave:Q8_0
- Unsloth Studio new
How to use NoQuest/LLmSave with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NoQuest/LLmSave to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NoQuest/LLmSave to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for NoQuest/LLmSave to start chatting
- Docker Model Runner
How to use NoQuest/LLmSave with Docker Model Runner:
docker model run hf.co/NoQuest/LLmSave:Q8_0
- Lemonade
How to use NoQuest/LLmSave with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull NoQuest/LLmSave:Q8_0
Run and chat with the model
lemonade run user.LLmSave-Q8_0
List all available models
lemonade list
Upload DownloadUploadble.py with huggingface_hub
Browse files- DownloadUploadble.py +102 -0
DownloadUploadble.py
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from huggingface_hub import HfFolder, hf_hub_url
|
| 3 |
+
import os
|
| 4 |
+
import requests
|
| 5 |
+
import tqdm
|
| 6 |
+
from requests.adapters import HTTPAdapter
|
| 7 |
+
from requests.exceptions import ConnectionError, RequestException, Timeout
|
| 8 |
+
from tqdm.contrib.concurrent import thread_map
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
import time
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
# Save your token
|
| 14 |
+
HfFolder.save_token('') # Replace with your actual token
|
| 15 |
+
|
| 16 |
+
# Define the repository to download from
|
| 17 |
+
repo_id = "NoQuest/LLmSave"
|
| 18 |
+
repo_type = "model"
|
| 19 |
+
|
| 20 |
+
# Local path where you want to save the downloaded files
|
| 21 |
+
local_folder_path = "./LLmSaveLocal"
|
| 22 |
+
|
| 23 |
+
# Variable to specify the file or directory to download
|
| 24 |
+
download_target = "fichiertemoin.txt" # Change this to the desired file or directory name
|
| 25 |
+
|
| 26 |
+
print(f"Downloading {download_target} from {repo_id} to {local_folder_path}...")
|
| 27 |
+
|
| 28 |
+
# Create the local directory if it doesn't exist
|
| 29 |
+
os.makedirs(local_folder_path, exist_ok=True)
|
| 30 |
+
|
| 31 |
+
# Print the URL for debugging
|
| 32 |
+
print(f"URL: {hf_hub_url(repo_id, download_target, repo_type=repo_type)}")
|
| 33 |
+
|
| 34 |
+
def get_session(max_retries=5):
|
| 35 |
+
session = requests.Session()
|
| 36 |
+
if max_retries:
|
| 37 |
+
session.mount('https://cdn-lfs.huggingface.co', HTTPAdapter(max_retries=max_retries))
|
| 38 |
+
session.mount('https://huggingface.co', HTTPAdapter(max_retries=max_retries))
|
| 39 |
+
# ... (add authentication if needed)
|
| 40 |
+
return session
|
| 41 |
+
|
| 42 |
+
def get_single_file(url, output_folder, start_from_scratch=False, max_retries=7):
|
| 43 |
+
filename = Path(url.rsplit('/', 1)[1])
|
| 44 |
+
output_path = output_folder / filename
|
| 45 |
+
attempt = 0
|
| 46 |
+
while attempt < max_retries:
|
| 47 |
+
attempt += 1
|
| 48 |
+
session = get_session()
|
| 49 |
+
headers = {}
|
| 50 |
+
mode = 'wb'
|
| 51 |
+
if output_path.exists() and not start_from_scratch:
|
| 52 |
+
# Resume download
|
| 53 |
+
r = session.get(url, stream=True, timeout=20)
|
| 54 |
+
total_size = int(r.headers.get('content-length', 0))
|
| 55 |
+
if output_path.stat().st_size >= total_size:
|
| 56 |
+
return
|
| 57 |
+
headers = {'Range': f'bytes={output_path.stat().st_size}-'}
|
| 58 |
+
mode = 'ab'
|
| 59 |
+
try:
|
| 60 |
+
with session.get(url, stream=True, headers=headers, timeout=30) as r:
|
| 61 |
+
r.raise_for_status()
|
| 62 |
+
total_size = int(r.headers.get('content-length', 0))
|
| 63 |
+
block_size = 1024 * 1024 # 1MB
|
| 64 |
+
tqdm_kwargs = {'total': total_size, 'unit': 'iB', 'unit_scale': True, 'bar_format': '{l_bar}{bar}|{n_fmt}/{total_fmt}{rate_fmt}'}
|
| 65 |
+
with open(output_path, mode) as f:
|
| 66 |
+
with tqdm.tqdm(**tqdm_kwargs) as t:
|
| 67 |
+
for data in r.iter_content(block_size):
|
| 68 |
+
f.write(data)
|
| 69 |
+
t.update(len(data))
|
| 70 |
+
break # Exit loop if successful
|
| 71 |
+
except (RequestException, ConnectionError, Timeout) as e:
|
| 72 |
+
print(f"Error downloading {filename}: {e}.")
|
| 73 |
+
print(f"That was attempt {attempt}/{max_retries}.", end='')
|
| 74 |
+
if attempt < max_retries:
|
| 75 |
+
print(f"Retry begins in {2**attempt} seconds.")
|
| 76 |
+
time.sleep(2**attempt)
|
| 77 |
+
else:
|
| 78 |
+
print("Failed to download after the maximum number of attempts.")
|
| 79 |
+
|
| 80 |
+
def start_download_threads(file_list, output_folder, start_from_scratch=False, threads=4):
|
| 81 |
+
thread_map(lambda url: get_single_file(url, output_folder, start_from_scratch=start_from_scratch), file_list, max_workers=threads, disable=True)
|
| 82 |
+
|
| 83 |
+
def download_model_files(model, branch, links, output_folder, start_from_scratch=False, threads=4):
|
| 84 |
+
output_folder = Path(output_folder)
|
| 85 |
+
#output_folder.mkdir(parents=True, exist_ok=True)
|
| 86 |
+
output_folder.mkdir(parents=True, exist_ok=True)
|
| 87 |
+
|
| 88 |
+
# ... (add metadata writing if needed)
|
| 89 |
+
print(f"Downloading the model to {output_folder}")
|
| 90 |
+
start_download_threads(links, output_folder, start_from_scratch=start_from_scratch, threads=threads)
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
# Download the specified file or directory
|
| 95 |
+
session = get_session()
|
| 96 |
+
links = [hf_hub_url(repo_id, download_target, repo_type=repo_type)]
|
| 97 |
+
|
| 98 |
+
branch = "main"
|
| 99 |
+
|
| 100 |
+
download_model_files(repo_id, branch, links, local_folder_path)
|
| 101 |
+
|
| 102 |
+
print("Download complete!")
|