Views
No views yet
Qwen/Qwen3-Embedding-0.6B. The model has been specifically trained to replicate the embedding outputs of the much larger google/t5-v1_1-xxl model.transformers library. Since it includes a custom architecture, you must use the trust_remote_code=True flag when loading.1from transformers import AutoTokenizer, AutoModel
2import torch
3
4# Define the model repository ID
5model_id = "JusteLeo/Qwen3-0.6B-T5-xxl"
6
7# Load the tokenizer and model
8# trust_remote_code=True is required to load the custom projection head
9tokenizer = AutoTokenizer.from_pretrained(model_id)
10model = AutoModel.from_pretrained(model_id, trust_remote_code=True)
11
12# Move model to a device (e.g., GPU)
13device = "cuda"
14model.to(device)
15model.eval()
16
17# Create embeddings
18prompts = [
19 "A photorealistic portrait of a medieval knight in shiny armor.",
20 "A futuristic cityscape at night, with flying cars and neon lights."
21]
22
23# Tokenize the prompts
24inputs = tokenizer(prompts, padding=True, truncation=True, return_tensors="pt").to(device)
25
26# Generate the embeddings
27with torch.no_grad():
28 embeddings = model(**inputs)
29
30print("Embeddings generated successfully!")
31print(f"Output shape: {embeddings.shape}")
32# Expected output shape: (2, 4096)Qwen/Qwen3-Embedding-0.6Bgoogle/t5-v1_1-xxlJusteLeo/t5-xxl-embedding