Instructions to use Kongfha/PhraAphaiManee-LM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kongfha/PhraAphaiManee-LM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kongfha/PhraAphaiManee-LM")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kongfha/PhraAphaiManee-LM") model = AutoModelForCausalLM.from_pretrained("Kongfha/PhraAphaiManee-LM") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Kongfha/PhraAphaiManee-LM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kongfha/PhraAphaiManee-LM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kongfha/PhraAphaiManee-LM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Kongfha/PhraAphaiManee-LM
- SGLang
How to use Kongfha/PhraAphaiManee-LM 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 "Kongfha/PhraAphaiManee-LM" \ --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": "Kongfha/PhraAphaiManee-LM", "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 "Kongfha/PhraAphaiManee-LM" \ --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": "Kongfha/PhraAphaiManee-LM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Kongfha/PhraAphaiManee-LM with Docker Model Runner:
docker model run hf.co/Kongfha/PhraAphaiManee-LM
PhraAphaiManee-LM (แต่งกลอนสไตล์พระอภัยมณี ด้วย GPT-2)
** I've created an improved model with better performance, and you can now access it through this link -> Kongfha/KlonSuphap-LM **
PhraAphaiManee-LM or GPT-2 for Thai poem (PhraAphaiManee-Style). I use GPT-2 for Thai lyrics, which is based on GPT-2 base Thai as a pre-trained model for PhraAphaiManee (พระอภัยมณี) dataset.
*ตอนนี้ ผมได้ทำโมเดลใหม่ที่สามารถสัมผัสได้ดีกว่าแล้ว สามารถเข้าถึงได้จากลิงก์นี้ -> Kongfha/KlonSuphap-LM*
โมเดลนี้เป็น GPT-2 ถูกเทรนด้วยกลอนพระอภัยมณี สำหรับการแต่งกลอนสไตล์พระอภัยมณี
Example use
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "Kongfha/PhraAphaiManee-LM"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
generate = pipeline("text-generation",
model=model,
tokenizer=tokenizer)
input_sentence = "๏ สัมผัสเส้นขอบฟ้าชลาลัย"
generated_text = generate(input_sentence,
max_length=140,
top_k=25,
temperature=1)
# generation parameters can be varied
print(f"Input: {text}")
print(f"Output:\n {generated_text[0]['generated_text']}")
- Downloads last month
- 11