Instructions to use lbox/lcube-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lbox/lcube-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lbox/lcube-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("lbox/lcube-base") model = AutoModelForCausalLM.from_pretrained("lbox/lcube-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use lbox/lcube-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lbox/lcube-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lbox/lcube-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/lbox/lcube-base
- SGLang
How to use lbox/lcube-base with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "lbox/lcube-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lbox/lcube-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "lbox/lcube-base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lbox/lcube-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use lbox/lcube-base with Docker Model Runner:
docker model run hf.co/lbox/lcube-base
Wonseok Hwang commited on
Commit ยท
6b69fc2
1
Parent(s): e90fbd2
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## How to use
|
| 2 |
+
```python
|
| 3 |
+
import transformers
|
| 4 |
+
|
| 5 |
+
model = transformers.GPT2LMHeadModel.from_pretrained("lbox/lcube-base")
|
| 6 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(
|
| 7 |
+
"lbox/lcube-base",
|
| 8 |
+
bos_token="[BOS]",
|
| 9 |
+
unk_token="[UNK]",
|
| 10 |
+
pad_token="[PAD]",
|
| 11 |
+
mask_token="[MASK]",
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
text = "ํผ๊ณ ์ธ์ ๋ถ์์ง์ ์๋ ์ปคํผ์์์, ํผํด์ B์ผ๋ก๋ถํฐ"
|
| 15 |
+
model_inputs = tokenizer(text,
|
| 16 |
+
max_length=1024,
|
| 17 |
+
padding=True,
|
| 18 |
+
truncation=True,
|
| 19 |
+
return_tensors='pt')
|
| 20 |
+
out = model.generate(
|
| 21 |
+
model_inputs["input_ids"],
|
| 22 |
+
max_new_tokens=150,
|
| 23 |
+
pad_token_id=tokenizer.pad_token_id,
|
| 24 |
+
use_cache=True,
|
| 25 |
+
repetition_penalty=1.2,
|
| 26 |
+
top_k=5,
|
| 27 |
+
top_p=0.9,
|
| 28 |
+
temperature=1,
|
| 29 |
+
num_beams=2,
|
| 30 |
+
)
|
| 31 |
+
tokenizer.batch_decode(out)
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
For more information please visit <https://github.com/lbox-kr/lbox_open>.
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
## Licensing Information
|
| 39 |
+
|
| 40 |
+
Copyright 2022-present LBox Co. Ltd.
|
| 41 |
+
|
| 42 |
+
Licensed under the CC BY-NC-ND 4.0
|