Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LLaMA-Factory
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
dbis-public
LLaMA-Factory
Commits
c9a47732
Commit
c9a47732
authored
1 year ago
by
hiyouga
Browse files
Options
Downloads
Patches
Plain Diff
fix #3316
parent
6d641af7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/llmtuner/model/utils.py
+6
-1
6 additions, 1 deletion
src/llmtuner/model/utils.py
with
6 additions
and
1 deletion
src/llmtuner/model/utils.py
+
6
−
1
View file @
c9a47732
import
inspect
from
enum
import
Enum
,
unique
from
functools
import
partial
from
typing
import
TYPE_CHECKING
,
Any
,
Dict
,
List
,
Optional
...
...
@@ -129,7 +130,11 @@ def gradient_checkpointing_enable(
return
gradient_checkpointing_func
(
func
,
*
args
,
**
kwargs
)
self
.
_set_gradient_checkpointing
(
enable
=
True
,
gradient_checkpointing_func
=
custom_gradient_checkpointing_func
)
if
"
value
"
in
inspect
.
signature
(
self
.
_set_gradient_checkpointing
).
parameters
:
# old GC format
self
.
apply
(
partial
(
self
.
_set_gradient_checkpointing
,
value
=
True
))
logger
.
warning
(
"
You are using the old GC format, some features (e.g. BAdam) will be invalid.
"
)
else
:
self
.
_set_gradient_checkpointing
(
enable
=
True
,
gradient_checkpointing_func
=
custom_gradient_checkpointing_func
)
def
load_valuehead_params
(
path_or_repo_id
:
str
,
model_args
:
"
ModelArguments
"
)
->
Dict
[
str
,
torch
.
Tensor
]:
...
...
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