Instructions to use momo/gpt2-kiosk with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use momo/gpt2-kiosk with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="momo/gpt2-kiosk")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("momo/gpt2-kiosk") model = AutoModelForCausalLM.from_pretrained("momo/gpt2-kiosk") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use momo/gpt2-kiosk with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "momo/gpt2-kiosk" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "momo/gpt2-kiosk", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/momo/gpt2-kiosk
- SGLang
How to use momo/gpt2-kiosk 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 "momo/gpt2-kiosk" \ --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": "momo/gpt2-kiosk", "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 "momo/gpt2-kiosk" \ --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": "momo/gpt2-kiosk", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use momo/gpt2-kiosk with Docker Model Runner:
docker model run hf.co/momo/gpt2-kiosk
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
kiosk_bot
KoGPT2๋ฅผ ์ด์ฉํ ๊ฐ๋จํ kiosk chatbot ์ ๋๋ค.
๋ฐ์ดํฐ๋ AiHub์ ํ๊ตญ์ด๋ํ ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ์ต๋๋ค.
๋ฐ์ดํฐ๋ ํ์ต๋ง ์งํํ์๊ณ ๊ณต๊ฐ๋ ํ์ง ์์ต๋๋ค.
Architecture
Hugging face์ ์์ ๋ค์ ๋ณด๋ฉฐ ๊ตฌํํ์์ต๋๋ค.
input ์ User + <BOS> + System + <EOS>๋ก ๊ตฌํํ์๋ค.
output ์ P(system|user)๋ฅผ ์ต๋ํ ์ํค๊ธฐ์ํด ๋ชจ๋ธ์ ํ์ตํ์๋ค.
Install
git clone https://github.com/momozzing/kiosk_bot.git
pip install requirements.txt
How to train?
๊ธฐ์กด ํ์ต๋ ๋ฐ์ดํฐ๋ก ๋ํ๋ฅผ ํ๊ณ ์ถ์ผ์๋ฉด install ํ How to chat ์ผ๋ก ๋์ด๊ฐ์
๋ ๋ฉ๋๋ค.
cd kiosk_bot/data ## ์์ ์ํ์๋ ๋ฐ์ดํฐ๋ฅผ ๋ฃ์ผ์๋ฉด ๋ฉ๋๋ค.
kiosk_bot/GPT-2_fine_tune.py ## ์์ ๋ฐ์ดํฐ loader๋ค์ ํ์ผ์ด๋ฆ์ ๋ณ๊ฒฝํด์ฃผ์๋ฉด ๋ฉ๋๋ค.
deepspeed --num_gpus=1 GPT-2_fine_tune.py ## ๋ณ๊ฒฝํ ์ด๊ฒ์ผ๋ก ์คํํ์๋ฉด ๋ฉ๋๋ค.
๊ทธํ ์์ฑ๋ skt-kogpt2-base-v2.pt ๋ฅผ ์ฌ์ฉํ์๋ฉด ๋ฉ๋๋ค.
How to chat?
python interactive.py ##๊ธฐ์กด ๋ฐ์ดํฐ๋ก ์ฑํ
ํ๊ธฐ
python new_data_interactive.py ##์๋ก์ด ๋ฐ์ดํฐ๋ก ํ์ธํ๋ํ๊ฒ ptํ์ผ ๋ถ๋ฌ์์ ์ฑํ
ํ๊ธฐ.
--๊ธฐ์กด ๋ฐ์ดํฐ ์ฑํ
--
User: ์๋ฉ๋ฆฌ์นด๋
ธ ์ฃผ์ธ์
System: ๋ฐ๋ปํ ๊ฑฐ ๋๋ฆด๊น์?
User: ์์ด์ค๋ก ์ฃผ์ธ์
System: ์ฌ์ด์ฆ๋ ํจ ๊ด์ฐฎ์ผ์ธ์?
User: ๊ทธ๋๋ฐ ์ฌ์ด์ฆ๋ก ์ฃผ์ธ์
System: ์ฃ์กํ๋ฐ ์ ํฌ ๊ฐ๊ฒ์๋ ๋ ๊ทค๋ฌ๋ ๋ผ์ง ์ฌ์ด์ฆ ๋ฐ์ ์์ด์
User: ๊ทธ๋ผ ๋ผ์ง์ฌ์ด์ฆ๋ก ์ฃผ์ธ์
System: ๋ค ๊ณ ๊ฐ๋ ํ
์ดํฌ์์ ํ์๋์?
User: ๋จน๊ณ ๊ฐ๊ฒ์
System: ๋ค ๊ทธ๋ผ ๋จธ๊ทธ์์ผ๋ก ์ค๋นํด๋๋ฆฌ๊ฒ ์ต๋๋ค
User: ๊ฐ์ฌํฉ๋๋ค
System: ์ข์ ํ๋ฃจ ๋ณด๋ด์ธ์
Reference
- Downloads last month
- 8