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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
---
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
license: llama3
|
7 |
+
library_name: transformers
|
8 |
+
tags:
|
9 |
+
- agents
|
10 |
+
- agent
|
11 |
+
- llm
|
12 |
+
- llama
|
13 |
+
- GGUF
|
14 |
+
datasets:
|
15 |
+
- McGill-NLP/WebLINX
|
16 |
+
quantized_by: andrijdavid
|
17 |
+
---
|
18 |
+
# Llama-3-8B-Web-GGUF
|
19 |
+
- Original model: [Llama-3-8B-Web](https://huggingface.co/McGill-NLP/Llama-3-8B-Web)
|
20 |
+
|
21 |
+
<!-- description start -->
|
22 |
+
## Description
|
23 |
+
|
24 |
+
This repo contains GGUF format model files for [Llama-3-8B-Web](https://huggingface.co/McGill-NLP/Llama-3-8B-Web).
|
25 |
+
|
26 |
+
<!-- description end -->
|
27 |
+
<!-- README_GGUF.md-about-gguf start -->
|
28 |
+
### About GGUF
|
29 |
+
GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
|
30 |
+
Here is an incomplete list of clients and libraries that are known to support GGUF:
|
31 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp). This is the source project for GGUF, providing both a Command Line Interface (CLI) and a server option.
|
32 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui), Known as the most widely used web UI, this project boasts numerous features and powerful extensions, and supports GPU acceleration.
|
33 |
+
* [Ollama](https://github.com/jmorganca/ollama) Ollama is a lightweight and extensible framework designed for building and running language models locally. It features a simple API for creating, managing, and executing models, along with a library of pre-built models for use in various applications
|
34 |
+
* [KoboldCpp](https://github.com/LostRuins/koboldcpp), A comprehensive web UI offering GPU acceleration across all platforms and architectures, particularly renowned for storytelling.
|
35 |
+
* [GPT4All](https://gpt4all.io), This is a free and open source GUI that runs locally, supporting Windows, Linux, and macOS with full GPU acceleration.
|
36 |
+
* [LM Studio](https://lmstudio.ai/) An intuitive and powerful local GUI for Windows and macOS (Silicon), featuring GPU acceleration.
|
37 |
+
* [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui). A notable web UI with a variety of unique features, including a comprehensive model library for easy model selection.
|
38 |
+
* [Faraday.dev](https://faraday.dev/), An attractive, user-friendly character-based chat GUI for Windows and macOS (both Silicon and Intel), also offering GPU acceleration.
|
39 |
+
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), A Python library equipped with GPU acceleration, LangChain support, and an OpenAI-compatible API server.
|
40 |
+
* [candle](https://github.com/huggingface/candle), A Rust-based ML framework focusing on performance, including GPU support, and designed for ease of use.
|
41 |
+
* [ctransformers](https://github.com/marella/ctransformers), A Python library featuring GPU acceleration, LangChain support, and an OpenAI-compatible AI server.
|
42 |
+
* [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
|
43 |
+
<!-- README_GGUF.md-about-gguf end -->
|
44 |
+
|
45 |
+
<!-- compatibility_gguf start -->
|
46 |
+
## Explanation of quantisation methods
|
47 |
+
<details>
|
48 |
+
<summary>Click to see details</summary>
|
49 |
+
The new methods available are:
|
50 |
+
|
51 |
+
* GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
|
52 |
+
* GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
|
53 |
+
* GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
|
54 |
+
* GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
|
55 |
+
* GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw.
|
56 |
+
</details>
|
57 |
+
<!-- compatibility_gguf end -->
|
58 |
+
|
59 |
+
<!-- README_GGUF.md-how-to-download start -->
|
60 |
+
## How to download GGUF files
|
61 |
+
|
62 |
+
**Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single folder.
|
63 |
+
|
64 |
+
The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
|
65 |
+
|
66 |
+
* LM Studio
|
67 |
+
* LoLLMS Web UI
|
68 |
+
* Faraday.dev
|
69 |
+
|
70 |
+
### In `text-generation-webui`
|
71 |
+
|
72 |
+
Under Download Model, you can enter the model repo: LiteLLMs/Llama-3-8B-Web-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00009.gguf.
|
73 |
+
|
74 |
+
Then click Download.
|
75 |
+
|
76 |
+
### On the command line, including multiple files at once
|
77 |
+
|
78 |
+
I recommend using the `huggingface-hub` Python library:
|
79 |
+
|
80 |
+
```shell
|
81 |
+
pip3 install huggingface-hub
|
82 |
+
```
|
83 |
+
|
84 |
+
Then you can download any individual model file to the current directory, at high speed, with a command like this:
|
85 |
+
|
86 |
+
```shell
|
87 |
+
huggingface-cli download LiteLLMs/Llama-3-8B-Web-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
|
88 |
+
```
|
89 |
+
|
90 |
+
<details>
|
91 |
+
<summary>More advanced huggingface-cli download usage (click to read)</summary>
|
92 |
+
|
93 |
+
You can also download multiple files at once with a pattern:
|
94 |
+
|
95 |
+
```shell
|
96 |
+
huggingface-cli download LiteLLMs/Llama-3-8B-Web-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
|
97 |
+
```
|
98 |
+
|
99 |
+
For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
|
100 |
+
|
101 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
102 |
+
|
103 |
+
```shell
|
104 |
+
pip3 install huggingface_hub[hf_transfer]
|
105 |
+
```
|
106 |
+
|
107 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
108 |
+
|
109 |
+
```shell
|
110 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/Llama-3-8B-Web-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
|
111 |
+
```
|
112 |
+
|
113 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
114 |
+
</details>
|
115 |
+
<!-- README_GGUF.md-how-to-download end -->
|
116 |
+
<!-- README_GGUF.md-how-to-run start -->
|
117 |
+
## Example `llama.cpp` command
|
118 |
+
|
119 |
+
Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
|
120 |
+
|
121 |
+
```shell
|
122 |
+
./main -ngl 35 -m Q4_0/Q4_0-00001-of-00009.gguf --color -c 8192 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<PROMPT>"
|
123 |
+
```
|
124 |
+
|
125 |
+
Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
126 |
+
|
127 |
+
Change `-c 8192` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
|
128 |
+
|
129 |
+
If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
|
130 |
+
|
131 |
+
For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
|
132 |
+
|
133 |
+
## How to run in `text-generation-webui`
|
134 |
+
|
135 |
+
Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20%E2%80%90%20Model%20Tab.md#llamacpp).
|
136 |
+
|
137 |
+
## How to run from Python code
|
138 |
+
|
139 |
+
You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries. Note that at the time of writing (Nov 27th 2023), ctransformers has not been updated for some time and is not compatible with some recent models. Therefore I recommend you use llama-cpp-python.
|
140 |
+
|
141 |
+
### How to load this model in Python code, using llama-cpp-python
|
142 |
+
|
143 |
+
For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
|
144 |
+
|
145 |
+
#### First install the package
|
146 |
+
|
147 |
+
Run one of the following commands, according to your system:
|
148 |
+
|
149 |
+
```shell
|
150 |
+
# Base ctransformers with no GPU acceleration
|
151 |
+
pip install llama-cpp-python
|
152 |
+
# With NVidia CUDA acceleration
|
153 |
+
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
|
154 |
+
# Or with OpenBLAS acceleration
|
155 |
+
CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
|
156 |
+
# Or with CLBLast acceleration
|
157 |
+
CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
|
158 |
+
# Or with AMD ROCm GPU acceleration (Linux only)
|
159 |
+
CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
|
160 |
+
# Or with Metal GPU acceleration for macOS systems only
|
161 |
+
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
|
162 |
+
# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
|
163 |
+
$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
|
164 |
+
pip install llama-cpp-python
|
165 |
+
```
|
166 |
+
|
167 |
+
#### Simple llama-cpp-python example code
|
168 |
+
|
169 |
+
```python
|
170 |
+
from llama_cpp import Llama
|
171 |
+
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
172 |
+
llm = Llama(
|
173 |
+
model_path="./Q4_0/Q4_0-00001-of-00009.gguf", # Download the model file first
|
174 |
+
n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
|
175 |
+
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
|
176 |
+
n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
|
177 |
+
)
|
178 |
+
# Simple inference example
|
179 |
+
output = llm(
|
180 |
+
"<PROMPT>", # Prompt
|
181 |
+
max_tokens=512, # Generate up to 512 tokens
|
182 |
+
stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
|
183 |
+
echo=True # Whether to echo the prompt
|
184 |
+
)
|
185 |
+
# Chat Completion API
|
186 |
+
llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00009.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
|
187 |
+
llm.create_chat_completion(
|
188 |
+
messages = [
|
189 |
+
{"role": "system", "content": "You are a story writing assistant."},
|
190 |
+
{
|
191 |
+
"role": "user",
|
192 |
+
"content": "Write a story about llamas."
|
193 |
+
}
|
194 |
+
]
|
195 |
+
)
|
196 |
+
```
|
197 |
+
|
198 |
+
## How to use with LangChain
|
199 |
+
|
200 |
+
Here are guides on using llama-cpp-python and ctransformers with LangChain:
|
201 |
+
|
202 |
+
* [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
|
203 |
+
* [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
|
204 |
+
|
205 |
+
<!-- README_GGUF.md-how-to-run end -->
|
206 |
+
|
207 |
+
<!-- footer end -->
|
208 |
+
|
209 |
+
<!-- original-model-card start -->
|
210 |
+
# Original model card: Llama-3-8B-Web
|
211 |
+
|
212 |
+
|
213 |
+
|
214 |
+
|
215 |
+
<div align="center">
|
216 |
+
|
217 |
+
<h1>Llama-3-8B-Web</h1>
|
218 |
+
|
219 |
+
<table>
|
220 |
+
<tr>
|
221 |
+
<td>
|
222 |
+
<a href="https://github.com/McGill-NLP/webllama">💻 GitHub</a>
|
223 |
+
</td>
|
224 |
+
<td>
|
225 |
+
<a href="https://webllama.github.io">🏠 Homepage</a>
|
226 |
+
</td>
|
227 |
+
<td>
|
228 |
+
<a href="https://huggingface.co/McGill-NLP/Llama-3-8B-Web">🤗 Llama-3-8B-Web</a>
|
229 |
+
</td>
|
230 |
+
</tr>
|
231 |
+
</table>
|
232 |
+
|
233 |
+
|
234 |
+
<img src="assets/WebLlamaLogo.png" style="width: 400px;" />
|
235 |
+
|
236 |
+
*By using this model, you are accepting the terms of the [Meta Llama 3 Community License Agreement](https://llama.meta.com/llama3/license/).*
|
237 |
+
|
238 |
+
</div>
|
239 |
+
|
240 |
+
| `WebLlama` helps you build powerful agents, powered by Meta Llama 3, for browsing the web on your behalf | Our first model, [`Llama-3-8B-Web`](https://huggingface.co/McGill-NLP/Llama-3-8B-Web), surpasses GPT-4V (`*`zero-shot) by 18% on [`WebLINX`](https://mcgill-nlp.github.io/weblinx/) |
|
241 |
+
| :: | : |
|
242 |
+
| Modeling | We are build on top of cutting edge libraries for training Llama agents on web navigation tasks. We will provide training scripts, optimized configs, and instructions for training cutting-edge Llamas. |
|
243 |
+
| Evaluation | Benchmarks for testing Llama models on real-world web browsing. This include *human-centric* browsing through dialogue ([`WebLINX`](https://mcgill-nlp.github.io/weblinx/)), and we will soon add more benchmarks for automatic web navigation (e.g. Mind2Web). |
|
244 |
+
| Data | Our first model is finetuned on over 24K instances of web interactions, including `click`, `textinput`, `submit`, and dialogue acts. We want to continuously curate, compile and release datasets for training better agents. |
|
245 |
+
| Deployment | We want to make it easy to integrate Llama models with existing deployment platforms, including Playwright, Selenium, and BrowserGym. We are currently focusing on making this a reality. |
|
246 |
+
|
247 |
+
|
248 |
+
## Evaluation
|
249 |
+
|
250 |
+
We believe short demo videos showing how well an agent performs is NOT enough to judge an agent. Simply put, **we do not know if we have a good agent if we do not have good benchmarks.** We need to systematically evaluate agents on wide range of tasks, spanning from simple instruction-following web navigation to complex dialogue-guided browsing.
|
251 |
+
|
252 |
+
<img src="assets/WebLINXTestSplits.png" style="width: 100%; max-width:800px"/>
|
253 |
+
|
254 |
+
This is why we chose [`WebLINX`](https://mcgill-nlp.github.io/weblinx/) as our first benchmark. In addition to the training split, the benchmark has 4 real-world splits, with the goal of testing multiple dimensions of generalization: new websites, new domains, unseen geographic locations, and scenarios where the *user cannot see the screen and relies on dialogue*. It also covers 150 websites, including booking, shopping, writing, knowledge lookup, and even complex tasks like manipulating spreadsheets.
|
255 |
+
|
256 |
+
## Data
|
257 |
+
|
258 |
+
Although the 24K training examples from [`WebLINX`](https://mcgill-nlp.github.io/weblinx/) provide a good starting point for training a capable agent, we believe that more data is needed to train agents that can generalize to a wide range of web navigation tasks. Although it has been trained and evaluated on 150 websites, there are millions of websites that has never been seen by the model, with new ones being created every day.
|
259 |
+
|
260 |
+
**This motivates us to continuously curate, compile and release datasets for training better agents.** As an immediate next step, we will be incorporating `Mind2Web`'s training data into the equation, which also covers over 100 websites.
|
261 |
+
|
262 |
+
|
263 |
+
## Deployment
|
264 |
+
|
265 |
+
We are working hard to make it easy for you to deploy Llama web agents to the web. We want to integrate `WebLlama` with existing deployment platforms, including Microsoft's Playwright, ServiceNow Research's BrowserGym, and other partners.
|
266 |
+
|
267 |
+
## Code
|
268 |
+
|
269 |
+
The code for finetuning the model and evaluating it on the [`WebLINX`](https://mcgill-nlp.github.io/weblinx/) benchmark is available now. You can find the detailed instructions in [modeling](https://github.com/McGill-NLP/webllama/tree/main/modeling).
|
270 |
+
|
271 |
+
|
272 |
+
## Citation
|
273 |
+
|
274 |
+
If you use `WebLlama` in your research, please cite the following paper (upon which the data, training and evaluation are originally based on):
|
275 |
+
|
276 |
+
```
|
277 |
+
@misc{lù2024weblinx,
|
278 |
+
title={WebLINX: Real-World Website Navigation with Multi-Turn Dialogue},
|
279 |
+
author={Xing Han Lù and Zdeněk Kasner and Siva Reddy},
|
280 |
+
year={2024},
|
281 |
+
eprint={2402.05930},
|
282 |
+
archivePrefix={arXiv},
|
283 |
+
primaryClass={cs.CL}
|
284 |
+
}
|
285 |
+
```
|
286 |
+
|
287 |
+
<!-- original-model-card end -->
|