Text Generation
Transformers
Safetensors
English
llama
Eval Results (legacy)
text-generation-inference
Instructions to use screevoai/abbvie-llama2-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use screevoai/abbvie-llama2-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="screevoai/abbvie-llama2-7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("screevoai/abbvie-llama2-7b") model = AutoModelForCausalLM.from_pretrained("screevoai/abbvie-llama2-7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use screevoai/abbvie-llama2-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "screevoai/abbvie-llama2-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "screevoai/abbvie-llama2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/screevoai/abbvie-llama2-7b
- SGLang
How to use screevoai/abbvie-llama2-7b 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 "screevoai/abbvie-llama2-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "screevoai/abbvie-llama2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "screevoai/abbvie-llama2-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "screevoai/abbvie-llama2-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use screevoai/abbvie-llama2-7b with Docker Model Runner:
docker model run hf.co/screevoai/abbvie-llama2-7b
Model Details
This model is a fine-tuned version of meta-llama/Llama-2-7b-hf on the screevoai/abbvie dataset.
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.4318 | 7 | 1100 | 1.4409 |
Libraries to Install
- pip install transformers datasets safetensors huggingface-hub accelerator
- pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
Authentication needed before running the script
Run the following command in the terminal/jupyter_notebook:
Terminal: huggingface-cli login
Jupyter_notebook:
>>> from huggingface_hub import notebook_login >>> notebook_login()
NOTE: Copy and Paste the token from your Huggingface Account Settings > Access Tokens > Create a new token / Copy the existing one.
Script
>>>from datasets import load_dataset
>>>from transformers import AutoModelForCausalLM, AutoTokenizer
>>> # Load model and Tokenizer
>>> model = AutoModelForCausalLM.from_pretrained("screevoai/abbvie-llama2-7b", device_map = "auto")
>>> tokenizer = AutoTokenizer.from_pretrained("screevoai/abbvie-llama2-7b")
>>> tokenizer.padding_side='right'
>>> tokenizer.pad_token = tokenizer.eos_token
>>> # Load the dataset
>>> ds = load_dataset("screevoai/abbvie", split="test", use_auth_token=True)
>>> sample_prompt = ds["Prompt"][0] # change the row number for testing different prompts
>>> # Generate answer to the prompt using the model
>>> encoded_input = tokenizer(sample_prompt, return_tensors="pt", add_special_tokens=True)
>>> model_inputs = encoded_input.to('auto')
>>> generated_ids = model.generate(**model_inputs, max_new_tokens=500, do_sample=True, pad_token_id=tokenizer.eos_token_id)
>>> decoded_output = tokenizer.batch_decode(generated_ids)
>>> print(decoded_output[0].replace(prompt, ""))
- Downloads last month
- -
Model tree for screevoai/abbvie-llama2-7b
Base model
meta-llama/Llama-2-7b-hfEvaluation results
- Training loss on Abbvie Datasetself-reported