Update README.md
Browse files
README.md
CHANGED
@@ -22,5 +22,37 @@ It is converted into 8-bit GGUF format from original repository [huggingface.co/
|
|
22 |
|
23 |
### Example usage
|
24 |
**With Llamacpp:**
|
|
|
|
|
|
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
### Example usage
|
24 |
**With Llamacpp:**
|
25 |
+
```
|
26 |
+
from langchain_community.llms. llamacpp import Llamacpp
|
27 |
+
from huggingface_hub import hf_hub_download
|
28 |
|
29 |
+
YOUR_MODEL_DIRECTORY = None
|
30 |
+
CONTEXT LENGHT = None
|
31 |
+
MAX TOKENS = None
|
32 |
+
BATCH SIZE = None
|
33 |
+
TEMPERATURE = None
|
34 |
+
GPU_OFFLOAD = None
|
35 |
+
|
36 |
+
def load_model (model_id, model_basename):
|
37 |
+
model_path = hf_hub_download (
|
38 |
+
repo_id=model_id,
|
39 |
+
filename=model_basename,
|
40 |
+
resume_download=True,
|
41 |
+
cache_dir="YOUR_MODEL_DIRECTORY",
|
42 |
+
)
|
43 |
+
kwargs = {
|
44 |
+
'model_path': model_path,
|
45 |
+
'n_ctx': CONTEXT_LENGHT,
|
46 |
+
'max_tokens': MAX_TOKENS,
|
47 |
+
'n_batch': BATCH_SIZE,
|
48 |
+
'n_gpu_layers': GPU_OFFLOAD,
|
49 |
+
'temperature': TEMPERATURE,
|
50 |
+
'verbose': True,
|
51 |
+
}
|
52 |
+
return LlamaCpp(**kwargs)
|
53 |
+
|
54 |
+
11m = load_model(
|
55 |
+
model_id="whoami02/defog-sqlcoder-2-GGUF",
|
56 |
+
model_basename="sqlcoder-7b-2.q8_0.gguf",
|
57 |
+
```
|
58 |
+
<!-- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64e4b2a292418458795a5cb5/hX-xeG1VKwIbumDGNT05W.png) -->
|