Instructions to use codefuse-ai/F2LLM-v2-330M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codefuse-ai/F2LLM-v2-330M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="codefuse-ai/F2LLM-v2-330M")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("codefuse-ai/F2LLM-v2-330M") model = AutoModel.from_pretrained("codefuse-ai/F2LLM-v2-330M", device_map="auto") - sentence-transformers
How to use codefuse-ai/F2LLM-v2-330M with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("codefuse-ai/F2LLM-v2-330M") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Inference
- Notebooks
- Google Colab
- Kaggle
Fix word_embedding_dimension in 1_Pooling/config.json
#2
by BramVanroy - opened
1_Pooling/config.json declares word_embedding_dimension: 1024, but this model's actual hidden_size (per config.json) is 896. This mismatch causes sentence-transformers' MSELoss (which sizes its projection layer via model.get_embedding_dimension(), trusting this file) to build a Linear(1024, ...) layer instead of Linear(896, ...), raising a shape mismatch at runtime when real 896-dim embeddings are passed in. It also affects any other pooling-dimension-derived Matryoshka dimension defaults. This PR corrects word_embedding_dimension to 896 to match config.json's hidden_size; all other pooling settings are unchanged.
Geralt-Targaryen changed pull request status to merged