Comments (5)
先检查一下你的模型有没有下载下来
在checkpoints/glm-10-ch里看有没有一个18.4G的pytorch_model.bin文件
from flagai.
模型下载完了,这个没问题
from flagai.
还是有问题吗,可以在根目录下python setup.py install安装最新版
然后我测试的代码如下:
import torch
from flagai.model.glm_model import GLMModel
from flagai.data.tokenizer import Tokenizer
from flagai.model.predictor.predictor import Predictor
import bminf
if name == "main":
"""Main training program."""
print('Generate Samples')
# Random seeds for reproducability.
# Model,
model_name = 'GLM-10b-ch'
model = GLMModel.from_pretrain(model_name=model_name,
download_path="./checkpoints")
tokenizer = Tokenizer.from_pretrained(model_name)
with torch.cuda.device(0):
model = bminf.wrapper(model, quantization=False, memory_limit=30 << 39)
predictor = Predictor(model, tokenizer)
text = ["今天天气不错[gMASK]"]
for t in text:
output = predictor.predict_generate_randomsample(
t, top_k=50, repetition_penalty=4.0, top_p=1.0)
print(t, '\n', output)
测完没问题
from flagai.
还是有问题吗,可以在根目录下python setup.py install安装最新版 然后我测试的代码如下: import torch from flagai.model.glm_model import GLMModel from flagai.data.tokenizer import Tokenizer from flagai.model.predictor.predictor import Predictor import bminf
if name == "main": """Main training program.""" print('Generate Samples') # Random seeds for reproducability. # Model, model_name = 'GLM-10b-ch' model = GLMModel.from_pretrain(model_name=model_name, download_path="./checkpoints") tokenizer = Tokenizer.from_pretrained(model_name) with torch.cuda.device(0): model = bminf.wrapper(model, quantization=False, memory_limit=30 << 39) predictor = Predictor(model, tokenizer)
text = ["今天天气不错[gMASK]"] for t in text: output = predictor.predict_generate_randomsample( t, top_k=50, repetition_penalty=4.0, top_p=1.0) print(t, '\n', output)
测完没问题
我因为memory不够加了bminf, 你要是够的话不需要加那步
from flagai.
测试了这样结果是正常的:
from flagai.model.glm_model import GLMModel
from flagai.data.tokenizer import Tokenizer
from flagai.model.predictor.predictor import Predictor
model_name = 'GLM-10b-ch'
model = GLMModel.from_pretrain(model_name=model_name, download_path="./checkpoints")
tokenizer = Tokenizer.from_pretrained(model_name)
predictor = Predictor(model, tokenizer)
text = "今天天气不错[gMASK]"
output = predictor.predict_generate_randomsample(text, out_max_length=10)
print(text, '\n', output)
所以这是AutoLoader相关的bug?
我这pytorch装的是没集成cuda的版本,跟这个有关么?
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.