Views
No views yet
| Step | Training Loss |
|---|---|
| 10 | 2.428700 |
| 20 | 1.060700 |
| 30 | 1.004200 |
| 40 | 1.868500 |
| 50 | 1.000100 |
| 60 | 0.985000 |
| 70 | 1.660100 |
| 80 | 0.981700 |
| 90 | 0.982000 |
| 100 | 1.580500 |
| 110 | 0.971200 |
| 120 | 0.966200 |
| 130 | 1.658700 |
| 140 | 0.952700 |
| 150 | 0.941700 |
| 160 | 1.385400 |
| 170 | 0.904400 |
| 180 | 0.884700 |
| 190 | 1.645000 |
| 200 | 0.905000 |
| 210 | 0.853500 |
| 220 | 1.495900 |
| 230 | 0.848800 |
| 240 | 0.848000 |
{base_model_name}) and then apply the LoRA adapters from this repository.1import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer
4# Specify the base model and the LoRA adapter path
5base_model_name = "{base_model_name}"
6adapter_path = "{hf_username}/{hub_model_name}"
7# Load the base model in 4-bit
8model = AutoModelForCausalLM.from_pretrained(
9 base_model_name, load_in_4bit=True,
10 torch_dtype=torch.bfloat16, device_map="auto"
11)
12tokenizer = AutoTokenizer.from_pretrained(base_model_name)
13# Load the LoRA adapter
14model = PeftModel.from_pretrained(model, adapter_path)
15# --- Prepare your prompt ---
16instruction = "..." # Your 60-day price series
17input_text = "..." # Your contextual input
18prompt = (
19 f"<|begin_of_text|><|start_header_id|>user<|end_header_id|>\\n\\n"
20 f"Instruction: {{instruction}}\\n\\nInput: {{input_text}}<|eot_id|>"
21 f"<|start_header_id|>assistant<|end_header_id|>\\n\\n"
22)
23inputs = tokenizer(prompt.format(instruction=instruction, input_text=input_text), return_tensors="pt", truncation=True).to("cuda")
24# Generate the prediction
25with torch.no_grad():
26 outputs = model.generate(
27 input_ids=inputs["input_ids"], max_new_tokens=50,
28 eos_token_id=tokenizer.eos_token_id
29 )
30response = tokenizer.decode(outputs[0], skip_special_tokens=True)
31prediction = response.split("<|end_header_id|>\\n\\n")[-1]
32print(f"Predicted Prices: {{prediction}}")