Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
evoprompt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grießhaber Daniel
evoprompt
Commits
d82b104a
Commit
d82b104a
authored
5 months ago
by
Max Kimmich
Browse files
Options
Downloads
Patches
Plain Diff
Get rid of warning during generation with HF pipeline
parent
3faa07e9
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Refactor tasks and models and fix format for various models
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
evoprompt/models.py
+7
-6
7 additions, 6 deletions
evoprompt/models.py
with
7 additions
and
6 deletions
evoprompt/models.py
+
7
−
6
View file @
d82b104a
...
@@ -409,7 +409,6 @@ class LlamaChat(ChatModel, Llama):
...
@@ -409,7 +409,6 @@ class LlamaChat(ChatModel, Llama):
**
model_call_kwargs
,
**
model_call_kwargs
,
)
)
response_text
=
response
[
"
choices
"
][
0
][
"
message
"
][
"
content
"
]
response_text
=
response
[
"
choices
"
][
0
][
"
message
"
][
"
content
"
]
# input(response_text)
usage
=
ModelUsage
(
**
response
[
"
usage
"
])
usage
=
ModelUsage
(
**
response
[
"
usage
"
])
return
response_text
,
usage
return
response_text
,
usage
...
@@ -452,13 +451,15 @@ class HfChat(ChatModel, LLMModel):
...
@@ -452,13 +451,15 @@ class HfChat(ChatModel, LLMModel):
**
model_kwargs
,
**
model_kwargs
,
)
)
# Setting the pad token to the eos token to avoid stdout prints
# Setting the pad token to the eos token to avoid stdout prints
#
TODO sometimes
there are multiple eos tokens,
how to handle this?
#
if
there are multiple eos tokens,
we use the first one (similarly to how it is done in the TF library)
if
not
isinstance
(
if
isinstance
(
self
.
pipeline
.
model
.
generation_config
.
eos_token_id
,
(
list
,
tuple
)
self
.
pipeline
.
model
.
generation_config
.
eos_token_id
,
(
list
,
tuple
)
):
):
self
.
pipeline
.
model
.
generation_config
.
pad_token_id
=
(
eos_token_id
=
self
.
pipeline
.
model
.
generation_config
.
eos_token_id
[
0
]
self
.
pipeline
.
model
.
generation_config
.
eos_token_id
else
:
)
eos_token_id
=
self
.
pipeline
.
model
.
generation_config
.
eos_token_id
self
.
pipeline
.
model
.
generation_config
.
pad_token_id
=
eos_token_id
def
_create_completion
(
def
_create_completion
(
self
,
self
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment