databricks/databricks-dolly-15k
Viewer • Updated • 15k • 32.9k • 981
How to use Lajonbot/LaMini-Cerebras-256M-8500-steps-polish with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Lajonbot/LaMini-Cerebras-256M-8500-steps-polish") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Lajonbot/LaMini-Cerebras-256M-8500-steps-polish")
model = AutoModelForCausalLM.from_pretrained("Lajonbot/LaMini-Cerebras-256M-8500-steps-polish")How to use Lajonbot/LaMini-Cerebras-256M-8500-steps-polish with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Lajonbot/LaMini-Cerebras-256M-8500-steps-polish"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Lajonbot/LaMini-Cerebras-256M-8500-steps-polish",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Lajonbot/LaMini-Cerebras-256M-8500-steps-polish
How to use Lajonbot/LaMini-Cerebras-256M-8500-steps-polish with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Lajonbot/LaMini-Cerebras-256M-8500-steps-polish" \
--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": "Lajonbot/LaMini-Cerebras-256M-8500-steps-polish",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Lajonbot/LaMini-Cerebras-256M-8500-steps-polish" \
--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": "Lajonbot/LaMini-Cerebras-256M-8500-steps-polish",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Lajonbot/LaMini-Cerebras-256M-8500-steps-polish with Docker Model Runner:
docker model run hf.co/Lajonbot/LaMini-Cerebras-256M-8500-steps-polish
These repository consist of LaMini-Cerebras-256M finetuned to Polish language on translated alpaca-dolly dataset. Main task is to perform accurate answers to instruction asked.
Below you can find an instruction of how to infer with that model. These repository does not contain an tokenizer object, at the moment (#TODO).
import pandas as pd
import torch
from torch.utils.data import AutTokenizer
from typing import List, Dict, Union
from typing import Any, TypeVar
import pandas as pd
import pickle
MODEL_NAME: str = 'Lajonbot/LaMini-Cerebras-256M-8500-steps-polish'
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForCasualLM.from_pretrained(MODEL_NAME).cuda()
#Resize model for tokenizer size
n_tokens: int = len(tokenizer)
model.resize_token_embeddings(n_tokens)
def _generate_prompt(instruction, input=None):
if input:
return f"""Poniżej znajduje się instrukcja opisująca zadanie, połączona z danymi wejściowymi, które zapewniają dalszy konktekst. Napisz odpowiedź, która odpowiednio odpowie na pytanie.
### Instruction:
{instruction}
### Input:
{input}
### Response:"""
manual_instruction: str = "Napisz mi proszę jakie są rodzaje telefonów komórkowych"
manual_input: str = "Telefony komórkowe, w przeciwieństwie do np. satelitarnych, charakteryzuje to, że działają w obrębie naziemnych fal radiowych w technologii GSM (i w różnych jej wariantach: 3G, 4G czy niebawem 5G). Zasadniczo można jednak wyróżnić wiele ich rodzajów i podzielić je na różne kryteria. I tak, ze względu na rodzaj obudowy, można mówić o telefonach jednobryłowych, rozsuwanych, obrotowych czy też z klapką. Obecnie jednak najbardziej popularne i – ze względu na posiadane parametry – najlepsze telefony komórkowe to smartfony dotykowe."
print(f"Valueation for {manual_instruction} \n\n\n {manual_input}\n\n")
evaluate(instruction = manual_instruction,
input = manual_input)