Instructions to use yodi/karina with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yodi/karina with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yodi/karina")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yodi/karina") model = AutoModelForCausalLM.from_pretrained("yodi/karina") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yodi/karina with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yodi/karina" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yodi/karina", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/yodi/karina
- SGLang
How to use yodi/karina 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 "yodi/karina" \ --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": "yodi/karina", "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 "yodi/karina" \ --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": "yodi/karina", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use yodi/karina with Docker Model Runner:
docker model run hf.co/yodi/karina
yodiaditya commited on
Commit ·
d40f8e8
1
Parent(s): b3c9775
update generating
Browse files
README.md
CHANGED
|
@@ -121,8 +121,6 @@ MODEL_NAME = "yodi/karina"
|
|
| 121 |
model_4bit = AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="cuda:1", load_in_4bit=True)
|
| 122 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
| 123 |
|
| 124 |
-
prompt = f"Given the question:\n{{ siapa kamu? }}\n---\nAnswer:\n"
|
| 125 |
-
|
| 126 |
generator = pipeline('text-generation',
|
| 127 |
model=model_4bit,
|
| 128 |
tokenizer=tokenizer,
|
|
@@ -134,7 +132,7 @@ def preprocess(text):
|
|
| 134 |
def generate(text):
|
| 135 |
preprocess_result = preprocess(text)
|
| 136 |
result = generator(preprocess_result, max_length=256)
|
| 137 |
-
output = re.split(r'\
|
| 138 |
|
| 139 |
return output
|
| 140 |
|
|
|
|
| 121 |
model_4bit = AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="cuda:1", load_in_4bit=True)
|
| 122 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
| 123 |
|
|
|
|
|
|
|
| 124 |
generator = pipeline('text-generation',
|
| 125 |
model=model_4bit,
|
| 126 |
tokenizer=tokenizer,
|
|
|
|
| 132 |
def generate(text):
|
| 133 |
preprocess_result = preprocess(text)
|
| 134 |
result = generator(preprocess_result, max_length=256)
|
| 135 |
+
output = re.split(r'\n---\nAnswer:\n',result[0]['generated_text'])[1]
|
| 136 |
|
| 137 |
return output
|
| 138 |
|