Git Product home page Git Product logo

gpt2-ml-finetune-'s Introduction

一、环境要求
tensorflow-gpu==1.13.1

二、Finetune步骤
1、进入dataset目录下:
python pre_data.py --filepath /data/home/share1/gpt2-ml-Finetune/data-mayun_xiugai --outfile /data/home/share1/gpt2-ml-Finetune/data/22.json
filepath为finetune数据目录
2、生成tfrecord训练数据
python prepare_data.py -input_fn /data/home/share1/gpt2-ml-Finetune/data
3、finetune
CUDA_VISIBLE_DEVICES=0  python train/train_wc.py --input_file=/data/home/share1/gpt2-ml-Finetune/data/train.tfrecord --output_dir=/data/home/share1/gpt2-ml-Finetune/finetune_model --init_checkpoint=/data/home/share1/gpt2-ml/models/mega/ceshi/model.ckpt-100000

机器要求:
我在32g显存的v-100上调优的,bs只能设为1~

gpt2-ml-finetune-'s People

Contributors

fishyhl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gpt2-ml-finetune-'s Issues

生成tfrecord这一步时出错

执行生成tfrecord训练数据这一步的时候
python prepare_data.py -input_fn /data/home/share1/gpt2-ml-Finetune/data
出错了
Traceback (most recent call last):
File "./prepare_data.py", line 17, in
from tokenization import tokenization
ModuleNotFoundError: No module named 'tokenization'
请问如何解决?谢谢

【讨论】gpt2-ml,30G,22w步模型微调报错解决方案

tensorflow2.x一直报错,因为 'contrib'在2.x中已经删除,降级成1.x(1.14、1.15)能运行,
开始训练后会出现一堆warring:

【Start trainning.............................................
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
W0616 06:45:01.207822 140262356580224 deprecation.py:506] From /usr/local/lib/python3.7/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow_core/python/training/training_util.py:236: Variable.initialized_value (from tensorflow.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Use Variable.read_value. Variables in 2.X are initialized automatically both in eager and graph (inside tf.defun) contexts.
W0616 06:45:01.208348 140262356580224 deprecation.py:323] From /usr/local/lib/python3.7/dist-packages/tensorflow_core/python/training/training_util.py:236: Variable.initialized_value (from tensorflow.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Use Variable.read_value. Variables in 2.X are initialized automatically both in eager and graph (inside tf.defun) contexts.
WARNING:tensorflow:From /content/drive/MyDrive/gpt2-ml/train/dataloader.py:63: parallel_interleave (from tensorflow.python.data.experimental.ops.interleave_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.data.Dataset.interleave(map_func, cycle_length, block_length, num_parallel_calls=tf.data.experimental.AUTOTUNE) instead. If sloppy execution is desired, use tf.data.Options.experimental_determinstic.
W0616 06:45:01.223439 140262356580224 deprecation.py:323] From /content/drive/MyDrive/gpt2-ml/train/dataloader.py:63: parallel_interleave (from tensorflow.python.data.experimental.ops.interleave_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.data.Dataset.interleave(map_func, cycle_length, block_length, num_parallel_calls=tf.data.experimental.AUTOTUNE) instead. If sloppy execution is desired, use tf.data.Options.experimental_determinstic.
WARNING:tensorflow:From /content/drive/MyDrive/gpt2-ml/train/dataloader.py:81: map_and_batch (from tensorflow.python.data.experimental.ops.batching) is deprecated and will be removed in a future version.

开始循环训练之后会出现致命错误:

【ERROR:tensorflow:Error recorded from training_loop: module 'tensorflow._api.v1.compat.v1' has no attribute 'contrib'
E0616 06:45:48.644567 140262356580224 error_handling.py:75] Error recorded from training_loop: module 'tensorflow._api.v1.compat.v1' has no attribute 'contrib'
INFO:tensorflow:training_loop marked as finished】

Google了一圈没有找到解决办法,我猜最大的问题出现在 'tensorflow._api.v1.compat.v1' has no attribute 'contrib'上,估计修改API就好?但是找不到这段代码在哪里。
小白一个,还请大佬指点迷津。

gpu最低要求?

我尝试了下使用32G-v100训练, 剩余显存可能没达到32G,可能是28G左右, 卡在这一句2020-07-11 15:00:55.541191: I tensorflow/stream_executor/dso_loader.cc:152] successfully opened CUDA library libcublas.so.10.0 locally就没有输出了, 这是因为显卡剩余显存不够吗?还是说需要更好的显卡?

pre_data.py

您好,这个程序把数据变成什么形式的了?

train/train_wc.py的输出路径是不是改为原模型地址

我看wind91725老师写的是:python train/train_wc.py --input_file=/data/home/share1/gpt2-ml-Finetune/data/train.tfrecord --output_dir=/data/home/share1/gpt2-ml-Finetune/finetune_model --init_checkpoint=/data/home/share1/gpt2-ml/models/mega/ceshi/model.ckpt-100000

实际的--init_checkpoint参数,是不是应该改为gpt2-ml的现有模型目录:models/mega/model.ckpt-220000,感谢!

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.