AhmedBou's picture
Update README.md
6d9c3b6
metadata
license: apache-2.0
language:
  - en
library_name: transformers
tags:
  - 'quantization '
  - LLM
  - Dolly

Requirements:

You can run this model on Google Colab Pro, it requires a substantial amount of VRAM.

!pip install -q -U bitsandbytes
!pip install -q -U git+https://github.com/huggingface/transformers.git 
!pip install -q -U git+https://github.com/huggingface/peft.git
!pip install -q -U git+https://github.com/huggingface/accelerate.git

Import this model using:


import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer

peft_model_id = "AhmedBou/databricks-dolly-v2-3b_on_NCSS"
config = PeftConfig.from_pretrained(peft_model_id)
model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)

# Load the Lora model
model = PeftModel.from_pretrained(model, peft_model_id)

Inference using:


batch = tokenizer("Multiple Regression for Appraisal -->: ", return_tensors='pt')
with torch.cuda.amp.autocast():
    output_tokens = model.generate(**batch, max_new_tokens=50)

print("\n\n", tokenizer.decode(output_tokens[0], skip_special_tokens=True))

Output:


“Multiple Regression for Appraisal” -->: Multiple Regression for Appraisal (MRA) -->: Multiple Regression for Appraisal (MRA) (with Covariates) -->: Multiple Regression for Appraisal (MRA) (with Covariates)