hf_mirrors/gemma-7b-it
Model Introduction
Files & versions
Analysis

Finetune Mistral, Gemma, Llama 2-5x faster with 70% less memory via Unsloth!

✨ Finetune for Free

All notebooks are beginner friendly! Add your dataset, click "Run All", and you'll get a 2x faster finetuned model which can be exported to GGUF, vLLM or uploaded to Hugging Face.

Unsloth supportsFree NotebooksPerformanceMemory use
Gemma 7b▶️ Start on Colab2.4x faster58% less
Mistral 7b▶️ Start on Colab2.2x faster62% less
Llama-2 7b▶️ Start on Colab2.2x faster43% less
TinyLlama▶️ Start on Colab3.9x faster74% less
CodeLlama 34b A100▶️ Start on Colab1.9x faster27% less
Mistral 7b 1xT4▶️ Start on Kaggle5x faster*62% less
DPO - Zephyr▶️ Start on Colab1.9x faster19% less
  • This conversational notebook is useful for ShareGPT ChatML / Vicuna templates.
  • This text completion notebook is for raw text. This DPO notebook replicates Zephyr.
  • * Kaggle has 2x T4s, but we use 1. Due to overhead, 1x T4 is 5x faster.

Modification

  • Modify example and add npu support;
  • Modify denpendencies;

Code Usage

import torch
from openmind import AutoTokenizer, AutoModelForCausalLM, is_torch_npu_available

if is_torch_npu_available():
  device = "npu:0"
else:
  device = "cpu"
tokenizer = AutoTokenizer.from_pretrained("SY_AICC/gemma-7b-it")
model = AutoModelForCausalLM.from_pretrained(
  "SY_AICC/gemma-7b-it",
  device_map=device,
  torch_dtype=torch.float16
)
input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to(device)

outputs = model.generate(**input_ids)
print(tokenizer.decode(outputs[0]))