Comments (3)
Also when I use the HF model with replaced BitLinear layers, the generations isn't working.
- The
.generate
with Llama2 model, completes generation in ~68 seconds - Whereas, doing same after replacing the BitLinear layers, keeps it running for eternity
model_name = "meta-llama/Llama-2-7b-hf" #"bert-base-uncased"
tokenizer = AutoTokenizer.from_pretrained(model_name, token='xxxx')
model = AutoModelForCausalLM.from_pretrained(model_name, token='xxxx')
text = "Tell me about Boxing day significance."
tokenizer.pad_token = tokenizer.eos_token
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)
start = time.time()
outputs = model.generate(inputs.input_ids, max_new_tokens=100, do_sample=True, top_k=50, top_p=0.95)
print(f"time for generation: {time.time() - start}")
replace_linears_in_hf(model)
start = time.time()
outputs = model.generate(inputs.input_ids, max_new_tokens=100, do_sample=True, top_k=50, top_p=0.95)
print(f"time for generation: {time.time() - start}")
from bitnet.
I had a quick look at this repo. In the current state of the code, it seems the binarized weights are still floats, which would explain your observation. Also it is still doing weights multiplication instead of some add / subtract, therefore not taking advantage of the replacement of the multiplication operator in bitnet1.58.
This being said, performance wise (and potential bugs) apart, the results should be identical to bitnet1.58.
Nice to see such attempts!
from bitnet.
Stale issue message
from bitnet.
Related Issues (20)
- does not have support for mistral, gemma, etc and generate error [BUG] ? HOT 5
- [BUG] residual connection wrong? HOT 1
- ImportError: cannot import name 'BitLinear15bs' from 'bitnet.bitbnet_b158'[BUG] HOT 6
- The output of BitLinear is quite abnormal HOT 6
- Requesting a Text-to-Text translation example HOT 1
- Google Drive Link to model weights is broken HOT 1
- is this actually working? HOT 11
- [BUG] bitlinear fix HOT 5
- [BUG] NoneType in sequential module in bit_ffn HOT 1
- Encountering Size Mismatch Error in Updated Code HOT 3
- 1.58bit algorithm implement recommend HOT 2
- Consider techniques from official training paper HOT 2
- [BUG] Bitnet Example Bug HOT 6
- what is the purpose of detach here? HOT 2
- Expected BitLinear weight to be 1 or -1 HOT 2
- [BUG] BitFeedForward(post_act_ln=False) results in a TypeError HOT 3
- BitNet model performs wrose than Base Transformer
- NanoGPT sample
- Create a javascript version that can run in a web browser?
Recommend 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.
from bitnet.