Correctly sending to device tensors
Browse files69 unmodified lines7071727374757677786 unmodified lines8586878889909169 unmodified linesmaurice_embeddings = list()for batch in batched_inputs:# Load on devicebatch['input_ids'].to(model.device)batch['attention_mask'].to(model.device)batch['pixel_values'].to(model.device)output = model.generate(**batch, max_new_tokens=500, temperature=0.3)# Unload GPU6 unmodified linesfor text in generated_text:text_output = text.split("ASSISTANT:")[-1]text_embeddings = embedder.encode(text_output).to('cpu')maurice_description.append(text_output)maurice_embeddings.append(text_embeddings)69 unmodified lines7071727374757677786 unmodified lines8586878889909169 unmodified linesmaurice_embeddings = list()for batch in batched_inputs:# Load on devicebatch['input_ids'] = batch['input_ids'].to(model.device)batch['attention_mask'] = batch['attention_mask'].to(model.device)batch['pixel_values'] = batch['pixel_values'].to(model.device)output = model.generate(**batch, max_new_tokens=500, temperature=0.3)# Unload GPU6 unmodified linesfor text in generated_text:text_output = text.split("ASSISTANT:")[-1]text_embeddings = embedder.encode(text_output)maurice_description.append(text_output)maurice_embeddings.append(text_embeddings)
app.py+4-4