nllg
/

potamides commited on
Commit
18af512
1 Parent(s): ab08555

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +50 -6
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>1.3b</sub>
11
+ DeTi*k*Zify-TL<sub>1.1b</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
14
+ 1.3b](https://huggingface.co/deepseek-ai/deepseek-coder-1.3b-base) 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-1.3b",
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
+ ```