Instructions to use ljsabc/Qwen-1.5-14B-Chat-Fujisaki with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ljsabc/Qwen-1.5-14B-Chat-Fujisaki with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ljsabc/Qwen-1.5-14B-Chat-Fujisaki") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ljsabc/Qwen-1.5-14B-Chat-Fujisaki") model = AutoModelForCausalLM.from_pretrained("ljsabc/Qwen-1.5-14B-Chat-Fujisaki") 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 ljsabc/Qwen-1.5-14B-Chat-Fujisaki with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ljsabc/Qwen-1.5-14B-Chat-Fujisaki" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ljsabc/Qwen-1.5-14B-Chat-Fujisaki", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ljsabc/Qwen-1.5-14B-Chat-Fujisaki
- SGLang
How to use ljsabc/Qwen-1.5-14B-Chat-Fujisaki 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 "ljsabc/Qwen-1.5-14B-Chat-Fujisaki" \ --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": "ljsabc/Qwen-1.5-14B-Chat-Fujisaki", "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 "ljsabc/Qwen-1.5-14B-Chat-Fujisaki" \ --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": "ljsabc/Qwen-1.5-14B-Chat-Fujisaki", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ljsabc/Qwen-1.5-14B-Chat-Fujisaki with Docker Model Runner:
docker model run hf.co/ljsabc/Qwen-1.5-14B-Chat-Fujisaki
Demo on Google Colab: https://colab.research.google.com/drive/1i5plJtq_6HIOuk_x7D-LkYDpcd3SADLf?usp=sharing
Similarly as Qwen-1.5-14B-Chat, you can always call this model from the AutoModel class.
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained(
"ljsabc/Qwen-1.5-14B-Chat-Fujisaki",
torch_dtype="auto",
device_map="auto",
#load_in_4bit=True
)
tokenizer = AutoTokenizer.from_pretrained("ljsabc/Qwen-1.5-14B-Chat-Fujisaki")
prompt = "请撰写一条新的推文。"
messages = [
{"role": "system", "content": "你将扮演推特用户@ljsabc,你需要撰写你的原创推文或回复别人的推文。所有你的回复都应该使用简体中文书写。"},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
generated_ids = model.generate(
model_inputs.input_ids,
max_new_tokens=512,
temperature=0.95,
top_p=0.99
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
- Downloads last month
- 2