Downloads · 30 days
0
RichardErkhov/Praneeth_-_code-gemma-2b-it-8bits
Praneeth_-_code-gemma-2b-it-8bits is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Jan 22, 2025
Repo size
77.8 MB
Likes
0
Public
Click a slice to open those files.
.safetensors39.3 MB · 50%
From the Hugging Face model README
Quantization made by Richard Erkhov.
code-gemma-2b-it - bnb 8bits
language:
Code-Gemma was finetuned (1k steps) on the CodeAlpaca-20k dataset using the unsloth library to enhance the Gemma-2B-it model.
Below we share some code snippets on how to get quickly started with running the model.
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
if major_version >= 8:
# Use this for new GPUs like Ampere, Hopper GPUs (RTX 30xx, RTX 40xx, A100, H100, L40)
!pip install --no-deps packaging ninja einops flash-attn xformers trl peft accelerate bitsandbytes
else:
# Use this for older GPUs (V100, Tesla T4, RTX 20xx)
!pip install --no-deps xformers trl peft accelerate bitsandbytes
pass
torch.float16
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Praneeth/code-gemma-2b-it")
model = AutoModelForCausalLM.from_pretrained("Praneeth/code-gemma-2b-it", device_map="auto", torch_dtype=torch.float16)
input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=256,)
print(tokenizer.decode(outputs[0]))