nthngdy/oscar-mini
Updated • 229 • 6
How to use Tamnemtf/llama-2-7b-vi-oscar_mini with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Tamnemtf/llama-2-7b-vi-oscar_mini") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Tamnemtf/llama-2-7b-vi-oscar_mini")
model = AutoModelForCausalLM.from_pretrained("Tamnemtf/llama-2-7b-vi-oscar_mini")How to use Tamnemtf/llama-2-7b-vi-oscar_mini with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Tamnemtf/llama-2-7b-vi-oscar_mini"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Tamnemtf/llama-2-7b-vi-oscar_mini",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Tamnemtf/llama-2-7b-vi-oscar_mini
How to use Tamnemtf/llama-2-7b-vi-oscar_mini with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Tamnemtf/llama-2-7b-vi-oscar_mini" \
--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": "Tamnemtf/llama-2-7b-vi-oscar_mini",
"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 "Tamnemtf/llama-2-7b-vi-oscar_mini" \
--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": "Tamnemtf/llama-2-7b-vi-oscar_mini",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Tamnemtf/llama-2-7b-vi-oscar_mini with Docker Model Runner:
docker model run hf.co/Tamnemtf/llama-2-7b-vi-oscar_mini
# Run text generation pipeline with our next model
prompt = "Canh chua cá lau là món gì ?"
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=200)
result = pipe(f"<s>[INST] {prompt} [/INST]")
print(result[0]['generated_text'])
Base model
ngoan/Llama-2-7b-vietnamese-20k