Comments (4)
Hello, I have the same problem, have you solved it please?
from lora.
@1181000705 Yes, partially. The low NLG scores are because somehow the original script did not load the pretrained backbone models. So make sure you are loading the backbone models weights correctly, together with the lora weights, you will get the published scores.
As for the
Error: test and reference not same length
ERROR ON COMPUTING METEOR. MAKE SURE YOU HAVE JAVA INSTALLED GLOBALLY ON YOUR MACHINE.
No idea yet.
from lora.
The low NLG scores are because somehow the original script did not load the pretrained backbone models.
I see. Would be great if could make a PR to fix that!
ERROR ON COMPUTING METEOR. MAKE SURE YOU HAVE JAVA INSTALLED GLOBALLY ON YOUR MACHINE.
Seems like a dependency issue.
from lora.
The low NLG scores are because somehow the original script did not load the pretrained backbone models.
The error is here:
in the finetuning script examples/NLG/src/gpt2_ft.py line 256
if args.rank == 0:
model_path = os.path.join(args.work_dir, f'model.{train_step}.pt')
print('saving checkpoint', model_path)
torch.save({'model_state_dict': model.state_dict()}, model_path)
distributed_sync(args)
return train_step
The saved checkpoint contains the model.state_dict()
, where the backbone gpt2 parameters are started with a prefix transformer.
However, in examples/NLG/src/model.py, line 448:
self.transformer.load_state_dict(state_dict, strict=False)
This transformer.load_state_dict
method should accept parameters WITHOUT the prefix transformer.
So when loading finetuned model from checkpoint, only LoRA weights are loaded
I suggest to slightly modify the weight loading function like this:
for key in state_dict_tmp:
new_key = None
if key.endswith(".g"):
new_key = key[:-2] + ".weight"
elif key.endswith(".b"):
new_key = key[:-2] + ".bias"
elif key.endswith(".w"):
new_key = key[:-2] + ".weight"
if key.startswith("module.transformer."):
new_key = key[len("module.transformer."):]
if key.startswith("transformer."): # Add 2 lines here to delete the prefix "transformer."
new_key = key[len("transformer."):]
if new_key:
old_keys.append(key)
new_keys.append(new_key)
from lora.
Related Issues (20)
- Using gradient checkpoint with LoRA
- Probably a bug in the lora embeding class in loralib/layers.py HOT 2
- Cannot use lora for a pre-trained model HOT 4
- Some questions about LoRA for pre-trained model
- Question about reproducing RoBERTa base Fine-tune HOT 1
- T(w) problem
- batch=1,why adapter latency so much vs. LoRA in paper??? HOT 3
- AttributeError: 'lora.Conv2d' object has no attribute 'weight' HOT 3
- Support multi-lora fine tune in the same GPU
- Is the output the entire model? HOT 3
- LoRA adapter checkpoints not downloadable HOT 6
- The description and the behavior don't match HOT 2
- Question about seed numbers.
- Question about the test set of the GLUE benchmark HOT 1
- [Minor] Possible typos in weight initialization
- How to compute that GPT-2 M (FTTop2 ) trainable parameters number is 25.19M?
- Can't reproduce the results for GLUE and hyperparameter misalignment HOT 4
- Layers.py not being executed HOT 1
- Can not reproduce the result of Roberta-Base HOT 2
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 lora.