Downloads · 30 days
9
29% of all-time downloads
Tititab/llama-3.1-8b-instruct-thaigov-corpus-thai-stock-index
llama-3.1-8b-instruct-thaigov-corpus-thai-stock-index is a machine learning model from Tititab. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
9
29% of all-time downloads
All-time downloads
31
Public
Parameters
8.3B
7.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors7.8 GB · 100%
How the weights are stored.
U87.2B · 87%
From the Hugging Face model README
import torch
from datasets import load_dataset, Dataset
from peft import LoraConfig, AutoPeftModelForCausalLM
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, TrainingArguments, pipeline
from trl import SFTTrainer
import os
def get_model_and_tokenizer(model_id):
tokenizer = AutoTokenizer.from_pretrained(model_id)
tokenizer.pad_token = tokenizer.eos_token
bnb_config = BitsAndBytesConfig(
load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_compute_dtype="float16", bnb_4bit_use_double_quant=True
)
model = AutoModelForCausalLM.from_pretrained(
model_id, quantization_config=bnb_config, device_map="auto"
)
model.config.use_cache=False
model.config.pretraining_tp=1
return model, tokenizer
model, tokenizer = get_model_and_tokenizer("Tititab/llama-3.1-8b-instruct-thaigov-corpus-thai-stock-index")
messages = [{"role": "user",
"content":
"""
Context:
เงินบาทยังคงมีแรงหนุนต่อเนื่องจากการปรับตัวขึ้นของราคาทองคำในตลาดโลก ขณะที่แรงกดดันต่อสินทรัพย์เสี่ยงชะลอลง หลังตัวเลขตัวเลขจำนวนผู้ขอรับสวัสดิการว่างงานของสหรัฐฯ ออกมาดีกว่าที่ตลาดคาด ซึ่งช่วยคลายความกังวลเกี่ยวกับความเสี่ยงต่อภาวะถดถอยของสหรัฐฯ ลง
อย่างไรก็ดี กรอบการแข็งค่าของเงินบาทในระหว่างวันอาจเป็นไปอย่างจำกัด เนื่องจากเงินดอลลาร์ฯ มีแรงประคองจากการปรับตัวขึ้นของบอนด์ยีลด์สหรัฐฯ ขณะที่ถ้อยแถลงของเจ้าหน้าที่ระดับสูงของเฟดสะท้อนว่า เฟดจะติดตามพัฒนาการของสถานการณ์เงินเฟ้อจากข้อมูลที่จะทยอยออกมา และจะพิจารณาจังหวะเวลาและขนาดของการปรับลดดอกเบี้ยจากข้อมูลดังกล่าว ไม่ใช่จากภาพสะท้อนความปั่นป่วนของตลาดหุ้น
Instruction:
ให้ตอบว่า ตลาดมีแนวโน้มขาขึ้น หรือ ตลาดมีแนวโน้มขาลง เท่านั้น พร้อมอธิบายเหตุผล
"""}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.float16,
device_map="auto",
)
outputs = pipe(prompt, max_new_tokens=128, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])