Instructions to use Morfoz-Aigap/Morfoz-LLM-8b-v1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Morfoz-Aigap/Morfoz-LLM-8b-v1.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Morfoz-Aigap/Morfoz-LLM-8b-v1.0")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Morfoz-Aigap/Morfoz-LLM-8b-v1.0") model = AutoModelForCausalLM.from_pretrained("Morfoz-Aigap/Morfoz-LLM-8b-v1.0", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Morfoz-Aigap/Morfoz-LLM-8b-v1.0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Morfoz-Aigap/Morfoz-LLM-8b-v1.0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Morfoz-Aigap/Morfoz-LLM-8b-v1.0", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Morfoz-Aigap/Morfoz-LLM-8b-v1.0
- SGLang
How to use Morfoz-Aigap/Morfoz-LLM-8b-v1.0 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 "Morfoz-Aigap/Morfoz-LLM-8b-v1.0" \ --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": "Morfoz-Aigap/Morfoz-LLM-8b-v1.0", "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 "Morfoz-Aigap/Morfoz-LLM-8b-v1.0" \ --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": "Morfoz-Aigap/Morfoz-LLM-8b-v1.0", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Morfoz-Aigap/Morfoz-LLM-8b-v1.0 with Docker Model Runner:
docker model run hf.co/Morfoz-Aigap/Morfoz-LLM-8b-v1.0
Morfoz-LLM-8b-v1.0
This model is an extended version of a Llama-3 8B Instruct-based Large Language Model (LLM) for Turkish. It was trained on a cleaned Turkish raw dataset. We utilized Turkish instruction sets created from various open-source for fine-tuning with the LORA method.
Model Details
- Base Model: Meta Llama 3 8B Instruct
- Tokenizer Extension: Specifically extended for Turkish
- Training Dataset: Cleaned Turkish raw data with custom Turkish instruction sets
- Training Method: Fine-tuning with LORA
LORA Fine-Tuning Configuration
lora_alpha: 16lora_dropout: 0.05r: 64target_modules: "all-linear"
Usage Examples
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
tokenizer = AutoTokenizer.from_pretrained("Morfoz-Aigap/Morfoz-LLM-8b-v1.0")
model = AutoModelForCausalLM.from_pretrained("Morfoz-Aigap/Morfoz-LLM-8b-v1.0", torch_dtype=torch.bfloat16, device_map={"": 0},low_cpu_mem_usage=True)
messages = [
{"role": "user", "content": "Kırmızı başlıklı kız adında kısa bir çocuk hikayesi yazabilir misin?"}
]
top_k = 50
top_p = 0.9
temperature = 0.6
def get_formatted_input(messages):
for item in messages:
if item['role'] == "user":
item['content'] = item['content']
break
conversation = '\n\n'.join(["User: " + item["content"] if item["role"] == "user" else "Assistant: " + item["content"] for item in messages]) + "\n\nAssistant:"
formatted_input = "\n\n" + conversation
return formatted_input
formatted_input = get_formatted_input(messages)
print(formatted_input)
tokenized_prompt = tokenizer(tokenizer.bos_token + formatted_input, return_tensors="pt").to(model.device)
terminators = [
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = model.generate(input_ids=tokenized_prompt.input_ids, do_sample = True, attention_mask=tokenized_prompt.attention_mask, max_new_tokens=256, eos_token_id=terminators, top_p=top_p, temperature=temperature)
response = outputs[0][tokenized_prompt.input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
- Downloads last month
- 16