首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSONDecodeError:意外的utf-8BOM(使用UTF-8 -sig解码):行1列1(字符0) -调整gpt2.finetune时

JSONDecodeError:意外的utf-8BOM(使用UTF-8 -sig解码):行1列1(字符0) -调整gpt2.finetune时
EN

Stack Overflow用户
提问于 2021-05-19 14:57:51
回答 1查看 253关注 0票数 0

希望你们都做得很好,我正在微调GPT2模型以生成基于内容的标题,同时在它上工作,我已经创建了一个简单的CSV文件,其中只包含标题来训练模型,但是当输入这个模型到GPT2进行微调时,我得到了以下错误,JSONDecodeError Traceback (最近调用的最后一个) in () 10 steps=1000,11 save_every=200,-> 12 sample_every=25) # steps是训练步骤的最大数量13 14 # gpt2.generate(sess)

代码语言:javascript
复制
    3 frames
    /usr/lib/python3.7/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
        336         if s.startswith('\ufeff'):
        337           s = s.encode('utf8')[3:].decode('utf8')
    --> 338             # raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
        339             #                       s, 0)
        340     else:
    
    JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
    
    Below is my code for the above :
    
    import gpt_2_simple as gpt2
    
    model_name = "120M" # "355M" for larger model (it's 1.4 GB)
    gpt2.download_gpt2(model_name=model_name)   # model is saved into current directory under /models/117M/
    sess = gpt2.start_tf_sess()
    
    gpt2.finetune(sess,
                  'titles.csv',
                  model_name=model_name,
                  steps=1000,
                  save_every=200,
                  sample_every=25)   # steps is max number of training steps
    
    I have tried all the basic mechanism of handing UTF -8 BOM but did not find any luck ,Hence requesting your help .It would be a great help from you all .
EN

回答 1

Stack Overflow用户

发布于 2021-05-27 06:50:15

尝试更改模型名称,因为我看到您输入了120M,而gpt2模型名为124M

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67598327

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档