llama-eval's Introduction
Export LLaMA PyTorch to ONNX (~120GB memory): $ optimum-cli export onnx --model decapoda-research/llama-7b-hf --task causal-lm-with-past --for-ort --device cpu <path to onnx dir> Verify the exported LLaMA ONNX (~90GB memory): $ python verify_llama_7b_onnx.py Benchmark the LLaMA PyTorch (~40GB memory): $ python llama_7b_pt.py Benchmark the LLaMA ONNX (~60GB memory): 1. Update model_path to your <path to onnx dir> 2. $ python llama_7b_onnx.py Optimize the LLaMA ONNX with onnxruntime.transformers.optimizer: 1. $ python -m onnxruntime.transformers.optimizer --input <path to onnx dir>/decoder_model.onnx --output <path to optimized onnx dir>/decoder_model.onnx --num_heads 32 --hidden_size 4096 --model_type gpt2 --use_external_data_format 2. $ python -m onnxruntime.transformers.optimizer --input <path to onnx dir>/decoder_with_past_model.onnx --output <path to optimized onnx dir>/decoder_with_past_model.onnx --num_heads 32 --hidden_size 4096 --model_type gpt2 --use_external_data_format 3. Copy <path to onnx dir> to <path to optimized onnx dir> except: - decoder_model.onnx - decoder_model.onnx_data - decoder_model_merged.onnx - decoder_model_merged.onnx_data - decoder_with_past_model.onnx - decoder_with_past_model.onnx_data 4. Make sure <path to optimized onnx dir> has below: - decoder_model.onnx - decoder_model.onnx.data - decoder_with_past_model.onnx - decoder_with_past_model.onnx.data PS. onnxruntime.transformers.optimizer has issue to optimize decoder_model_merged.onnx Evaluation of LLaMA ONNX model: * Per token cost = ORT(for prompt_lengths = 129) - ORT(for prompt_lengths = 1) / (129 - 1) * Prompt cost = ORT(for prompt_lengths = 1) PS. LLaMA PyTorch has the same metric
llama-eval's People
Forkers
t-iykeosujivRecommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.