Question Answering
PEFT
English
Edit model card

Here is a README.md explaining how to run the Archimedes model locally:

Archimedes Model

This README provides instructions for running the Archimedes conversational AI assistant locally.

Requirements

  • Python 3.6+
  • Transformers
  • Peft
  • PyTorch
  • Access to the LLAMA 2 model files or a cloned public model

Install requirements:

!pip install transformers
!pip install peft
!pip install torch
!pip install datasets
!pip install bitsandbytes

Usage

import transformers
from peft import LoraConfig, get_peft_model  
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig

login() # Need access to the gated model.

# Load LLAMA 2 model
model_name = "meta-llama/Llama-2-13b-chat-hf" 

# Quantization configuration 
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16,
)

# Load model
model = AutoModelForCausalLM.from_pretrained(
    model_name, 
    quantization_config=bnb_config,
    trust_remote_code=True
)

# Load LoRA configuration
lora_config = LoraConfig.from_pretrained('harpyerr/archimedes-300s-7b-chat')
model = get_peft_model(model, lora_config) 

# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
tokenizer.pad_token = tokenizer.eos_token

# Define prompt  
text = "Can you tell me who made Space-X?"
prompt = "You are a helpful assistant. Please provide an informative response. \n\n" + text

# Generate response
device = "cuda:0" 
inputs = tokenizer(prompt, return_tensors="pt").to(device)
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

This loads the LLAMA 2 model, applies 4-bit quantization and LoRA optimizations, constructs a prompt, and generates a response.

See the docs for more details.

Downloads last month
15
Inference Examples
Inference API (serverless) does not yet support peft models for this pipeline type.

Datasets used to train FinchResearch/llama2-archimedes-13b-lora