Text Generation
Transformers
Safetensors
llama
quantized
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use liemo/open-lilm-v2-q4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use liemo/open-lilm-v2-q4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="liemo/open-lilm-v2-q4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("liemo/open-lilm-v2-q4") model = AutoModelForCausalLM.from_pretrained("liemo/open-lilm-v2-q4") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use liemo/open-lilm-v2-q4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "liemo/open-lilm-v2-q4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "liemo/open-lilm-v2-q4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/liemo/open-lilm-v2-q4
- SGLang
How to use liemo/open-lilm-v2-q4 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 "liemo/open-lilm-v2-q4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "liemo/open-lilm-v2-q4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "liemo/open-lilm-v2-q4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "liemo/open-lilm-v2-q4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use liemo/open-lilm-v2-q4 with Docker Model Runner:
docker model run hf.co/liemo/open-lilm-v2-q4
open-lilm-v2-q4
This is simply a quantized version of open-lilm-v2 without other modification. This model is only intended for research or entertainment purposes as the original model.
Warning: Due to the nature of the training data, this model is highly likely to return violent, racist and discriminative content. DO NOT USE IN PRODUCTION ENVIRONMENT.
Model Details
- Name: open-lilm-v2-q4
- Quantization: 4-bit quantization
- Base Model: 0xtaipoian/open-lilm-v2
Usage
This model can be used with Hugging Face's Transformers library:
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "liemo/open-lilm-v2-q4"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
def chat(messages, temperature=0.9, max_new_tokens=200):
input_ids = tokenizer.apply_chat_template(conversation=messages, tokenize=True, add_generation_prompt=True, return_tensors='pt').to('cuda:0')
output_ids = quantized_model.generate(input_ids, max_new_tokens=max_new_tokens, temperature=temperature, do_sample=True)
chatml = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
print(chatml)
response = tokenizer.decode(output_ids[0][input_ids.shape[1]:], skip_special_tokens=False)
return response
messages = [
{"role": "user",
"content": """
INPUT_CONTENT_HERE
"""}
]
result = chat(messages, max_new_tokens=200, temperature=1)
print(result)
- Downloads last month
- 3
Model tree for liemo/open-lilm-v2-q4
Base model
hon9kon9ize/CantoneseLLMChat-v0.5 Finetuned
0xtaipoian/open-lilm-v2