Instructions to use jburtoft/TencentARC-LLaMA-Pro-8B-Neuron with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jburtoft/TencentARC-LLaMA-Pro-8B-Neuron with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jburtoft/TencentARC-LLaMA-Pro-8B-Neuron")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jburtoft/TencentARC-LLaMA-Pro-8B-Neuron") model = AutoModelForCausalLM.from_pretrained("jburtoft/TencentARC-LLaMA-Pro-8B-Neuron") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use jburtoft/TencentARC-LLaMA-Pro-8B-Neuron with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jburtoft/TencentARC-LLaMA-Pro-8B-Neuron" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jburtoft/TencentARC-LLaMA-Pro-8B-Neuron", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/jburtoft/TencentARC-LLaMA-Pro-8B-Neuron
- SGLang
How to use jburtoft/TencentARC-LLaMA-Pro-8B-Neuron 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 "jburtoft/TencentARC-LLaMA-Pro-8B-Neuron" \ --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": "jburtoft/TencentARC-LLaMA-Pro-8B-Neuron", "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 "jburtoft/TencentARC-LLaMA-Pro-8B-Neuron" \ --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": "jburtoft/TencentARC-LLaMA-Pro-8B-Neuron", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use jburtoft/TencentARC-LLaMA-Pro-8B-Neuron with Docker Model Runner:
docker model run hf.co/jburtoft/TencentARC-LLaMA-Pro-8B-Neuron
Quick notes--what I did to get to this point
from optimum.neuron import NeuronModelForCausalLM
from transformers import AutoTokenizer
model_id = "TencentARC/LLaMA-Pro-8B"
compiler_args = {"num_cores": 2, "auto_cast_type": "fp16"}
input_shapes = {"sequence_length": 2048, "batch_size": 2 }
llm = NeuronModelForCausalLM.from_pretrained(model_id, export=True, **input_shapes, **compiler_args)
save_directory = "Tencent_neuron"
llm.save_pretrained(save_directory)
tokenizer = AutoTokenizer.from_pretrained(model_id)
tokenizer.save_pretrained(save_directory)
quit()
from optimum.neuron import pipeline
# Load pipeline from Hugging Face repository
save_directory = "Tencent_neuron"
pipe = pipeline("text-generation", save_directory)
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
messages = [
{"role": "user", "content": "What is 2+2?"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# Run generation
outputs = pipe(prompt, max_new_tokens=2048, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])
from huggingface_hub import login
from huggingface_hub import HfApi
api = HfApi()
login()
save_directory = "Tencent_neuron"
api.upload_folder(
folder_path=save_directory,
repo_id="jburtoft/TencentARC-LLaMA-Pro-8B-Neuron",
repo_type="model",
multi_commits=True,
multi_commits_verbose=True,
)
- Downloads last month
- 5