Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于第二阶段训练 #4

Open
TomSuen opened this issue Nov 7, 2023 · 3 comments
Open

关于第二阶段训练 #4

TomSuen opened this issue Nov 7, 2023 · 3 comments

Comments

@TomSuen
Copy link

TomSuen commented Nov 7, 2023

您好,我正在复现第二阶段的训练,我不太明白某些参数的含义,请问输出的png中的sfsu, sfuu, ufsu, ufuu分别是什么含义呢?以及现在第三行的效果不是很好,在训练初期是正常的吗?(以25000步为例)
img_v2_2db8bc63-ed34-45da-ba25-67188a095ceg

@awei669
Copy link
Owner

awei669 commented Nov 8, 2023

你好,感谢对我们工作的关注~

(1)SFSU等表示了不同字体和字符的组合情况(风格和字符都有训练集和测试集),FFG方法通常也在UFSC, UFUC上做测试来验证模型的泛化性等,具体解释可以在论文中找到。

(2)你可以再训练一段时间观察下结果,从图上看生成结果的内容跟参考字符中的某一个很像,这可能是受到全局风格特征表示的影响,另外仔细检查预训练阶段VQ-VAE的测试结果,以保证阶段2中内容特征的正确表示。

@JstYY
Copy link

JstYY commented Nov 18, 2023

你好,请问可以问一下您的第二阶段的数据准备是怎么准备的吗,我的准备过程一直在出问题:
运行train后会报错:Traceback (most recent call last):
File "F:\python_project\VQ-Font-main\VQ-Font-main\train.py", line 221, in
main()
File "F:\python_project\VQ-Font-main\VQ-Font-main\train.py", line 217, in main
train(args, cfg)
File "F:\python_project\VQ-Font-main\VQ-Font-main\train.py", line 140, in train
drop_last=True)
File "F:\python_project\VQ-Font-main\VQ-Font-main\datasets_init_.py", line 24, in get_comb_trn_loader
collate_fn=dset.collate_fn, **kwargs)
File "F:\python\lib\site-packages\torch\utils\data\dataloader.py", line 347, in init
sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type]
File "F:\python\lib\site-packages\torch\utils\data\sampler.py", line 106, in init
if not isinstance(self.num_samples, int) or self.num_samples <= 0:
File "F:\python\lib\site-packages\torch\utils\data\sampler.py", line 114, in num_samples
return len(self.data_source)
File "F:\python_project\VQ-Font-main\VQ-Font-main\datasets\dataset_transformer.py", line 116, in len
return sum([len(v) for v in self.avails.values()])
AttributeError: 'list' object has no attribute 'values'

@TomSuen
Copy link
Author

TomSuen commented Nov 20, 2023

你好,请问可以问一下您的第二阶段的数据准备是怎么准备的吗,我的准备过程一直在出问题: 运行train后会报错:Traceback (most recent call last): File "F:\python_project\VQ-Font-main\VQ-Font-main\train.py", line 221, in main() File "F:\python_project\VQ-Font-main\VQ-Font-main\train.py", line 217, in main train(args, cfg) File "F:\python_project\VQ-Font-main\VQ-Font-main\train.py", line 140, in train drop_last=True) File "F:\python_project\VQ-Font-main\VQ-Font-main\datasets__init__.py", line 24, in get_comb_trn_loader collate_fn=dset.collate_fn, **kwargs) File "F:\python\lib\site-packages\torch\utils\data\dataloader.py", line 347, in init sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type] File "F:\python\lib\site-packages\torch\utils\data\sampler.py", line 106, in init if not isinstance(self.num_samples, int) or self.num_samples <= 0: File "F:\python\lib\site-packages\torch\utils\data\sampler.py", line 114, in num_samples return len(self.data_source) File "F:\python_project\VQ-Font-main\VQ-Font-main\datasets\dataset_transformer.py", line 116, in len return sum([len(v) for v in self.avails.values()]) AttributeError: 'list' object has no attribute 'values'

你好,根据你在 #6 的描述,我觉得可能存在如下问题:

  1. 训练集的content font中,你缺少了train和val文件夹,组织为如下形式:
- content
    --华康POP HandelGotD-Cxibei
       ---156个华康内容图片(字为同一层train与val内的所有文字)
    --train
       ---131张华康内容图片
    --val
       ---25张华康内容图片
- train
    --train font1
       ---156个a类风格的字体图片
    --train font2
       ---156个b类风格字体图片
   --train font3
       ---156个c类字体图片
- val
   --val font1
      ---156个d类风格图片
   --val font2
      ---156个e类风格图片
   --val font3
     ---156个f类风格图片`

2.先检查你自己制作的train_unis.json和val_unis.json,它们应当与上边华康POP HandelGotD-Cxibei同级目录中的train(131个字)和val(25个字)文件夹的汉字对应起来,再检查你运行./build_trainset.sh生成的meta文件夹中的train.json文件(这个流程通常需要数个小时,我是400多种字体,要5个小时),并确认里边的内容不存在空列表,windows系统会出现读不到中文路径的问题,我后来换成linux了

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

No branches or pull requests

3 participants