ldyang694 / transformers_jittor Goto Github PK
View Code? Open in Web Editor NEWForked from huggingface/transformers and Adapt to jittor
License: Apache License 2.0
Forked from huggingface/transformers and Adapt to jittor
License: Apache License 2.0
I'm a jittor beginner, now I need to use the BLIP in transformers_jittor. I have tried the example code in transformers_jittor/src/transformers/models/blip/modeling_blip.py, line 973~992 :
r"""
Returns:
Examples:
```python
>>> from PIL import Image
>>> import requests
>>> from transformers import AutoProcessor, BlipForConditionalGeneration
>>> processor = AutoProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
>>> model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
>>> image = Image.open(requests.get(url, stream=True).raw)
>>> inputs = processor(images=image, return_tensors="pt")
>>> outputs = model(**inputs)
```"""
But it can't work, some Errors occurs:
Traceback (most recent call last):
File "try.py", line 53, in <module>
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")
File "/home/user/anaconda3/envs/jittor/lib/python3.9/site-packages/transformers/modeling_utils.py", line 2370, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
File "/home/user/anaconda3/envs/jittor/lib/python3.9/site-packages/transformers/models/blip/modeling_blip.py", line 950, in __init__
self.text_decoder = BlipTextLMHeadModel(config.text_config)
File "/home/user/anaconda3/envs/jittor/lib/python3.9/site-packages/transformers/models/blip/modeling_blip_text.py", line 812, in __init__
self.bert = BlipTextModel(config, add_pooling_layer=False)
File "/home/user/anaconda3/envs/jittor/lib/python3.9/site-packages/transformers/models/blip/modeling_blip_text.py", line 578, in __init__
self.embeddings = BlipTextEmbeddings(config)
File "/home/user/anaconda3/envs/jittor/lib/python3.9/site-packages/transformers/models/blip/modeling_blip_text.py", line 60, in __init__
self.register_buffer("position_ids", torch.arange(config.max_position_embeddings).expand((1, -1)))
File "/home/user/anaconda3/envs/jittor/lib/python3.9/site-packages/jittor/misc.py", line 299, in expand
shape[i] = x.shape[i]
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.NanoVector.__map_getitem__)).
Types of your inputs are:
self = NanoVector,
arg0 = int,
The function declarations are:
inline int64 at(int i)
inline NanoVector slice(Slice slice)
Failed reason:[f 0514 20:59:42.756720 96 nano_vector.h:116] Check failed: i>=0 && i<size() Something wrong... Could you please report this issue?
How can I solve this problem? Thx for your patience!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.