https://github.com/jbilcke-hf/template-node-ctransformers-express
A minimalist Docker project to help people getting started with Node, CTransformers, Express and TypeScript. Ready to be used in a Hugging Face Space.
https://github.com/jbilcke-hf/template-node-ctransformers-express
ctransformers docker huggingface-spaces nodejs
Last synced: 5 months ago
JSON representation
A minimalist Docker project to help people getting started with Node, CTransformers, Express and TypeScript. Ready to be used in a Hugging Face Space.
- Host: GitHub
- URL: https://github.com/jbilcke-hf/template-node-ctransformers-express
- Owner: jbilcke-hf
- License: apache-2.0
- Created: 2023-06-21T14:04:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-21T15:33:26.000Z (over 2 years ago)
- Last Synced: 2025-02-17T05:13:20.017Z (8 months ago)
- Topics: ctransformers, docker, huggingface-spaces, nodejs
- Language: TypeScript
- Homepage: https://huggingface.co/spaces/jbilcke-hf/template-node-ctransformers-express
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
---
title: Template Node CTransformers Express
emoji: 🐍
colorFrom: yellow
colorTo: green
sdk: docker
pinned: false
app_port: 7860
---A minimalist Docker space to help people getting started with Node, CTransformers (through Pythonia), Express and TypeScript.
Ready to be used in a Hugging Face Space.## Demo
https://huggingface.co/spaces/jbilcke-hf/template-node-ctransformers-express
## Installation
### Prerequisites
- Install NVM: https://github.com/nvm-sh/nvm
- Install Docker https://www.docker.com### CTransformers
This projects 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-ctransformers-express .
docker run -it -p 7860:7860 template-node-ctransformers-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:
```
🌉 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 :)
See this demo: https://huggingface.co/spaces/jbilcke-hf/template-node-ctransformers-express