Git Product home page Git Product logo

Comments (4)

1049451037 avatar 1049451037 commented on July 23, 2024

这里可以定义你想微调的参数名称:

def disable_untrainable_params(self):
enable = []
if self.args.use_ptuning:
enable.extend(['ptuning'])
if self.args.use_lora or self.args.use_qlora:
enable.extend(['matrix_A', 'matrix_B'])
for n, p in self.named_parameters():
flag = False
for e in enable:
if e.lower() in n.lower():
flag = True
break
if not flag:
p.requires_grad_(False)
else:
print(n)

from visualglm-6b.

chaijunmaomao avatar chaijunmaomao commented on July 23, 2024

这里可以定义您想要的参数的参数名称:

def disable_untrainable_params(self):
enable = []
if self.args.use_ptuning:
enable.extend(['ptuning'])
if self.args.use_lora or self.args.use_qlora:
enable.extend(['matrix_A', 'matrix_B'])
for n, p in self.named_parameters():
flag = False
for e in enable:
if e.lower() in n.lower():
flag = True
break
if not flag:
p.requires_grad_(False)
else:
print(n)

非常感谢您的耐心回复,由于我不清楚n的具体值(从代码看至少有ptuning,matrix_A和matrix_B),我试图打印出所有的n,并从中寻找BLIP部分的参数名称,部分输出如下:
image
我应该将enable.extend(['matrix_A', 'matrix_B']) 改为enable.extend(['vit.transformer']) ,这样就可以训练Vit部分的参数了,是这样的吗?
感谢您的解答!

from visualglm-6b.

1049451037 avatar 1049451037 commented on July 23, 2024

是的

from visualglm-6b.

chaijunmaomao avatar chaijunmaomao commented on July 23, 2024

是的

感谢您的解答。
一些信息需要确认,mixins.eva.model.vit.transformer.layers是视觉模型,mixins.eva.model.qformer.transformer.layers是BLIP-2的轻量级查询 Transformer,transformer.layers是ChatGLM的参数,是吗?

from visualglm-6b.

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.