| | গুগল কোলাবে চালান | | | গিটহাবে উৎস দেখুন |
এই নির্দেশিকাটি আপনাকে দেখাবে কিভাবে হাগিং ফেস ট্রান্সফর্মার এবং টিআরএল ব্যবহার করে একটি ভিশন টাস্কের (পণ্যের বিবরণ তৈরি করা) জন্য একটি কাস্টম ছবি ও টেক্সট ডেটাসেটে জেমা ফাইন-টিউন করতে হয়। আপনি শিখবেন:
- কোয়ান্টাইজড লো-র্যাঙ্ক অ্যাডাপটেশন (QLoRA) কী?
- উন্নয়ন পরিবেশ সেটআপ করুন
- ফাইন-টিউনিং ডেটাসেট তৈরি ও প্রস্তুত করুন
- TRL এবং SFTTrainer ব্যবহার করে Gemma-কে সূক্ষ্মভাবে সমন্বয় করুন।
- মডেল ইনফারেন্স পরীক্ষা করুন এবং ছবি ও লেখা থেকে পণ্যের বিবরণ তৈরি করুন।
কোয়ান্টাইজড লো-র্যাঙ্ক অ্যাডাপটেশন (QLoRA) কী?
এই নির্দেশিকাটি কোয়ান্টাইজড লো-র্যাঙ্ক অ্যাডাপটেশন (QLoRA)- এর ব্যবহার প্রদর্শন করে, যা উচ্চ পারফরম্যান্স বজায় রেখে কম্পিউটেশনাল রিসোর্সের প্রয়োজনীয়তা হ্রাস করার মাধ্যমে এলএলএম (LLM)-কে দক্ষতার সাথে ফাইন-টিউন করার একটি জনপ্রিয় পদ্ধতি হিসেবে আবির্ভূত হয়েছে। QloRA-তে, প্রি-ট্রেইনড মডেলটিকে ৪-বিটে কোয়ান্টাইজ করা হয় এবং এর ওয়েটগুলো ফ্রিজ করা হয়। এরপর ট্রেইনেবল অ্যাডাপ্টার লেয়ার (LoRA) সংযুক্ত করা হয় এবং শুধুমাত্র অ্যাডাপ্টার লেয়ারগুলোকেই ট্রেইন করা হয়। পরবর্তীতে, অ্যাডাপ্টার ওয়েটগুলোকে বেস মডেলের সাথে মার্জ করা যেতে পারে অথবা একটি পৃথক অ্যাডাপ্টার হিসেবে রাখা যেতে পারে।
উন্নয়ন পরিবেশ সেটআপ করুন
প্রথম ধাপ হলো ওপেন মডেলকে ফাইন-টিউন করার জন্য TRL সহ হাগিং ফেস লাইব্রেরি এবং ডেটাসেট ইনস্টল করা।
# Install Pytorch & other libraries
%pip install torch tensorboard torchvision
# Install Transformers
%pip install transformers
# Install Hugging Face libraries
%pip install datasets accelerate evaluate bitsandbytes trl peft protobuf pillow sentencepiece
# COMMENT IN: if you are running on a GPU that supports BF16 data type and flash attn, such as NVIDIA L4 or NVIDIA A100
#%pip install flash-attn
দ্রষ্টব্য: আপনি যদি অ্যাম্পিয়ার আর্কিটেকচার (যেমন এনভিডিয়া এল৪) বা তার চেয়ে নতুন কোনো জিপিইউ ব্যবহার করেন, তাহলে আপনি ফ্ল্যাশ অ্যাটেনশন ব্যবহার করতে পারেন। ফ্ল্যাশ অ্যাটেনশন এমন একটি পদ্ধতি যা গণনার গতি উল্লেখযোগ্যভাবে বাড়িয়ে দেয় এবং সিকোয়েন্সের দৈর্ঘ্যের সাপেক্ষে মেমরি ব্যবহার দ্বিঘাত থেকে রৈখিক হারে কমিয়ে আনে, যার ফলে প্রশিক্ষণের গতি ৩ গুণ পর্যন্ত বৃদ্ধি পায়। ফ্ল্যাশঅ্যাটেনশন সম্পর্কে আরও জানুন।
আপনার মডেল প্রকাশ করার জন্য একটি বৈধ হাগিং ফেস টোকেন প্রয়োজন। আপনি যদি গুগল কোলাবের মধ্যে কাজ করেন, তবে কোলাব সিক্রেটস ব্যবহার করে নিরাপদে আপনার হাগিং ফেস টোকেন ব্যবহার করতে পারেন, অন্যথায় আপনি সরাসরি login পদ্ধতিতে টোকেনটি সেট করতে পারেন। নিশ্চিত করুন যে আপনার টোকেনের রাইট অ্যাক্সেসও আছে, কারণ প্রশিক্ষণের সময় আপনি আপনার মডেলটি হাবে পুশ করবেন।
# Login into Hugging Face Hub
from huggingface_hub import login
login()
ফাইন-টিউনিং ডেটাসেট তৈরি ও প্রস্তুত করুন
এলএলএম (LLM) ফাইন-টিউনিং করার সময়, আপনার ব্যবহারের ক্ষেত্র (use case) এবং আপনি যে কাজটি সমাধান করতে চান, তা জানা জরুরি। এটি আপনার মডেলকে ফাইন-টিউনিং করার জন্য একটি ডেটাসেট তৈরি করতে সাহায্য করে। আপনি যদি এখনও আপনার ব্যবহারের ক্ষেত্রটি নির্ধারণ না করে থাকেন, তবে আপনাকে আবার প্রথম থেকে শুরু করতে হতে পারে।
উদাহরণস্বরূপ, এই নির্দেশিকাটি নিম্নলিখিত ব্যবহারের ক্ষেত্রটির উপর আলোকপাত করে:
- একটি ইকমার্স প্ল্যাটফর্মের জন্য সংক্ষিপ্ত ও এসইও-অপ্টিমাইজড পণ্যের বিবরণ তৈরি করতে একটি জেমা মডেলের সূক্ষ্ম সমন্বয়, যা বিশেষভাবে মোবাইল সার্চের জন্য তৈরি।
এই নির্দেশিকাটি philschmid/amazon-product-descriptions-vlm ডেটাসেটটি ব্যবহার করে, যা অ্যামাজন পণ্যের বিবরণের একটি ডেটাসেট এবং এতে পণ্যের ছবি ও বিভাগ অন্তর্ভুক্ত রয়েছে।
হাগিং ফেস টিআরএল মাল্টিমোডাল কথোপকথন সমর্থন করে। এর গুরুত্বপূর্ণ অংশটি হলো 'ইমেজ' রোল, যা প্রসেসিং ক্লাসকে ছবিটি লোড করার নির্দেশ দেয়। এর গঠনটি নিম্নরূপ হওয়া উচিত:
{"messages": [{"role": "system", "content": [{"type": "text", "text":"You are..."}]}, {"role": "user", "content": [{"type": "text", "text": "..."}, {"type": "image"}]}, {"role": "assistant", "content": [{"type": "text", "text": "..."}]}]}
{"messages": [{"role": "system", "content": [{"type": "text", "text":"You are..."}]}, {"role": "user", "content": [{"type": "text", "text": "..."}, {"type": "image"}]}, {"role": "assistant", "content": [{"type": "text", "text": "..."}]}]}
{"messages": [{"role": "system", "content": [{"type": "text", "text":"You are..."}]}, {"role": "user", "content": [{"type": "text", "text": "..."}, {"type": "image"}]}, {"role": "assistant", "content": [{"type": "text", "text": "..."}]}]}
আপনি এখন হাগিং ফেস ডেটাসেটস লাইব্রেরি ব্যবহার করে ডেটাসেটটি লোড করতে, ছবি, পণ্যের নাম ও ক্যাটাগরি একত্রিত করার জন্য একটি প্রম্পট টেমপ্লেট তৈরি করতে এবং একটি সিস্টেম মেসেজ যোগ করতে পারেন। ডেটাসেটটিতে Pil.Image অবজেক্ট হিসেবে ছবিগুলো অন্তর্ভুক্ত রয়েছে।
from datasets import load_dataset
from PIL import Image
# System message for the assistant
system_message = "You are an expert product description writer for Amazon."
# User prompt that combines the user query and the schema
user_prompt = """Create a Short Product description based on the provided <PRODUCT> and <CATEGORY> and image.
Only return description. The description should be SEO optimized and for a better mobile search experience.
<PRODUCT>
{product}
</PRODUCT>
<CATEGORY>
{category}
</CATEGORY>
"""
# Convert dataset to OAI messages
def format_data(sample):
return {
"messages": [
{
"role": "system",
#"content": [{"type": "text", "text": system_message}],
"content": system_message,
},
{
"role": "user",
"content": [
{
"type": "text",
"text": user_prompt.format(
product=sample["Product Name"],
category=sample["Category"],
),
},
{
"type": "image",
"image": sample["image"],
},
],
},
{
"role": "assistant",
"content": [{"type": "text", "text": sample["description"]}],
},
],
}
def process_vision_info(messages: list[dict]) -> list[Image.Image]:
image_inputs = []
# Iterate through each conversation
for msg in messages:
# Get content (ensure it's a list)
content = msg.get("content", [])
if not isinstance(content, list):
content = [content]
# Check each content element for images
for element in content:
if isinstance(element, dict) and (
"image" in element or element.get("type") == "image"
):
# Get the image and convert to RGB
if "image" in element:
image = element["image"]
else:
image = element
image_inputs.append(image.convert("RGB"))
return image_inputs
# Load dataset from the hub
dataset = load_dataset("philschmid/amazon-product-descriptions-vlm", split="train")
dataset = dataset.train_test_split(test_size=0.1)
# Convert dataset to OAI messages
# need to use list comprehension to keep Pil.Image type, .mape convert image to bytes
dataset_train = [format_data(sample) for sample in dataset["train"]]
dataset_test = [format_data(sample) for sample in dataset["test"]]
print(dataset_train[345]["messages"])
README.md: 0.00B [00:00, ?B/s]
data/train-00000-of-00001.parquet: 0%| | 0.00/47.6M [00:00<?, ?B/s]
Generating train split: 0%| | 0/1345 [00:00<?, ? examples/s]
[{'role': 'system', 'content': 'You are an expert product description writer for Amazon.'}, {'role': 'user', 'content': [{'type': 'text', 'text': "Create a Short Product description based on the provided <PRODUCT> and <CATEGORY> and image.\nOnly return description. The description should be SEO optimized and for a better mobile search experience.\n\n<PRODUCT>\nRazor Agitator BMX/Freestyle Bike, 20-Inch\n</PRODUCT>\n\n<CATEGORY>\nSports & Outdoors | Outdoor Recreation | Cycling | Kids' Bikes & Accessories | Kids' Bikes\n</CATEGORY>\n"}, {'type': 'image', 'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=500x413 at 0x7B7250181790>}]}, {'role': 'assistant', 'content': [{'type': 'text', 'text': 'Conquer the streets with the Razor Agitator BMX Bike! This 20-inch freestyle bike is built for young riders ready to take on any challenge. Durable frame, responsive handling – perfect for tricks and cruising. Get yours today!'}]}]
TRL এবং SFTTrainer ব্যবহার করে Gemma-কে সূক্ষ্মভাবে সমন্বয় করুন।
আপনি এখন আপনার মডেলটি ফাইন-টিউন করার জন্য প্রস্তুত। Hugging Face TRL SFTTrainer ওপেন LLM-গুলোকে সুপারভাইজ ও ফাইন-টিউন করা সহজ করে তোলে। SFTTrainer হলো transformers লাইব্রেরির Trainer এর একটি সাবক্লাস এবং এটি লগিং, ইভ্যালুয়েশন ও চেকপয়েন্টিং সহ একই ধরনের সমস্ত ফিচার সমর্থন করে, তবে এর সাথে আরও কিছু অতিরিক্ত উন্নত ফিচারও যোগ করা হয়েছে, যার মধ্যে রয়েছে:
- ডেটা সেট ফরম্যাটিং, যার মধ্যে কথোপকথনমূলক এবং নির্দেশনামূলক ফরম্যাট অন্তর্ভুক্ত রয়েছে
- শুধুমাত্র সম্পন্ন করার পরেই প্রশিক্ষণ দেওয়া হবে, কোনো নির্দেশ উপেক্ষা করা হবে।
- আরও কার্যকর প্রশিক্ষণের জন্য ডেটাসেট প্যাক করা
- QloRA সহ প্যারামিটার-দক্ষ সূক্ষ্ম-সমন্বয় (PEFT) সমর্থন
- কথোপকথনমূলক সূক্ষ্ম সমন্বয়ের জন্য মডেল এবং টোকেনাইজার প্রস্তুত করা (যেমন বিশেষ টোকেন যোগ করা)
নিম্নলিখিত কোডটি হাগিং ফেস থেকে জেমা মডেল ও টোকেনাইজার লোড করে এবং কোয়ান্টাইজেশন কনফিগারেশন ইনিশিয়ালাইজ করে।
import torch
from transformers import AutoProcessor, AutoModelForImageTextToText, BitsAndBytesConfig
# Hugging Face model id
model_id = "google/gemma-4-E2B" # @param ["google/gemma-4-E2B","google/gemma-4-E4B"] {"allow-input":true}
# Check if GPU benefits from bfloat16
if torch.cuda.get_device_capability()[0] < 8:
raise ValueError("GPU does not support bfloat16, please use a GPU that supports bfloat16.")
# Define model init arguments
model_kwargs = dict(
dtype=torch.bfloat16, # What torch dtype to use, defaults to auto
device_map="auto", # Let torch decide how to load the model
)
# BitsAndBytesConfig int-4 config
model_kwargs["quantization_config"] = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=model_kwargs["dtype"],
bnb_4bit_quant_storage=model_kwargs["dtype"],
)
# Load model and tokenizer
model = AutoModelForImageTextToText.from_pretrained(model_id, **model_kwargs)
processor = AutoProcessor.from_pretrained("google/gemma-4-E2B-it") # Load the Instruction Tokenizer to use the official Gemma template
config.json: 0.00B [00:00, ?B/s] model.safetensors: 0%| | 0.00/10.2G [00:00<?, ?B/s] Loading weights: 0%| | 0/2011 [00:00<?, ?it/s] generation_config.json: 0%| | 0.00/149 [00:00<?, ?B/s] processor_config.json: 0.00B [00:00, ?B/s] chat_template.jinja: 0.00B [00:00, ?B/s] config.json: 0.00B [00:00, ?B/s] tokenizer_config.json: 0.00B [00:00, ?B/s] tokenizer.json: 0%| | 0.00/32.2M [00:00<?, ?B/s]
SFTTrainer এ peft সাথে একটি বিল্ট-ইন ইন্টিগ্রেশন রয়েছে, যা QLoRA ব্যবহার করে LLM-গুলোকে দক্ষতার সাথে টিউন করা সহজ করে তোলে। আপনাকে শুধু একটি LoraConfig তৈরি করে ট্রেইনারকে প্রদান করতে হবে।
from peft import LoraConfig
peft_config = LoraConfig(
lora_alpha=16,
lora_dropout=0.05,
r=16,
bias="none",
target_modules="all-linear",
task_type="CAUSAL_LM",
modules_to_save=["lm_head", "embed_tokens"], # make sure to save the lm_head and embed_tokens as you train the special tokens
ensure_weight_tying=True,
)
আপনার প্রশিক্ষণ শুরু করার আগে, আপনাকে একটি SFTConfig এ আপনার পছন্দের হাইপারপ্যারামিটার এবং ভিশন প্রসেসিং পরিচালনার জন্য একটি কাস্টম collate_fn নির্ধারণ করতে হবে। collate_fn টেক্সট এবং ছবিসহ মেসেজগুলোকে এমন একটি ফরম্যাটে রূপান্তর করে যা মডেলটি বুঝতে পারে।
from trl import SFTConfig
args = SFTConfig(
output_dir="gemma-product-description", # directory to save and repository id
num_train_epochs=3, # number of training epochs
per_device_train_batch_size=1, # batch size per device during training
optim="adamw_torch_fused", # use fused adamw optimizer
logging_steps=5, # log every 5 steps
save_strategy="epoch", # save checkpoint every epoch
eval_strategy="epoch", # evaluate checkpoint every epoch
learning_rate=2e-4, # learning rate, based on QLoRA paper
bf16=True, # use bfloat16 precision
max_grad_norm=0.3, # max gradient norm based on QLoRA paper
lr_scheduler_type="constant", # use constant learning rate scheduler
push_to_hub=True, # push model to hub
report_to="tensorboard", # report metrics to tensorboard
dataset_text_field="", # need a dummy field for collator
dataset_kwargs={"skip_prepare_dataset": True}, # important for collator
remove_unused_columns = False # important for collator
)
# Create a data collator to encode text and image pairs
def collate_fn(examples):
texts = []
images = []
for example in examples:
image_inputs = process_vision_info(example["messages"])
text = processor.apply_chat_template(
example["messages"], add_generation_prompt=False, tokenize=False
)
texts.append(text.strip())
images.append(image_inputs)
# Tokenize the texts and process the images
batch = processor(text=texts, images=images, return_tensors="pt", padding=True)
# The labels are the input_ids, and we mask the padding tokens and image tokens in the loss computation
labels = batch["input_ids"].clone()
# Mask tokens for not being used in the loss computation
labels[labels == processor.tokenizer.pad_token_id] = -100
labels[labels == processor.tokenizer.boi_token_id] = -100
labels[labels == processor.tokenizer.image_token_id] = -100
labels[labels == processor.tokenizer.eoi_token_id] = -100
batch["labels"] = labels
return batch
আপনার মডেলের প্রশিক্ষণ শুরু করার জন্য SFTTrainer তৈরি করতে প্রয়োজনীয় সমস্ত উপাদান এখন আপনার কাছে রয়েছে।
from trl import SFTTrainer
# Create Trainer object
trainer = SFTTrainer(
model=model,
args=args,
train_dataset=dataset_train,
eval_dataset=dataset_test,
peft_config=peft_config,
processing_class=processor,
data_collator=collate_fn,
)
train() মেথডটি কল করে প্রশিক্ষণ শুরু করুন।
# Start training, the model will be automatically saved to the Hub and the output directory
trainer.train()
# Save the final model again to the Hugging Face Hub
trainer.save_model()
The tokenizer has new PAD/BOS/EOS tokens that differ from the model config and generation config. The model config and generation config were aligned accordingly, being updated with the tokenizer's values. Updated tokens: {'eos_token_id': 1, 'bos_token_id': 2, 'pad_token_id': 0}.
আপনার মডেলটি পরীক্ষা করার আগে, মেমরি খালি করে নিন।
# free the memory again
del model
del trainer
torch.cuda.empty_cache()
QLoRA ব্যবহার করার সময়, আপনি শুধুমাত্র অ্যাডাপ্টারগুলোকে ট্রেইন করেন, সম্পূর্ণ মডেলটিকে নয়। এর মানে হলো, ট্রেইনিংয়ের সময় মডেলটি সেভ করলে আপনি শুধুমাত্র অ্যাডাপ্টারের ওয়েটগুলো সেভ করেন, সম্পূর্ণ মডেলটি নয়। আপনি যদি সম্পূর্ণ মডেলটি সেভ করতে চান, যা vLLM বা TGI-এর মতো সার্ভিং স্ট্যাকের সাথে ব্যবহার করা সহজ করে তোলে, তাহলে আপনি merge_and_unload মেথড ব্যবহার করে অ্যাডাপ্টারের ওয়েটগুলোকে মডেলের ওয়েটের সাথে মার্জ করতে পারেন এবং তারপর save_pretrained মেথড দিয়ে মডেলটি সেভ করতে পারেন। এটি একটি ডিফল্ট মডেল সেভ করে, যা ইনফারেন্সের জন্য ব্যবহার করা যেতে পারে।
from peft import PeftModel
# Load Model base model
model = AutoModelForImageTextToText.from_pretrained(model_id, low_cpu_mem_usage=True)
# Merge LoRA and base model and save
peft_model = PeftModel.from_pretrained(model, args.output_dir)
merged_model = peft_model.merge_and_unload()
merged_model.save_pretrained("merged_model", safe_serialization=True, max_shard_size="2GB")
processor = AutoProcessor.from_pretrained(args.output_dir)
processor.save_pretrained("merged_model")
Loading weights: 0%| | 0/2011 [00:00<?, ?it/s] Writing model shards: 0%| | 0/5 [00:00<?, ?it/s] ['merged_model/processor_config.json']
মডেল ইনফারেন্স পরীক্ষা করুন এবং পণ্যের বিবরণ তৈরি করুন
প্রশিক্ষণ সম্পন্ন হওয়ার পর, আপনি আপনার মডেলটি মূল্যায়ন ও পরীক্ষা করতে চাইবেন। আপনি টেস্ট ডেটাসেট থেকে বিভিন্ন স্যাম্পল লোড করে সেই স্যাম্পলগুলোর উপর মডেলটি মূল্যায়ন করতে পারেন।
model_id = "merged_model"
# Load Model with PEFT adapter
model = AutoModelForImageTextToText.from_pretrained(
model_id,
device_map="auto",
dtype="auto",
)
processor = AutoProcessor.from_pretrained(model_id)
Loading weights: 0%| | 0/2012 [00:00<?, ?it/s] The tied weights mapping and config for this model specifies to tie model.language_model.embed_tokens.weight to lm_head.weight, but both are present in the checkpoints with different values, so we will NOT tie them. You should update the config with `tie_word_embeddings=False` to silence this warning.
আপনি একটি পণ্যের নাম, বিভাগ এবং ছবি প্রদান করে অনুমান পরীক্ষা করতে পারেন। sample একটি মার্ভেল অ্যাকশন ফিগার অন্তর্ভুক্ত রয়েছে।
import requests
from PIL import Image
# Test sample with Product Name, Category and Image
sample = {
"product_name": "Hasbro Marvel Avengers-Serie Marvel Assemble Titan-Held, Iron Man, 30,5 cm Actionfigur",
"category": "Toys & Games | Toy Figures & Playsets | Action Figures",
"image": Image.open(requests.get("https://m.media-amazon.com/images/I/81+7Up7IWyL._AC_SY300_SX300_.jpg", stream=True).raw).convert("RGB")
}
def generate_description(sample, model, processor):
# Convert sample into messages and then apply the chat template
messages = [
{"role": "system", "content": system_message},
{"role": "user", "content": [
{"type": "image","image": sample["image"]},
{"type": "text", "text": user_prompt.format(product=sample["product_name"], category=sample["category"])},
]},
]
text = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
print(text)
# Process the image and text
image_inputs = process_vision_info(messages)
# Tokenize the text and process the images
inputs = processor(
text=[text],
images=image_inputs,
padding=True,
return_tensors="pt",
)
# Move the inputs to the device
inputs = inputs.to(model.device)
# Generate the output
stop_token_ids = [processor.tokenizer.eos_token_id, processor.tokenizer.convert_tokens_to_ids("<turn|>")]
generated_ids = model.generate(**inputs, max_new_tokens=256, top_p=1.0, do_sample=True, temperature=0.8, eos_token_id=stop_token_ids, disable_compile=True)
# Trim the generation and decode the output to text
generated_ids_trimmed = [out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
return output_text[0]
# generate the description
description = generate_description(sample, model, processor)
print("MODEL OUTPUT>> \n")
print(description)
<bos><|turn>system You are an expert product description writer for Amazon.<turn|> <|turn>user <|image|> Create a Short Product description based on the provided <PRODUCT> and <CATEGORY> and image. Only return description. The description should be SEO optimized and for a better mobile search experience. <PRODUCT> Hasbro Marvel Avengers-Serie Marvel Assemble Titan-Held, Iron Man, 30,5 cm Actionfigur </PRODUCT> <CATEGORY> Toys & Games | Toy Figures & Playsets | Action Figures </CATEGORY><turn|> <|turn>model MODEL OUTPUT>> Enhance your collection with the Marvel Avengers - Avengers Assemble Ultron-Comforter Set! This soft and cuddly blanket and pillowcase feature everyone's favorite Avengers, Iron Man, and his loyal companion War Machine. Officially licensed by Marvel. Bring home the heroic team!
সারসংক্ষেপ এবং পরবর্তী পদক্ষেপ
এই টিউটোরিয়ালে দেখানো হয়েছে কিভাবে TRL এবং QLoRA ব্যবহার করে ভিশন টাস্কের জন্য, বিশেষত পণ্যের বিবরণ তৈরির জন্য, একটি Gemma মডেলকে ফাইন-টিউন করতে হয়। এরপর নিম্নলিখিত ডক্সগুলো দেখুন:
- জেমা মডেল ব্যবহার করে কীভাবে টেক্সট তৈরি করতে হয় তা শিখুন।
- হাগিং ফেস ট্রান্সফর্মার ব্যবহার করে কীভাবে টেক্সট টাস্কের জন্য জেমাকে সূক্ষ্মভাবে টিউন করতে হয় তা শিখুন।
- হাগিং ফেস ট্রান্সফর্মার ব্যবহার করে কীভাবে সম্পূর্ণ মডেল ফাইন-টিউন করতে হয় তা শিখুন।
- একটি জেমা মডেলে কীভাবে ডিস্ট্রিবিউটেড ফাইন-টিউনিং এবং ইনফারেন্স সম্পাদন করতে হয় তা শিখুন।
- Vertex AI-এর সাথে কীভাবে Gemma ওপেন মডেল ব্যবহার করতে হয় তা শিখুন।
- KerasNLP ব্যবহার করে কীভাবে Gemma-কে ফাইন-টিউন করতে হয় এবং Vertex AI-তে ডেপ্লয় করতে হয় তা শিখুন।
গুগল কোলাবে চালান
গিটহাবে উৎস দেখুন