Comments (6)
Hi @y22ma, thanks for opening the issue!
Hm, it is strange, but I was not able to reproduce the bug. I'm getting consistent results
import torch
import requests
from PIL import Image
from transformers import AutoImageProcessor, AutoModel
# Initialize the DinoV2Embedding instance
model_name = "facebook/dinov2-large"
device = "cuda" if torch.cuda.is_available() else "cpu"
preprocess = AutoImageProcessor.from_pretrained(model_name)
model = AutoModel.from_pretrained(model_name).to(device).eval()
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)
# Loop to get embeddings multiple times
for i in range(5):
with torch.no_grad():
inputs = preprocess(images=image, return_tensors="pt").to(device)
outputs = model(**inputs)
print(f"Output {i + 1}: {outputs.last_hidden_state[:, :3, :3]}")
![Screenshot 2024-09-06 at 12 48 46](https://private-user-images.githubusercontent.com/31920396/365152855-43b5d6ba-87a0-4b88-afbb-123a018a8cb4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5MzkwMjYsIm5iZiI6MTcyNTkzODcyNiwicGF0aCI6Ii8zMTkyMDM5Ni8zNjUxNTI4NTUtNDNiNWQ2YmEtODdhMC00Yjg4LWFmYmItMTIzYTAxOGE4Y2I0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTEwVDAzMjUyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkwNzZkZWU2Yzg5YWExM2MzYjc2YjAyMmQwOWFmYjBkMGFlZmNlMTg2ZDQzNTVkMzM0NDA2OTBlOWJiYTQwYWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5EOmxsG4Kn55zJmZ6sO_-QIYB5mgkRLT4TrZgOLA1K0)
Env:
- `transformers` version: 4.44.2
- Platform: Linux-6.1.85+-x86_64-with-glibc2.35
- Python version: 3.10.12
- Huggingface_hub version: 0.24.6
- Safetensors version: 0.4.4
- Accelerate version: 0.33.0
- Accelerate config: not found
- PyTorch version (GPU?): 2.4.0+cu121 (False)
How different results did you get between iterations? Can you provide an output from my snippet above?
from transformers.
Thanks for getting back to me. Here's my output with your image as input (000000039769.jpg from coco val 2017):
Output 1: tensor([[[-2.2247, -2.0199, 0.5695],
[ 1.3696, 2.1394, 3.7765],
[ 1.1757, 2.2480, 3.4782]]], device='cuda:0')
Output 2: tensor([[[ 0.0169, -0.0767, -0.4897],
[-0.6269, -0.8694, 0.5277],
[-0.5765, -0.1864, 0.3269]]], device='cuda:0')
Output 3: tensor([[[ 0.0169, -0.0767, -0.4897],
[-0.6269, -0.8694, 0.5277],
[-0.5765, -0.1864, 0.3269]]], device='cuda:0')
Output 4: tensor([[[ 0.1425, 0.6349, -1.0352],
[-1.6960, -0.3588, 0.7011],
[-0.8738, -0.4230, 0.9493]]], device='cuda:0')
Output 5: tensor([[[ 0.8900, -0.6973, 0.1371],
[ 1.3878, -0.8789, -1.0418],
[ 0.8685, -0.7731, -0.8942]]], device='cuda:0')
It's interesting that the first output matches with yours, and it just goes haywire from there? I'm using a NVIDIA GeForce RTX 3080. I did verify that the input has consistent values.
from transformers.
Can you please provide full output of transformers-cli env
?
from transformers.
Here it is:
Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.
transformers
version: 4.44.2- Platform: Linux-5.15.0-117-generic-x86_64-with-glibc2.31
- Python version: 3.11.9
- Huggingface_hub version: 0.24.6
- Safetensors version: 0.4.5
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.2.2+cu121 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: no
- Using GPU in script?: yes
- GPU type: NVIDIA GeForce RTX 3080
from transformers.
Thanks @y22ma, unfortunately I don't have an excess to 3080 RTX, and in my environment the issue is not appear. Do you have access to any other machine to reproduce the bug? Have you tried google colab?
from transformers.
I'm not able to reproduce this on a T4 machine on AWS unfortunately.
from transformers.
Related Issues (20)
- ImportError: attempted relative import with no known parent package HOT 2
- List of Typos in the `transformers[en]` Docs
- bus error on version 4.43.0 with pretrained community CLIP model - MacOS HOT 5
- Can't save quantized models HOT 7
- [Docs] How to build offline HTML or Docset files for other documentation viewers? HOT 1
- Pipelines download the latest revision by default instead of the default/output revision HOT 2
- Request to Add Option to Disable mmap in transformers | Loading models is taking too much time through due to mmap on storage over network case. HOT 1
- Support Unified Multimodal Model HOT 1
- Loss Mask to Prevent Weight Updates for Specific Generated Tokens. HOT 3
- Fast vs. slow tokenizer mismatch for special tokens with lstrip/rstrip set to true
- Any plans on adding Flash Attention 3? HOT 1
- Track progress for VLMs refactoring HOT 1
- Weird text encoder NaNs specifically for FSDP + multi GPU HOT 1
- The _crop_past_key_values function should be a member function of Cache.
- OOM for fine-tuning vlm llava-next-110B with QLoRA on 8 A100 GPUs HOT 10
- how can calculate the predict score of every pixel use mask2former swin-l model? HOT 3
- Zero-shot classification pipeline does not support bfloat16 HOT 3
- Using P-tuning On Whisper‘s decoder HOT 2
- Support AdEMAMix optimizer
- A Trainer subclass for Decoder-Only LM with generation in evaluate() HOT 3
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 transformers.