inputs = tokenizer( f"{instruction}\n### 答案:\n{example['Response']}<|endoftext|>", padding="max_length", truncation=True, max_length=512, return_tensors="pt" ) return{"input_ids": inputs["input_ids"].squeeze(0),"attention_mask": inputs["attention_mask"].squeeze(0)} return...
The output tensor's data type is not torch.long when the input text is empty. t=tokenizer('',return_tensors='pt')print(t['input_ids'].dtype)# torch.float32 Expected behavior t=tokenizer('',return_tensors='pt')print(t['input_ids'].dtype)# torch.int64 I have only tested it on ...
return_tensors="pt", ) vllm_result = MULTIMODAL_REGISTRY.map_input( vllm_result = mm_registry.map_input( model_config, {"image": image}, ) Expand All @@ -48,7 +58,8 @@ def test_clip_image_processor(image_assets, dtype, size_factor): @pytest.mark.parametrize("dtype", ["half"...
class RequestData(BaseModel): text: str @app.post("/embed") async def get_embedding(data: RequestData): inputs = tokenizer(data.text, return_tensors="pt", padding=True, truncation=True) with torch.no_grad(): outputs = model(**inputs) embedding = outputs.last_hidden_state.mean(dim=1...
''' + inputs = self.tokenizer(text, max_length=self.max_length, padding='max_length', truncation=True, + return_tensors="pt") + return { + 'input_ids': inputs['input_ids'].squeeze(0), + 'attention_mask': inputs['attention_mask'].squeeze(0), + 'labels': torch.tensor(label...
inputs = tokenizer( f"{instruction}\n### 答案:\n{example['Response']}<|endoftext|>", padding="max_length", truncation=True, max_length=512, return_tensors="pt" ) return{"input_ids": inputs["input_ids"].squeeze(0),"attention_mask": inputs["attention_mask"].squeeze(0)} ...
append(input_text)target_texts.append(answers[i])# Update the progress barprogress_bar.update(1)# Process the remaining batchifinputs:tokenized_inputs=tokenizer.batch_encode_plus(inputs,padding="longest",truncation=True,return_tensors="pt")tokenized_targets=tokenizer.batch_encode_plus(target_text...
inputs = tokenizer( f"{instruction}\n### 答案:\n{example['Response']}<|endoftext|>", padding="max_length", truncation=True, max_length=512, return_tensors="pt" ) return{"input_ids": inputs["input_ids"].squeeze(0),"attention_mask": inputs["attention_mask"].squeeze(0)} ...
tokenizer starvector.cuda() starvector.eval() image_pil = Image.open('assets/examples/sample-18.png') image = processor(image_pil, return_tensors="pt")['pixel_values'].cuda() if not image.shape[0] == 1: image = image.squeeze(0) batch = {"image": image} raw_svg = starvector....
tokenizer starvector.cuda() starvector.eval() image_pil = Image.open('assets/examples/sample-18.png') image = processor(image_pil, return_tensors="pt")['pixel_values'].cuda() if not image.shape[0] == 1: image = image.squeeze(0) batch = {"image": image} raw_svg = starvector....