Skip to content

Conversation

annywsy
Copy link
Contributor

@annywsy annywsy commented Jul 22, 2024

###PR内容###
提供了SFT方法和所需的配置文件,并在exaples文件夹下提供sft调用的示例。

@annywsy annywsy changed the title [TRL] Provide SFT method and example [TRL] Provide SFT method and an example Jul 22, 2024
@@ -0,0 +1,25 @@
# imports
from mindnlp.dataset import load_dataset
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个放到 llm/trl目录里


# import mindspore.numpy as np
# import mindspore as ms
from mindspore import ops
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diffusers的部分先不管,代码里不要体现

#管理和控制分布式训练环境下的训练进程

import mindspore as ms
from mindspore import nn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

统一改为 from mindnlp.core import nn, ops
后续的接口都用mindnlp.core里的

@@ -0,0 +1,721 @@
'''Copyright 2023 The HuggingFace Team. All rights reserved.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件放到 mindnlp/engine/trainer里

import mindspore as ms
from mindspore import nn
from mindspore.dataset import Dataset, transforms
from mindspore.nn.learning_rate_schedule import LearningRateSchedule
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上,都用mindnlp.core的

import mindspore.numpy as np
# import pandas as pd
import mindspore as ms
import mindspore.ops as ops
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@lvyufeng
Copy link
Collaborator

lvyufeng commented Sep 2, 2024

pylint没过

'''Copyright 2024 The HuggingFace Inc. team. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

别叫test, run_kto

# See the License for the specific language governing permissions and
# limitations under the License.

# pylint: disable=C,R
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要全忽略

from copy import deepcopy
from typing import Optional

# import torch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要有torch的代码

LocalEntryNotFoundError,
RepositoryNotFoundError,
)
# from safetensors.torch import load_file as safe_load_file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from mindnlp.core.serialization import safe_load_file

sft_test.py Outdated
@@ -0,0 +1,27 @@
'''
This file is an example for sft method.
'''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除

@lvyufeng lvyufeng force-pushed the master branch 2 times, most recently from 5a74091 to f52a716 Compare October 14, 2024 07:16
@annywsy annywsy closed this Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants