vlsp-2023-vllm/lambada_vi
Viewer • Updated • 10.2k • 128 • 1
How to use vietgpt/dama-2-7b with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="vietgpt/dama-2-7b") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("vietgpt/dama-2-7b")
model = AutoModelForCausalLM.from_pretrained("vietgpt/dama-2-7b")How to use vietgpt/dama-2-7b with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "vietgpt/dama-2-7b"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "vietgpt/dama-2-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/vietgpt/dama-2-7b
How to use vietgpt/dama-2-7b with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "vietgpt/dama-2-7b" \
--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": "vietgpt/dama-2-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "vietgpt/dama-2-7b" \
--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": "vietgpt/dama-2-7b",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use vietgpt/dama-2-7b with Docker Model Runner:
docker model run hf.co/vietgpt/dama-2-7b
Dama2 is an autoregressive Large Language Model (LLM), based on Llama2's model architecture. Dama2 was trained on part of the Common Crawl dataset in Vietnamese and English.
Details will be available soon.
To contact us, mail to: leanhcuong@gmail.com (Lê Anh Cường) | hieunguyen1053@outlook.com (Hiếu)
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("vietgpt/dama-2-7b")
model = AutoModelForCausalLM.from_pretrained("vietgpt/dama-2-7b", low_cpu_mem_usage=True)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
prompt = "Địa chỉ trường Đại học Tôn Đức Thắng nằm ở số"
input_ids = tokenizer(prompt, return_tensors="pt")['input_ids'].to(device)
gen_tokens = model.generate(input_ids, max_length=max_length, repetition_penalty=1.1)
print(tokenizer.batch_decode(gen_tokens)[0])
{
"results": {
"lambada_vi": {
"ppl": 17.662483545322115,
"ppl_stderr": 0.46441057543941494,
"acc": 0.34159672067148156,
"acc_stderr": 0.004685401990271572
}
},
"versions": {
"lambada_vi": null
},
"config": {
"model": "hf-causal",
"model_args": "pretrained=vietgpt/dama-2-7b",
"num_fewshot": 0,
"batch_size": null,
"batch_sizes": [],
"device": "cuda:1",
"no_cache": false,
"limit": null,
"bootstrap_iters": 100000,
"description_dict": {}
}
}
hf-causal (pretrained=vietgpt/dama-2-7b), limit: None, provide_description: False, num_fewshot: 0, batch_size: None
| Task |Version|Metric| Value | |Stderr|
|----------|-------|------|------:|---|-----:|
|lambada_vi| |ppl |17.6625|± |0.4644|
| | |acc | 0.3416|± |0.0047|