# Follow the Genomes Download FAQ (minus the 'complete' part): https://www.ncbi.nlm.nih.gov/genome/doc/ftpfaq/#allcomplete
wget -O assembly_summary.txt ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/archaea/assembly_summary.txt ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/assembly_summary.txt
awk -F "\t" '$11=="latest"{print $20}' assembly_summary.txt > ftpdirpaths
awk 'BEGIN{FS=OFS="/";filesuffix="genomic.fna.gz"}{ftpdir=$0;asm=$10;file=asm"_"filesuffix;print ftpdir,file}' ftpdirpaths > ftpfilepaths
xargs -n 1 -P 32 wget -q < ftpfilepaths
# Double-check that all genomes were downloaded, please manually download missing file(s) – if any:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 The HuggingFace Team. All rights reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tx -t1 -U 250 SourceHanSans-VF.otf > master1.pfb | |
tx -t1 -U 900 SourceHanSans-VF.otf > master1.pfb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint. | |
# *Only* converts the UNet, VAE, and Text Encoder. | |
# Does not convert optimizer state or any other thing. | |
import argparse | |
import os.path as osp | |
import re | |
import torch |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"head": { | |
"version": 1.0, | |
"fontRevision": 1.0, | |
"flags": { | |
"baselineAtY_0": true, | |
"alwaysUseIntegerSize": true | |
}, | |
"unitsPerEm": 1000, | |
"macStyle": {}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy as np | |
# 需要Pillow库 | |
from PIL import Image, ImageDraw, ImageFont | |
# 需要fonttools库 | |
from fontTools.ttLib import TTFont | |
# 从字体中返回一个字的图像(以numpy数组形式储存) | |
# 对大多数符合规范的字体,这个函数可以保证输出图像的边框正好是汉字的字身框 | |
#(相当于稿纸上面的格子。一般比bounding box大一点,汉字在设计的时候不是顶着格的) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- encoding: utf8 -*- | |
import cairocffi as cairo | |
import numpy as np | |
# Adding the implicit on-points back to the contour | |
# The input is one single contour, not all of the glyph's contours | |
def regularize_quadratic_contour(contour): | |
result = [] | |
if not contour[0]['on']: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- encoding: utf8 -*- | |
import os, json | |
import numpy as np | |
from PIL import Image, ImageDraw, ImageFont | |
def get_glyph_img(character, fontname, | |
pt = 1024, binarize = True, | |
descent_offset = True): | |
"""Get image of a certain glyph from the given font |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- encoding: utf8 -*- | |
import os | |
import numpy as np | |
from PIL import Image, ImageDraw, ImageFont | |
dirname = os.path.dirname(__file__) | |
shs_cn_filename = os.path.join(dirname, | |
'../../data/fonts/SourceHanSansSC-ExtraLight.otf') |
NewerOlder