Spaces:
Build error
Build error
File size: 332 Bytes
619a263 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
def cls_pool(model):
return model.last_hidden_state[:,0,:]
def sample_embedding(example):
token_output=tokenizer(example,padding=True,truncation=True,return_tensors="tf")
token_output={k:v for k,v in token_output.items()}
model_output=model(**token_output)
return {"embedding":cls_pool(model_output).numpy()[0]}
|