Views
No views yet
Lakukan analisis sentimen bagi teks di dalam tanda sempang berikut.
———
### Teks: tulis teks, tweet, atau ayat yang anda ingin analisa di ruangan ini.
———
Kenal pasti sama ada teks ini secara keseluruhannya mengandungi sentimen positif atau negatif.
Jawab dengan hanya satu perkataan: "positif" atau "negatif".
Sentimen:Lakukan analisis sentimen bagi teks di dalam tanda sempang berikut.
———
### Teks: alhamdulillah terima kasih sis support saya 🥹
———
Kenal pasti sama ada teks ini secara keseluruhannya mengandungi sentimen positif atau negatif.
Jawab dengan hanya satu perkataan: "positif" atau "negatif".
Sentimen:git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
make./main -m path/to/your/model.gguf -n 256 --repeat_penalty 1.0 --color -i -r "User:" -f prompts/chat-with-bob.txtpath/to/your/model.gguf with the actual path to this downloaded GGUF file.malaysian-sentiment.Ollama) with the following content:
FROM /path/to/your/model.gguf/path/to/your/model.gguf with the actual path to this downloaded GGUF file.ollama create malaysian-sentiment -f malaysian-sentiment.Ollamaollama run malaysian-sentiment1from unsloth import FastLanguageModel
2
3# Model configuration
4max_seq_length = 4096 # Extended from TinyLlama's 2048 using RoPE Scaling
5dtype = None # Auto-detection (Float16 for Tesla T4, V100; Bfloat16 for Ampere+)
6load_in_4bit = True # Use 4-bit quantization to reduce memory usage
7
8# Load the model
9model, tokenizer = FastLanguageModel.from_pretrained(
10 model_name="kaiimran/malaysian-llama2-7b-32k-instructions-lora-sentiment-analysis-v2",
11 max_seq_length=max_seq_length,
12 dtype=dtype,
13 load_in_4bit=load_in_4bit,
14)
15
16# Enable faster inference
17FastLanguageModel.for_inference(model)
18
19# Prepare the prompt template
20alpaca_prompt = """Lakukan analisis sentimen bagi teks di dalam tanda sempang berikut.
21———
22### Teks: {}
23———
24Kenal pasti sama ada teks ini secara keseluruhannya mengandungi sentimen positif atau negatif.
25Jawab dengan hanya satu perkataan: "positif" atau "negatif".
26Sentimen:
27{}"""
28
29# Example tweet for analysis
30tweet = """
31alhamdulillah terima kasih sis support saya ☺️ semoga sis dimurahkan rezeki dipanjangkan usia dan dipermudahkan segala urusan https://t.co/nSfNPGpiW8
32"""
33
34# Tokenize input
35inputs = tokenizer(
36 [alpaca_prompt.format(tweet, "")],
37 return_tensors="pt"
38).to("cuda")
39
40# Generate output
41outputs = model.generate(**inputs, max_new_tokens=10, use_cache=True)
42
43# Print result
44print(tokenizer.batch_decode(outputs)[0])