Views
No views yet
1pip install torch==2.5.1
2pip install transformers datasets accelerate bitsandbytes
3pip install unsloth
4pip install peftFastLanguageModel:1from unsloth import FastLanguageModel
2MODEL_NAME = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
3MAX_LENGTH = 128
4
5model, tokenizer = FastLanguageModel.from_pretrained(
6 model_name=MODEL_NAME,
7 max_seq_length=MAX_LENGTH,
8 dtype=torch.bfloat16,
9 load_in_4bit=True,
10 trust_remote_code=True,
11 use_cache=False
12)Trainer with datasets loaded via datasets.Dataset.1text = "Hello, how are you?"
2inputs = tokenizer(text, return_tensors="pt")
3outputs = model.generate(**inputs)
4tamil_translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
5print(tamil_translation)1import torch
2print(f"CUDA Available: {torch.cuda.is_available()}")
3if torch.cuda.is_available():
4 print(f"GPU Device: {torch.cuda.get_device_name(0)}")