File size: 2,628 Bytes
c359b08
 
 
6d895c6
 
c359b08
 
 
 
 
 
 
 
3bcd657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c359b08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36f130e
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
title: Template Node WizardCoder Express
emoji: 🧙
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
app_port: 7860
---

A minimalist Docker space to help people getting started with Node, WizardCoder (through CTransformers and Pythonia), Express and TypeScript.
Ready to be used in a Hugging Face Space.


# Examples

## Live example

Note: the space make take a few minutes to start.
If it begins outputing bad HTML, release the page.

https://huggingface.co/spaces/jbilcke-hf/template-node-wizardcoder-express?prompt=the%20landing%20page%20of%20a%20dog%20sitting%20company%20operating%20in%20NYC

## Local prompt examples

http://localhost:7860/?prompt=a%20landing%20page%20for%20a%20company%20called%20Hugging%20Face
http://localhost:7860?prompt=the%20landing%20page%20of%20a%20dog%20sitting%20company%20operating%20in%20NYC

## Installation

### Prerequisites

- Install NVM: https://github.com/nvm-sh/nvm
- Install Docker https://www.docker.com

### CTransformers

This project relies on CTransformers called through Pythonia.

To install ctransformers:

```bash
pip install ctransformers
# or this, depending on your Python environment:
# pip3 install ctransformers
```

For GPU (CUDA) support set environment variable CT_CUBLAS=1 and install from source using:

```bash
CT_CUBLAS=1 pip install ctransformers --no-binary ctransformers
# or this, depending on your Python environment:
# CT_CUBLAS=1 pip3 install ctransformers --no-binary ctransformers
```

### Building and run without Docker

```bash
nvm use
npm i
npm run start
```

### Building and running with Docker

```bash
npm run docker
```

This script is a shortcut executing the following commands:

```bash
docker build -t template-node-wizardcoder-express .
docker run -it -p 7860:7860 template-node-wizardcoder-express
```

Attention! If you have a Mac, you may have trouble running the project on your machine.

You will see the following error message because Docker won't be able to use the pre-generated binaries for `libctransformers.so` due to architecture incompatibility:

```
🌉 OSError: /home/user/.local/lib/python3.11/site-packages/ctransformers/lib/avx2/libctransformers.so: cannot open shared object file: No such file or directory]
```

However if you run your project on a Hugging Face space, you should be just fine :)

### Deployment to Hugging Face

The standard free CPU instance (16 Gb) will not be enough for WizardCoder, you should use the upgraded CPU instance (32 Gb)

I haven't upgraded mine yet, so it will probably crash when you try it:
https://huggingface.co/spaces/jbilcke-hf/template-node-wizardcoder-express