Instructions to use snoop2head/kogpt-conditional-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use snoop2head/kogpt-conditional-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="snoop2head/kogpt-conditional-2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("snoop2head/kogpt-conditional-2") model = AutoModelForCausalLM.from_pretrained("snoop2head/kogpt-conditional-2") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use snoop2head/kogpt-conditional-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "snoop2head/kogpt-conditional-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "snoop2head/kogpt-conditional-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/snoop2head/kogpt-conditional-2
- SGLang
How to use snoop2head/kogpt-conditional-2 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 "snoop2head/kogpt-conditional-2" \ --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": "snoop2head/kogpt-conditional-2", "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 "snoop2head/kogpt-conditional-2" \ --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": "snoop2head/kogpt-conditional-2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use snoop2head/kogpt-conditional-2 with Docker Model Runner:
docker model run hf.co/snoop2head/kogpt-conditional-2
Commit ยท
5a06eba
1
Parent(s): 85c3838
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# KoGPT-Conditional-2
|
| 2 |
+
|
| 3 |
+
### Condition format
|
| 4 |
+
```python
|
| 5 |
+
# create condition sentence
|
| 6 |
+
random_main_logit = np.random.normal(
|
| 7 |
+
loc=3.368,
|
| 8 |
+
scale=1.015,
|
| 9 |
+
size=1
|
| 10 |
+
)[0].round(1)
|
| 11 |
+
random_sub_logit = np.random.normal(
|
| 12 |
+
loc=1.333,
|
| 13 |
+
scale=0.790,
|
| 14 |
+
size=1
|
| 15 |
+
)[0].round(1)
|
| 16 |
+
condition_sentence = f"{random_main_logit}๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. {random_sub_logit}๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. "
|
| 17 |
+
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
### Input Format
|
| 21 |
+
```python
|
| 22 |
+
# make input sentence
|
| 23 |
+
input_sentence = "์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋"
|
| 24 |
+
condition_plus_input = condition_sentence + input_sentence
|
| 25 |
+
print(condition_plus_input)
|
| 26 |
+
```
|
| 27 |
+
```
|
| 28 |
+
3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
### How to infer
|
| 32 |
+
```
|
| 33 |
+
inferred_sentence = infer_sentence(condition_plus_input, k=10, output_token_length=max_token_length)
|
| 34 |
+
inferred_sentence
|
| 35 |
+
```
|
| 36 |
+
```
|
| 37 |
+
['3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ์์ํ ์ ์ ์ ์ ์ฐจ๋ฆฌ๊ณ ์ผ์ด๋ ์ ์์๋ค',
|
| 38 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ๋ฌ ๋ณด๋ ๊ฑธ ์ข์ํ๊ฒ ๋์๋ค',
|
| 39 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ์์ํ ์ฌ๋๋ค์ ์
์ ๋ค์ฌ๋ค ๋ณผ ์ ์์๋ค',
|
| 40 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ์ด์ํ ๋๋ผ์ ์จ๋ฆฌ์ค๊ฐ ๋์ด ์์๋ค',
|
| 41 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ๊ธฐ์ดํ ๊ฒฝํ์ ํ๋ค',
|
| 42 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ์ด์ํ๊ฒ๋ ํํ๊ฐ ์ฐพ์์จ๋ค๋ ์ฌ์ค์ ๊นจ๋ฌ์๋ค',
|
| 43 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ์ด๋ ์ ๋ซ๋ ๋ฌด์ธ๊ฐ๊ฐ ์๋ค๋ ๊ฑธ ์์๋ค',
|
| 44 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ๋ฌ๋น์ ์๋ฏธ๋ฅผ ์ดํดํ๊ธฐ ์์ํ๋ค',
|
| 45 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ์๋ฐฉ์์ ์ ๋ ๋ด ์์ ๊ผญ ์ก์๋ค',
|
| 46 |
+
'3.9๋งํผ ํ๋ณต๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. 1.2๋งํผ ๋๋๊ฐ์ ์ธ ๋ฌธ์ฅ์ด๋ค. ์์ํ ๋ฐค๋ค์ด ๊ณ์๋๋ ๋ , ์ธ์ ๊ฐ๋ถํฐ ๋๋ ์ด์ํ ๋๋ผ์ ์จ๋ฆฌ์ค์ฒ๋ผ ๋์ ๋ฐ์ง์ด๋ฉฐ ์ฃผ์๋ฅผ ํ๊ตฌํ๊ธฐ ์์ํ๋ค']
|
| 47 |
+
|
| 48 |
+
```
|