Views
No views yet
1%%capture
2!pip install unsloth
3
4# Also get the latest nightly Unsloth!
5
6!pip uninstall unsloth -y && pip install --upgrade --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git@nightly git+https://github.com/unslothai/unsloth-zoo.git1from unsloth import FastLanguageModel
2import torch
3max_seq_length = 2048 # Choose any! We auto support RoPE Scaling internally!
4dtype = None # None for auto detection. Float16 for Tesla T4, V100, Bfloat16 for Ampere+
5load_in_4bit = True # Use 4bit quantization to reduce memory usage. Can be False.
6
7model, tokenizer = FastLanguageModel.from_pretrained(
8 model_name = "bbayrm0/lora_model",
9 max_seq_length = max_seq_length,
10 dtype = dtype,
11 load_in_4bit = load_in_4bit
12)1FastLanguageModel.for_inference(model) # Enable native 2x faster inference
2
3messages = [
4 {"role": "user", "content": "2025-09-01 11:25:55 | MoldProtection | CRITICAL | KALIP KORUMA UYARISI - Hatalı ROI'ler: ROI 2, ROI 3, ROI 4 | Tetikleyici: manual"},
5]
6inputs = tokenizer.apply_chat_template(
7 messages,
8 tokenize = True,
9 add_generation_prompt = True, # Must add for generation
10 return_tensors = "pt",
11).to("cuda")
12
13from transformers import TextStreamer
14text_streamer = TextStreamer(tokenizer, skip_prompt = True)
15_ = model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = 250,
16 use_cache = True, temperature = 1, min_p = 0.1)1{
2 "lora_config": {
3 "r": 16,
4 "lora_alpha": 32,
5 "target_modules": ["q_proj", "k_proj", "v_proj", "o_proj"],
6 "lora_dropout": 0.1,
7 "bias": "none"
8 },
9 "training_args": {
10 "num_train_epochs": 3,
11 "per_device_train_batch_size": 4,
12 "gradient_accumulation_steps": 4,
13 "learning_rate": 2e-4,
14 "weight_decay": 0.01,
15 "warmup_steps": 100,
16 "fp16": true
17 }
18}2025-01-15 14:30:22 | MoldProtection | CRITICAL | KALIP KORUMA UYARISI - Hatalı ROI'ler: ROI 1, ROI 2 | Tetikleyici: plc🚨 KALIP KORUMA ALARMI: ROI 1, ROI 2 bölgelerinde kritik seviye hata. Sistem güvenliği için derhal müdahale edin.
🛑 ACİL EYLEM PLANI:
1) Üretimi DERHAL durdurun
2) Kalıp durumunu görsel kontrol edin
3) ROI kalibrasyonu yapın
4) Sistem yeniden başlatın
5) Test çalışması gerçekleştirin