# LLaMA & Alpaca: “ChatGPT”

Bis vor kurzem völlig undenkbar: Eine mit ChatGPT vergleichbare Sprach-KI läuft lokal (!) auf Standard-Rechnern.

# Installation

### Beschreibung

Einfache Installation über npx, der KI aus dem Netz.  
Man wählt die Varainate aus, wie viel Inhalt drin sein soll.  
  
Varianten:

- 7B =&gt; ~4 GB Downloadgröße und danach Größe im RAM
- 13B =&gt; ~8 GB Downloadgröße und danach Größe im RAM
- 30B =&gt; ~16 GB Downloadgröße und danach Größe im RAM
- 65B =&gt; ~32 GB Downloadgröße und danach Größe im RAM

### Installation

Die Installation läuft über npm.  
Falls nicht installiert, dann installieren

```
sudo apt install npm
Install Alpcaca Model
sudo npx dalai alpaca install 7B

oder/und install
npx dalai llama install 7B
```

Ausgabe:

```
Das dauert... es werden 32 GB und mehr runtergeladen
...
mkdir /root/dalai
{ method: 'install', callparams: [ '7B' ] }
2 [Error: ENOENT: no such file or directory, rename '/root/dalai/alpaca/models' -> '/root/dalai/tmp/models'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'rename',
  path: '/root/dalai/alpaca/models',
  dest: '/root/dalai/tmp/models'
}
3 [Error: ENOENT: no such file or directory, lstat '/root/dalai/alpaca'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
...
ggml-model-q4_0.bin 100%[================================================>] in 1
ggml-model-q4_0.bin 100%[================================================>] in 0
ggml-model-q4_0.bin 100%[================================================>] done
ggml-model-q4_0.bin 100%[================================================>] done      

```

### Starten

```
sudo npx dalai serve
```

Ausgabe:

```
mkdir /root/dalai
Created custom directory: /root/dalai/config/prompts
Server running on http://localhost:3000/
```

### Fehler:

Falls Fehler bei der Installation auftauchen bezüglich Versionen

```
px dalai llama install 7B
Need to install the following packages:
  dalai
Ok to proceed? (y) y

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'dalai@0.3.1',
npm WARN EBADENGINE   required: { node: '>=18.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'terminal-kit@3.0.0',
npm WARN EBADENGINE   required: { node: '>=16.13.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'webtorrent@1.9.7',
npm WARN EBADENGINE   required: { node: '>=14' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'seventh@0.8.2',
npm WARN EBADENGINE   required: { node: '>=16.13.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'string-kit@0.17.8',
npm WARN EBADENGINE   required: { node: '>=14.15.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }

```

Die nodejs Engine aktualisieren.  
hier hab en wir als Beispiel Version 12.22.9 er will aber 18.0.0 haben

nodejs. downloaden und installieren (schauen ob es auch eine neuere gibt.)

```
wget https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz
tar -xf node-v18.16.0-linux-x64.tar.xz
cd node-v18.16.0-linux-x64
sudo cp -r * /usr/

```