<jupyter_start><jupyter_text>Save Embeddings<jupyter_code>list_hotels = hotel_dataset.hotels
list_embeddings = []

model.eval()
for hotel in tqdm(list_hotels):   
    hotel_embed_id = hotel_dataset.hotel_embedding_mapping[hotel]
    hotel_embed_id = torch.LongTensor([hotel_embed_id]).to(device)    
    embedding = model.embeddings(hotel_embed_id)
    list_embeddings.extend(embedding.detach().cpu().numpy())
import pandas as pd 

embeddings = pd.DataFrame(
    {'hotel_id': list_hotels,
     'embedding': list_embeddings,
    })
embeddings.to_parquet('embeddings.parquet')
from google.colab import files
files.download('embeddings.parquet')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11458333333333333, 'fraction_numerical': 0.0, 'mean_word_length': 6.08421052631579, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '642898', 'license': 'MIT', 'n_tokens_mistral': 240, 'n_tokens_neox': 240, 'n_words': 32, 'path': 'notebooks/sad_pytorch_embeddings.ipynb', 'repo_name': 'EricHe98/sad_final_project', 'size': '672'}