File tree Expand file tree Collapse file tree 2 files changed +31
-6
lines changed
Expand file tree Collapse file tree 2 files changed +31
-6
lines changed Original file line number Diff line number Diff line change 1919
2020from paddlenlp .transformers import AutoTokenizer , BiEncoderModel
2121
22+ from ...testing_utils import require_gpu , slow
23+
2224
2325class BiEncoderModelIntegrationTest (unittest .TestCase ):
26+ @slow
27+ @require_gpu (1 )
2428 def test_model_tiny_logits (self ):
2529 input_texts = [
2630 "This is a test" ,
2731 "This is another test" ,
2832 ]
2933
30- model_name_or_path = "bge-large-en-v1.5"
34+ model_name_or_path = "BAAI/ bge-large-en-v1.5"
3135 tokenizer = AutoTokenizer .from_pretrained (model_name_or_path )
3236 model = BiEncoderModel (model_name_or_path = model_name_or_path , dtype = "float16" , tokenizer = tokenizer )
3337 with paddle .no_grad ():
Original file line number Diff line number Diff line change 1717
1818import paddle
1919
20- from paddlenlp .transformers import NVEncodeModel
20+ from paddlenlp .transformers import NVEncodeModel , PretrainedConfig
21+
22+ from ...testing_utils import require_gpu , slow
2123
2224
2325class NVEncodeModelIntegrationTest (unittest .TestCase ):
26+ @slow
27+ @require_gpu (1 )
2428 def test_model_tiny_logits (self ):
2529 input_texts = [
2630 "This is a test" ,
2731 "This is another test" ,
2832 ]
2933
30- model_name_or_path = "NV-Embed-v1-paddle"
31- model = NVEncodeModel .from_pretrained (
32- model_name_or_path ,
33- tokenizer_path = model_name_or_path ,
34+ config = PretrainedConfig (
35+ attention_dropout = 0.0 ,
36+ bos_token_id = 1 ,
3437 dtype = "float16" ,
38+ eos_token_id = 2 ,
39+ hidden_act = "silu" ,
40+ hidden_size = 4096 ,
41+ initializer_range = 0.02 ,
42+ intermediate_size = 14336 ,
43+ max_position_embeddings = 32768 ,
44+ num_attention_heads = 32 ,
45+ num_hidden_layers = 32 ,
46+ num_key_value_heads = 8 ,
47+ rms_norm_eps = 1e-05 ,
48+ rope_theta = 10000.0 ,
49+ sliding_window = 4096 ,
50+ tie_word_embeddings = False ,
51+ vocab_size = 32000 ,
52+ )
53+ model = NVEncodeModel (
54+ config = config ,
55+ tokenizer_path = "BAAI/bge-large-en-v1.5" ,
3556 query_instruction = "" ,
3657 document_instruction = "" ,
3758 )
You can’t perform that action at this time.
0 commit comments