Text Generation
Transformers
Safetensors
Vietnamese
gemma3_text
vietnamese
gemma
fine-tuned
unsloth
lora
conversational
text-generation-inference
Instructions to use anhtuan15082023/gemma-3n-vneid-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use anhtuan15082023/gemma-3n-vneid-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="anhtuan15082023/gemma-3n-vneid-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("anhtuan15082023/gemma-3n-vneid-merged") model = AutoModelForCausalLM.from_pretrained("anhtuan15082023/gemma-3n-vneid-merged", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use anhtuan15082023/gemma-3n-vneid-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "anhtuan15082023/gemma-3n-vneid-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anhtuan15082023/gemma-3n-vneid-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/anhtuan15082023/gemma-3n-vneid-merged
- SGLang
How to use anhtuan15082023/gemma-3n-vneid-merged with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "anhtuan15082023/gemma-3n-vneid-merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anhtuan15082023/gemma-3n-vneid-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "anhtuan15082023/gemma-3n-vneid-merged" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "anhtuan15082023/gemma-3n-vneid-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use anhtuan15082023/gemma-3n-vneid-merged with Docker Model Runner:
docker model run hf.co/anhtuan15082023/gemma-3n-vneid-merged
gemma-3n-vneid-merged
๐ป๐ณ Vietnamese Fine-tuned Gemma Model
This is a Vietnamese fine-tuned version of Google's Gemma 2B model using Unsloth and LoRA adapters, optimized for Vietnamese text generation.
๐ Model Details
- Base Model: google/gemma-2-2b
- Language: Vietnamese (vi)
- Fine-tuning Method: LoRA (Low-Rank Adaptation)
- Framework: Unsloth
- Model Type: Causal Language Model
- License: Apache 2.0
๐ Quick Start
Using Transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Load model and tokenizer
model_name = "anhtuan15082023/gemma-3n-vneid-merged"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto",
trust_remote_code=True
)
# Generate Vietnamese text
def generate_vietnamese_text(prompt, max_length=100):
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=max_length,
temperature=0.7,
do_sample=True,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response[len(prompt):].strip()
# Example usage
prompt = "Xin chร o, tรดi lร "
result = generate_vietnamese_text(prompt)
print(f"Input: {prompt}")
print(f"Output: {result}")
Using Inference API
import requests
API_URL = "https://api-inference.huggingface.co/models/anhtuan15082023/gemma-3n-vneid-merged"
headers = {"Authorization": f"Bearer {YOUR_HF_TOKEN}"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
# Generate text
output = query({
"inputs": "Viแปt Nam lร ",
"parameters": {
"max_length": 100,
"temperature": 0.7
}
})
print(output)
๐ฏ Use Cases
- Vietnamese text completion
- Creative writing in Vietnamese
- Chatbot responses in Vietnamese
- Content generation for Vietnamese applications
โ๏ธ Training Details
- Dataset: Vietnamese text corpus
- Training Framework: Unsloth (optimized training)
- Fine-tuning Method: LoRA adapters merged into base model
- Base Model: Google Gemma 2B
๐ท๏ธ Model Tags
- Vietnamese language model
- Text generation
- Fine-tuned Gemma
- LoRA adaptation
๐ License
This model inherits the Apache 2.0 license from the base Gemma model.
๐ค Citation
If you use this model, please consider citing:
@model{vietnamese-gemma-finetuned,
title={Vietnamese Fine-tuned Gemma Model},
author={anhtuan15082023},
year={2024},
url={https://huggingface.co/anhtuan15082023/gemma-3n-vneid-merged}
}
๐ Contact
For questions or issues, please open an issue on the model's repository page.
- Downloads last month
- 14
Model tree for anhtuan15082023/gemma-3n-vneid-merged
Base model
google/gemma-2-2b