Skip to content

Commit

Permalink
fix transformer version
Browse files Browse the repository at this point in the history
  • Loading branch information
骁灵 committed Sep 18, 2023
1 parent 6a8f2b6 commit 9e48841
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cn_clip/training/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,12 @@ def main():
}
assert args.teacher_model_name in teacher_model_dict, "Error: Valid teacher model name has not been built."

teacher_model = Model.from_pretrained(args.teacher_model_name)
try:
teacher_model = Model.from_pretrained(args.teacher_model_name)
except Exception as e:
print("An error occurred while loading the model:", e)
print("Maybe the transformer version is not compatible, recommend to use transformers >= 4.10.0 and <= 4.30.2")

for k, v in teacher_model.state_dict().items():
v.requires_grad = False

Expand Down

0 comments on commit 9e48841

Please sign in to comment.