Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,50 @@
|
|
1 |
-
---
|
2 |
-
license: other
|
3 |
-
license_name: deepseek
|
4 |
-
license_link: >-
|
5 |
-
https://raw.githubusercontent.com/deepseek-ai/DeepSeek-Coder/main/LICENSE-MODEL
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
license_name: deepseek
|
4 |
+
license_link: >-
|
5 |
+
https://raw.githubusercontent.com/deepseek-ai/DeepSeek-Coder/main/LICENSE-MODEL
|
6 |
+
datasets:
|
7 |
+
- nllg/datikz-v2
|
8 |
+
---
|
9 |
+
|
10 |
+
# Model Card for DeTi*k*Zify-DS<sub>7b</sub>
|
11 |
+
DeTi*k*Zify-DS<sub>1.3b</sub> is a language model that automatically converts
|
12 |
+
sketches and existing scientific figures into editable, semantics-preserving
|
13 |
+
Ti*k*Z graphics programs. It is based on [DeepSeek Coder 7b
|
14 |
+
v1.5](https://huggingface.co/deepseek-ai/deepseek-coder-7b-base-v1.5) and was
|
15 |
+
fine-tuned on
|
16 |
+
[DaTi*k*Z<sub>v2</sub>](https://huggingface.co/datasets/nllg/datikz-v2). Check
|
17 |
+
out the [DeTi*k*Zify](https://github.com/potamides/DeTikZify) project for more
|
18 |
+
information and tips on how to best run the model.
|
19 |
+
|
20 |
+
## Usage
|
21 |
+
```python
|
22 |
+
from operator import itemgetter
|
23 |
+
|
24 |
+
from detikzify.model import load
|
25 |
+
from detikzify.infer import DetikzifyPipeline
|
26 |
+
import torch
|
27 |
+
|
28 |
+
image = "https://w.wiki/A7Cc"
|
29 |
+
pipeline = DetikzifyPipeline(*load(
|
30 |
+
base_model="nllg/detikzify-ds-7b",
|
31 |
+
device_map="auto",
|
32 |
+
torch_dtype=torch.bfloat16,
|
33 |
+
))
|
34 |
+
|
35 |
+
# generate a single TikZ program
|
36 |
+
fig = pipeline.sample(image=image)
|
37 |
+
|
38 |
+
# if it compiles, rasterize it and show it
|
39 |
+
if fig.is_rasterizable:
|
40 |
+
fig.rasterize().show()
|
41 |
+
|
42 |
+
# run MCTS for 10 minutes and generate multiple TikZ programs
|
43 |
+
figs = set()
|
44 |
+
for score, fig in pipeline.simulate(image=image, timeout=600):
|
45 |
+
figs.add((score, fig))
|
46 |
+
|
47 |
+
# save the best TikZ program
|
48 |
+
best = sorted(figs, key=itemgetter(0))[-1][1]
|
49 |
+
best.save("fig.tex")
|
50 |
+
```
|