Comments (3)
预训练模型是其他仓库开源的,比如(https://github.com/Morizeyao/GPT2-Chinese),模型代码跟FlagAI的实现可能不同,因此FlagAI加载的时候需要进行转换。
当您训练好模型以后,因为这时候模型代码是FlagAI的,权重跟模型是对应的, 因此不需要转换,直接加载即可。
from flagai.
您好,load_weights只能在加载预训练模型时使用,进行一些权重的转换以达到适配的目的。
您训练好模型后,可以直接用torch相关的方法加载即可。
跟您展示的代码基本一致:
def load_weights(model, checkpoint_path):
checkpoint = torch.load(checkpoint_path, map_location=torch.device("cpu"))
if "module" in checkpoint:
# ddp
checkpoint = checkpoint["module"]
model.load_state_dict(checkpoint, strict=False)
from flagai.
您好,load_weights只能在加载预训练模型时使用,进行一些权重的转换以达到适配的目的。
您训练好模型后,可以直接用torch相关的方法加载即可。
跟您展示的代码基本一致:
def load_weights(model, checkpoint_path): checkpoint = torch.load(checkpoint_path, map_location=torch.device("cpu")) if "module" in checkpoint: # ddp checkpoint = checkpoint["module"] model.load_state_dict(checkpoint, strict=False)
预训练模型的训练方法能开源一下吗?
from flagai.
Related Issues (20)
- [Question]: 如何进行模型并行训练 HOT 2
- 怎么加载altclip模型? HOT 5
- [Question]: Lora微调 HOT 3
- [Question]: modehub中的altclip与huggingface上的altclip参数不一致 HOT 4
- [Question]: UnboundLocalError: local variable 'model_id' referenced before assignment
- [Question]: Model hub is not reachable! HOT 4
- [Question]: altclip直接运行example的inference.py报错KeyError: 'text_config' HOT 2
- [Question]: How to train the altclip model
- AquilaChat2 34B推理问题 HOT 1
- [Question]: 使用flagai AutoLoader加载AquilaChat2-7B-16K,输入英文 输出乱码 HOT 2
- 运行对话脚本aquilachat2-34b-16k 报错误 HOT 1
- Collecting PyYAML==5.4.1 (from flagai)报错 HOT 4
- [Question]: No module named 'packaging' This question is after install NVIDIA's apex HOT 1
- torchrun command not found HOT 5
- [Question]: 想问下AquilaDecoderLayer里的传参为什么是float的?这样是用的float类型的attention HOT 2
- Can't run examples/vit_cifar100/train_deepspeed.py HOT 1
- TypeError: AquilaPreTrainedModel._set_gradient_checkpointing() got an unexpected keyword argument 'enable' HOT 2
- How does one obtain training data suitable for fine-tuning Aquila models? HOT 2
- [Question]: 请问AltCLIP有没有提供使用Flickr30k微调及评估的脚本
- Do you have this dataset?[Question]:
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 flagai.