Downloads · 30 days
0
tahamajs/llama-3.2-3b-instruct-bitcoin-analyst-perfect
llama-3.2-3b-instruct-bitcoin-analyst-perfect is a text generation model from tahamajs. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
Downloads · 30 days
0
Access
Public
Updated Aug 8, 2025
Repo size
4.3 GB
Likes
1
Public
Click a slice to open those files.
.pt2.7 GB · 62%
From the Hugging Face model README
This model, tahamajs/llama-3.2-3b-instruct-bitcoin-analyst_best, is a specialized version of the Llama-3.2-3B-Instruct large language model. It has been fine-tuned for the domain of Bitcoin and cryptocurrency analysis. The fine-tuning process, which used QLoRA on the tahamajs/bitcoin-llm-finetuning-dataset dataset, was designed to train the model to act as a virtual Bitcoin analyst.
This model uses a PEFT (Parameter-Efficient Fine-Tuning) adapter. To use it, you must first load the base model and then attach the fine-tuned adapter. The adapter itself is very small, making the overall model efficient to load and use.
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
# Define the model IDs
base_model_id = "meta-llama/Llama-3.2-3B-Instruct"
peft_model_id = "tahamajs/llama-3.2-3b-instruct-bitcoin-analyst_best"
# Load the tokenizer
tokenizer = AutoTokenizer.from_pretrained(base_model_id)
# Load the base model with 4-bit quantization
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
quantization_config=bnb_config,
device_map="auto"
)
# Load the fine-tuned PEFT adapter on top of the base model
model = PeftModel.from_pretrained(base_model, peft_model_id)
# Example inference
prompt = "What are the key technical differences between Bitcoin and Ethereum?"
messages = [
{"role": "user", "content": prompt}
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
outputs = model.generate(input_ids=input_ids, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This model was fine-tuned using Supervised Fine-Tuning (SFT) with the trl.SFTTrainer. A key aspect of the training was the use of a custom data collator, which ensures that the model's loss is calculated only on the assistant's response, not on the user's prompt or the special tokens used to format the conversation. This technique helps the model learn to generate better responses without overfitting to the input.
The following hyperparameters were used for fine-tuning:
| Hyperparameter | Value |
|---|---|
num_train_epochs | 1 |
per_device_train_batch_size | 1 |
gradient_accumulation_steps | 4 |
learning_rate | 2e-4 |
optim | paged_adamw_32bit |
r (LoRA rank) | 32 |
lora_alpha | 32 |
This model is licensed under the Apache 2.0 license, inherited from its base model.