YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

Movie Recommendation System with Sentence Transformers (all-MiniLM-L6-v2)

πŸ“Œ Overview

This repository hosts the quantized version of the all-MiniLM-L6-v2 model fine-tuned for movie reccommendation tasks. The model has been trained on the movielens_ratings dataset from Hugging Face. The model is quantized to Float16 (FP16) to optimize inference speed and efficiency while maintaining high performance.

πŸ— Model Details

  • Model Architecture: all-MiniLM-L6-v2
  • Task: Movie Recommendation System
  • Dataset: Hugging Face's movielens_ratings
  • Quantization: Float16 (FP16) for optimized inference
  • Fine-tuning Framework: Hugging Face Transformers

πŸš€ Usage

Installation

pip install transformers torch

Loading the Model

from sentence_transformers import SentenceTransformer, models
import torch

device = "cuda" if torch.cuda.is_available() else "cpu"

model_name = "AventIQ-AI/all-MiniLM-L6-v2-movie-recommendation-system"
model = SentenceTransformer(model_name).to(device)

Question Answer Example

def generate_movies(genre, top_k=5):
    genre_embedding = model.encode([genre], convert_to_tensor=True)
    movie_embeddings = model.encode(df['title'].tolist(), convert_to_tensor=True)

    scores = torch.nn.functional.cosine_similarity(genre_embedding, movie_embeddings)
    top_results = torch.argsort(scores, descending=True)

    # Get unique movies while preserving order
    recommended_movies = []
    seen = set()
    for idx in top_results.tolist():
        movie = df.iloc[idx]['title']
        if movie not in seen:
            recommended_movies.append(movie)
            seen.add(movie)
        if len(recommended_movies) == top_k:
            break
    return recommended_movies

print("🎬 Recommended Movies for 'Action':", generate_movies("Action"))
print("🎬 Recommended Movies for 'Comedy':", generate_movies("Comedy"))
print("🎬 Recommended Movies for 'Sci-Fi':", generate_movies("Sci-Fi"))

⚑ Quantization Details

Post-training quantization was applied using PyTorch's built-in quantization framework. The model was quantized to Float16 (FP16) to reduce model size and improve inference efficiency while balancing accuracy.

πŸ“‚ Repository Structure

.
β”œβ”€β”€ model/               # Contains the quantized model files
β”œβ”€β”€ tokenizer_config/    # Tokenizer configuration and vocabulary files
β”œβ”€β”€ model.safetensors/   # Quantized Model
β”œβ”€β”€ README.md            # Model documentation

⚠️ Limitations

  • The model may struggle for out of scope tasks.
  • Quantization may lead to slight degradation in accuracy compared to full-precision models.
  • Performance may vary across different writing styles and sentence structures.

🀝 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.

Downloads last month
5
Safetensors
Model size
22.7M params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using AventIQ-AI/all-MiniLM-L6-v2-movie-recommendation-system 1