Jaiccc/model_0_streaming_timestamp
0
1---2tags:3- unsloth4- code5license: mit6metrics:7- accuracy8base_model:9- microsoft/phi-410pipeline_tag: text-classification11---12 13# Model Card: Streaming Terminal Log Boundary Predictor (Phi-4 LoRA)14 15## ๐ค Model Details16* **Base Model:** `unsloth/Phi-4-unsloth-bnb-4bit` (14B Parameters)17* **Architecture:** LoRA Adapters (PEFT)18* **Task:** Binary Classification (Terminal Event Boundary Detection)19* **Quantization:** 4-bit (bitsandbytes)20* **Language:** English / Bash / Terminal XML21 22## ๐ฏ Intended Use23This model serves as **"Model 0"** for the Winter 2026 iteration of the **AutoDocs** project. Its primary function is to segment a continuous XML input file into 24distinct, logical events.25The link to the project can be found here:26[AutoDocs (Winter 2026) Repository](https://github.com/CSC392-CSC492-Building-AI-ML-systems/AutoDocs-Winter2026/tree/main)27Specifically, this model is engineered to process continuous, timestamped terminal logs formatted in XML and determine if a specific line represents a **"Boundary."**28Would you like me to add this to the very top of your Dataset Card or under a specific sectio29* **New Event:** The start of a new phase (e.g., a new user prompt appearing, or a transition from downloading to extracting).30* **Old Event:** A continuation of an ongoing process or a user keystroke (e.g., pressing Enter).31 32## ๐๏ธ Training Data33The model was fine-tuned on the **[Jaiccc/model0_boundary_predict_streaming](https://huggingface.co/datasets/Jaiccc/model0_boundary_predict_streaming)** dataset. 34The data utilizes a **sliding-window context of 15 chunks**:35* 14 chunks of historical context.36* 1 Target chunk to classify.37* Heavily imbalanced data was downsampled to a 2:1 (Old:New) ratio to prevent majority-class guessing.38 39## ๐ป How to Use (Inference)40```python41import re42from unsloth import FastLanguageModel43from google.colab import userdata44 45# 1. Retrieve your secure token46hf_token = userdata.get('HF_TOKEN') # Or os.getenv("HF_TOKEN")47 48# 2. Load the Fine-Tuned Model49model, tokenizer = FastLanguageModel.from_pretrained(50 model_name = "Jaiccc/model_0_streaming_timestamp",51 max_seq_length = 4096,52 load_in_4bit = True,53 token = hf_token, 54)55FastLanguageModel.for_inference(model)56 57# 3. Format your prompt (ChatML)58instruction = "Your task is to analyze terminal XML logs and determine whether the timestamp in the TARGET LINE belongs to a 'new event' or an 'old event'."59input_data = "### CONTEXT (Previous Events):\n<system_output timestamp=\"10.01\">demo@server:~$ apt update</system_output>\n\n### TARGET LINE:\n<user_input timestamp=\"12.40\">s</user_input>"60 61prompt = f"<|im_start|>user<|im_sep|>{instruction}\n\n{input_data}<|im_end|><|im_start|>assistant<|im_sep|>"62inputs = tokenizer(prompt, return_tensors="pt").input_ids.to("cuda")63 64# 4. Generate Prediction65outputs = model.generate(input_ids=inputs, max_new_tokens=64, use_cache=True, temperature=0.1)66raw_output = tokenizer.batch_decode(outputs, clean_up_tokenization_spaces=True)[0]67 68# 5. Extract Result69m = re.search(r'<\|im_start\|>assistant<\|im_sep\|>(.*?)<\|im_end\|>', raw_output, re.S)70result = m.group(1).strip() if m else raw_output.split("assistant")[-1].strip()71 72print(result)73# Expected Output: "12.40, old event"