Instructions to use Willy030125/CiptakerLM-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Willy030125/CiptakerLM-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Willy030125/CiptakerLM-v1")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Willy030125/CiptakerLM-v1") model = AutoModelForCausalLM.from_pretrained("Willy030125/CiptakerLM-v1") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Willy030125/CiptakerLM-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Willy030125/CiptakerLM-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Willy030125/CiptakerLM-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Willy030125/CiptakerLM-v1
- SGLang
How to use Willy030125/CiptakerLM-v1 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 "Willy030125/CiptakerLM-v1" \ --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": "Willy030125/CiptakerLM-v1", "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 "Willy030125/CiptakerLM-v1" \ --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": "Willy030125/CiptakerLM-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Willy030125/CiptakerLM-v1 with Docker Model Runner:
docker model run hf.co/Willy030125/CiptakerLM-v1
CiptakerLM v1
Dataset used for Fine-Tuning: Ciptaker-sft-data-preparation.ipynb
Base model: sarahlintang/mistral-indo-7b
Trained on 1x3090 @ 24 epochs
Train logs, metrics, and params: https://wandb.ai/willy030125/MistralCiptaker_v0.2_SFT/runs/c9so5vf8
Inference example using Colab T4: CiptakerLM-fine-tune-inference.ipynb
Eval results using Colab T4: CiptakerLM-fine-tune-eval.ipynb
Prompt template:
### Human: {Instruction} ### Assistant: {response}
Usage example:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoTokenizer, GenerationConfig
model_id = "Willy030125/CiptakerLM-v1"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id).to(device)
def create_instruction(instruction):
prompt = f"### Human: {instruction} ### Assistant: "
return prompt
def generate(
instruction,
max_new_tokens=2048,
temperature=0.1,
top_p=0.95,
top_k=40,
num_beams=4,
**kwargs
):
prompt = create_instruction(instruction)
inputs = tokenizer(prompt, return_tensors="pt")
input_ids = inputs["input_ids"].to(device)
attention_mask = inputs["attention_mask"].to(device)
generation_config = GenerationConfig(
temperature=temperature,
top_p=top_p,
top_k=top_k,
num_beams=num_beams,
do_sample=True,
**kwargs,
)
with torch.no_grad():
generation_output = model.generate(
input_ids=input_ids,
attention_mask=attention_mask,
generation_config=generation_config,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=max_new_tokens,
early_stopping=True
)
s = generation_output.sequences[0]
output = tokenizer.decode(s, skip_special_tokens=True)
return output.split("### Assistant:")[1].strip()
instruction = "Apa sanksi bagi pengusaha yang melanggar ketentuan dalam Pasal 42 ayat (2) tentang pekerja asing?"
print(generate(instruction))
Output:
Pengusaha dapat dikenai sanksi pidana penjara 1-4 tahun dan/atau denda antara Rp100.000.000 hingga Rp400.000.000.
- Downloads last month
- 4