Code Monkey home page Code Monkey logo

Comments (10)

acadaiaca avatar acadaiaca commented on July 16, 2024 5

Have you figure out this problem? I've faced the same question as you.

I update transformers to 4.27.1, then the problom is solved.
refer to: https://github.com/huggingface/transformers/blob/main/src/transformers/modeling_utils.py#L1150

from chatglm-tuning.

hscspring avatar hscspring commented on July 16, 2024 2

This class should be modified:

class ChatGLMPreTrainedModel(PreTrainedModel):
    """
    An abstract class to handle weights initialization and
    a simple interface for downloading and loading pretrained models.
    """

    is_parallelizable = False
    supports_gradient_checkpointing = True  # change to True
    config_class = ChatGLMConfig
    base_model_prefix = "transformer"
    _no_split_modules = ["GLM6BBlock"]

    def __init__(self, *inputs, **kwargs):
        super().__init__(*inputs, **kwargs)

    def _init_weights(self, module: nn.Module):
        """Initialize the weights."""
        return
    
    # add this
    def _set_gradient_checkpointing(self, module, value=False):
        if isinstance(module, ChatGLMForConditionalGeneration):
            module.gradient_checkpointing = value

another refer:
https://colab.research.google.com/drive/1jCkpikz0J2o20FBQmYmAGdiKmJGOMo-o?usp=sharing#scrollTo=cg3fiQOvmI3Q

from chatglm-tuning.

mymusise avatar mymusise commented on July 16, 2024

It seems that there may be a problem with the API version. Can you copy the version in it?

from chatglm-tuning.

huangtao36 avatar huangtao36 commented on July 16, 2024

I have used version 4.26.1 of transforms, which is consistent with the requirement specified in the requirement.txt file. However, I still encountered an issue. I tried upgrading to version 4.27.1, but the problem persisted.

from chatglm-tuning.

Chenzongchao avatar Chenzongchao commented on July 16, 2024

老哥能给个requirements文件吗,好多包冲突

from chatglm-tuning.

mymusise avatar mymusise commented on July 16, 2024

老哥能给个requirements文件吗,好多包冲突

环境问题我晚点用colab测试下,晚点更新出来

from chatglm-tuning.

mymusise avatar mymusise commented on July 16, 2024

老哥能给个requirements文件吗,好多包冲突

@Chenzongchao 已更新,可以参考
https://github.com/mymusise/ChatGLM-Tuning/blob/master/requirements.txt

from chatglm-tuning.

acadaiaca avatar acadaiaca commented on July 16, 2024

Have you figure out this problem? I've faced the same question as you.

from chatglm-tuning.

mymusise avatar mymusise commented on July 16, 2024

Close it, reopen it if needed~

from chatglm-tuning.

rio5050 avatar rio5050 commented on July 16, 2024

This class should be modified:

class ChatGLMPreTrainedModel(PreTrainedModel):
    """
    An abstract class to handle weights initialization and
    a simple interface for downloading and loading pretrained models.
    """

    is_parallelizable = False
    supports_gradient_checkpointing = True  # change to True
    config_class = ChatGLMConfig
    base_model_prefix = "transformer"
    _no_split_modules = ["GLM6BBlock"]

    def __init__(self, *inputs, **kwargs):
        super().__init__(*inputs, **kwargs)

    def _init_weights(self, module: nn.Module):
        """Initialize the weights."""
        return
    
    # add this
    def _set_gradient_checkpointing(self, module, value=False):
        if isinstance(module, ChatGLMForConditionalGeneration):
            module.gradient_checkpointing = value

another refer: https://colab.research.google.com/drive/1jCkpikz0J2o20FBQmYmAGdiKmJGOMo-o?usp=sharing#scrollTo=cg3fiQOvmI3Q

Could you share the name of this file? I don't know where to modify it. Thank you~

from chatglm-tuning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.