--- base_model: unsloth/Qwen3-0.6B library_name: peft license: mit datasets: - atahanuz/stock_prediction language: - en pipeline_tag: text-generation tags: - finance - sft - trl - unsloth - transformers --- # Model Card for StockDirection-6K ## Model Details StockDirection is a fine-tuned language model for binary stock movement prediction. The model is trained to predict whether the next day’s stock price of Akbank (AKBNK), traded on Borsa Istanbul (BIST), will move UP or DOWN, based on the daily percentage changes from the last four days and the current day. - Input: A formatted prompt describing the last 5 days of daily percentage price changes. - Output: A simple categorical prediction — "UP" or "DOWN". This model was fine-tuned on a dataset of 6,300 labeled rows of AKBNK stock data. ## Uses ### Direct Use - Educational purposes: Demonstrating how LLMs can be fine-tuned for financial classification tasks. - Research: Exploring text-based sequence learning for stock direction prediction. - Proof of concept: Serving as an example for stock price direction prediction using natural language prompts. ⚠️ Not for financial advice or live trading decisions. ## How to Get Started with the Model Use the code below to get started with the model. ```python from transformers import AutoTokenizer, AutoModelForCausalLM from peft import PeftModel tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen3-0.6B",) base_model = AutoModelForCausalLM.from_pretrained( "unsloth/Qwen3-0.6B", device_map={"": 0} ) model = PeftModel.from_pretrained(base_model,"khazarai/StockDirection-6K") question =""" You are an assistant that predicts whatever a stock will go up or down in the next day based on the daily percentage price changes of the last: 4 days ago: 0.00 3 days ago: -3.09 2 days ago: 2.13 1 day ago: -2.04 today: 0.01 Predict whatever the next day's price will go up or down. Simply write your prediction as UP or DOWN """ messages = [ {"role" : "user", "content" : question} ] text = tokenizer.apply_chat_template( messages, tokenize = False, add_generation_prompt = True, enable_thinking = False, ) from transformers import TextStreamer _ = model.generate( **tokenizer(text, return_tensors = "pt").to("cuda"), max_new_tokens = 200, temperature = 0.7, top_p = 0.8, top_k = 20, streamer = TextStreamer(tokenizer, skip_prompt = True), ) ``` **For pipeline:** ```python from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer from peft import PeftModel tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen3-0.6B") base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3-0.6B") model = PeftModel.from_pretrained(base_model, "khazarai/StockDirection-6K") question =""" You are an assistant that predicts whatever a stock will go up or down in the next day based on the daily percentage price changes of the last: 4 days ago: 0.00 3 days ago: -3.09 2 days ago: 2.13 1 day ago: -2.04 today: 0.01 Predict whatever the next day's price will go up or down. Simply write your prediction as UP or DOWN """ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer) messages = [ {"role": "user", "content": question} ] pipe(messages) ``` ## Training Data - Dataset: [atahanuz/stock_prediction](https://huggingface.co/datasets/atahanuz/stock_prediction) - Size: 6,355 labeled examples. - Structure: Each sample contains past 5 daily percentage changes and the target label (UP/DOWN). Example: ```vbnet Question: You are an assistant that predicts whether a stock will go up or down in the next day based on the daily percentage price changes of the last: 4 days ago: nan 3 days ago: 0.00 2 days ago: 2.22 1 day ago: -2.17 today: -2.22 Predict whether the next day's price will go up or down. Simply write your prediction as UP or DOWN. Answer: DOWN ``` ### Framework versions - PEFT 0.15.2