TechxGenus commited on
Commit
e7363f5
1 Parent(s): fcec9b6

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +60 -0
README.md ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - code
4
+ base_model:
5
+ - 01-ai/Yi-Coder-1.5B
6
+ library_name: transformers
7
+ pipeline_tag: text-generation
8
+ license: apache-2.0
9
+ ---
10
+
11
+ # Typst-Coder
12
+
13
+ <p align="center">
14
+ <a href="https://huggingface.co/TechxGenus/Typst-Coder-1.5B">[🤖Models]</a> |
15
+ <a href="https://github.com/TechxGenus/Typst-Coder">[🛠️Code]</a> |
16
+ <a href="https://huggingface.co/datasets/TechxGenus/Typst-Train">[📊Data]</a> |
17
+ </p>
18
+
19
+ <hr>
20
+
21
+ - [Typst-Coder](#typst-coder)
22
+ - [Introduction](#introduction)
23
+ - [Usage](#usage)
24
+
25
+ <hr>
26
+
27
+ ## Introduction
28
+
29
+ While working with Typst documents, we noticed that AI programming assistants often generate poor results. I understand that these assistants may perform better in languages like Python and JavaScript, which benefit from more extensive datasets and feedback signals from executable code, unlike HTML or Markdown. However, current LLMs even frequently struggle to produce accurate Typst syntax, including models like GPT-4o and Claude-3.5-Sonnet.
30
+
31
+ Upon further investigation, we found that because Typst is a relatively new language, training data for it is scarce. GitHub's search tool doesn't categorize it as a language for code yet, and The Stack v1/v2 don’t include Typst. No open code LLMs currently list it as a supported language, either. To address this, we developed this project aimed at collecting relevant data and training models to improve Typst support in AI programming tools.
32
+
33
+ ## Usage
34
+
35
+ An example script is shown below:
36
+
37
+ ```python
38
+ import torch
39
+ from transformers import AutoTokenizer, AutoModelForCausalLM
40
+
41
+ tokenizer = AutoTokenizer.from_pretrained("TechxGenus/Typst-Coder-1.5B")
42
+ model = AutoModelForCausalLM.from_pretrained(
43
+ "TechxGenus/Typst-Coder-1.5B",
44
+ torch_dtype=torch.bfloat16,
45
+ device_map="auto"
46
+ )
47
+
48
+ messages = [
49
+ {"role": "user", "content": "Hi!"},
50
+ ]
51
+ prompt = tokenizer.apply_chat_template(
52
+ messages,
53
+ tokenize=False,
54
+ add_generation_prompt=True
55
+ )
56
+
57
+ inputs = tokenizer.encode(prompt, return_tensors="pt")
58
+ outputs = model.generate(input_ids=inputs.to(model.device), max_new_tokens=512)
59
+ print(tokenizer.decode(outputs[0]))
60
+ ```