Instructions to use chaoyi-wu/PMC_LLAMA_7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chaoyi-wu/PMC_LLAMA_7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="chaoyi-wu/PMC_LLAMA_7B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("chaoyi-wu/PMC_LLAMA_7B") model = AutoModelForCausalLM.from_pretrained("chaoyi-wu/PMC_LLAMA_7B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use chaoyi-wu/PMC_LLAMA_7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chaoyi-wu/PMC_LLAMA_7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chaoyi-wu/PMC_LLAMA_7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/chaoyi-wu/PMC_LLAMA_7B
- SGLang
How to use chaoyi-wu/PMC_LLAMA_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 "chaoyi-wu/PMC_LLAMA_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": "chaoyi-wu/PMC_LLAMA_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 "chaoyi-wu/PMC_LLAMA_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": "chaoyi-wu/PMC_LLAMA_7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use chaoyi-wu/PMC_LLAMA_7B with Docker Model Runner:
docker model run hf.co/chaoyi-wu/PMC_LLAMA_7B
This repo contains PMC_LLaMA_7B, which is LLaMA-7b finetuned on the PMC papers in S2ORC dataset.
The model was trained with the following hyperparameters:
- Epochs: 5
- Batch size: 128
- Cutoff length: 512
- Learning rate: 2e-5
Each epoch we sample 512 tokens per paper for training.
The model can be loaded as following:
import transformers
import torch
tokenizer = transformers.LlamaTokenizer.from_pretrained('chaoyi-wu/PMC_LLAMA_7B')
model = transformers.LlamaForCausalLM.from_pretrained('chaoyi-wu/PMC_LLAMA_7B')
sentence = 'Hello, doctor'
batch = tokenizer(
sentence,
return_tensors="pt",
add_special_tokens=False
)
with torch.no_grad():
generated = model.generate(inputs = batch["input_ids"], max_length=200, do_sample=True, top_k=50)
print('model predict: ',tokenizer.decode(generated[0]))
- Downloads last month
- 1,570