GLiNER
GLiNER copied to clipboard
max_length and truncation parameters not working
I am getting the following message using gliner==0.2.17 version:
Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.
When testing the example, the tokenizer and model are loaded at the same time and setting max_length keeps returning the same message
model = GLiNER.from_pretrained("./model")
What is the correct way to set max_length and truncation parameters?
Facing the same issue
Same issue as well.
Modify the line no: ~567 in model.py file like below to use truncate and max_length as per your need. The max_len is been specified in the config.yaml file, if not add "max_len: 512/128/256" based on the encoder type.
tokenized_labels = self.data_processor.labels_tokenizer(batch, return_tensors='pt',
truncation=True, padding="max_length", max_length=self.config.max_len).to(self.device)