simecek/wikipedie_20230601
Viewer • Updated • 525k • 385 • 1
How to use simecek/cswikimistral_0.1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="simecek/cswikimistral_0.1") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("simecek/cswikimistral_0.1")
model = AutoModelForCausalLM.from_pretrained("simecek/cswikimistral_0.1")How to use simecek/cswikimistral_0.1 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "simecek/cswikimistral_0.1"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "simecek/cswikimistral_0.1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/simecek/cswikimistral_0.1
How to use simecek/cswikimistral_0.1 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "simecek/cswikimistral_0.1" \
--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": "simecek/cswikimistral_0.1",
"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 "simecek/cswikimistral_0.1" \
--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": "simecek/cswikimistral_0.1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use simecek/cswikimistral_0.1 with Docker Model Runner:
docker model run hf.co/simecek/cswikimistral_0.1
This is a Mistral7B model fine-tuned with 4bit-QLoRA on Czech Wikipedia data. The model is primarily designed for further fine-tuning for Czech-specific NLP tasks, including summarization and question answering. This adaptation allows for better performance in tasks that require an understanding of the Czech language and context.
For exact QLoRA parameters, see the Axolotl's YAML file.
Example of usage::
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "simecek/cswikimistral_0.1"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_4bit=True)
def generate_text(prompt, max_new_tokens=50):
inputs = tokenizer(prompt, return_tensors="pt").to(device)
attention_mask = inputs["attention_mask"]
input_ids = inputs["input_ids"]
output = model.generate(
input_ids,
attention_mask=attention_mask,
max_new_tokens=max_new_tokens,
num_return_sequences=1,
pad_token_id=tokenizer.eos_token_id,
)
return tokenizer.decode(output[0], skip_special_tokens=True)
prompt = "Hlavní město České republiky je"
generated_text = generate_text(prompt, max_new_tokens=5)
print(generated_text)