Caslow commited on
Commit
322eb90
·
unverified ·
1 Parent(s): e5bb26d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +111 -2
README.md CHANGED
@@ -5,5 +5,114 @@ datasets:
5
  language:
6
  - en
7
  base_model:
8
- - meta-llama/Llama-3.2-3B-Instruct
9
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  language:
6
  - en
7
  base_model:
8
+ - unsloth/Llama-3.2-3B-Instruct
9
+ new_version: meta-llama/Llama-3.2-3B-Instruct
10
+ pipeline_tag: text2text-generation
11
+ tags:
12
+ - Fortran
13
+ - Rust
14
+ - FortranToRust
15
+ ---
16
+ # Model Card for Model ID
17
+
18
+ <!-- Provide a quick summary of what the model is/does. -->
19
+
20
+ This modelcard aims to be a base template for new models. It has been generated using [unsloth/Llama-3.2-3B-Instruct](https://huggingface.co/unsloth/Llama-3.2-3B-Instruct).
21
+
22
+ ## Model Details
23
+
24
+ ### Model Description
25
+
26
+ CodeConvLLM is a language model specifically designed to translate OCaml and Fortran code into C# and Rust. It integrates seamlessly with Visual Studio Code through a plugin and ensures industry-standard translations by benchmarking outputs against best practices in software engineering.
27
+
28
+
29
+ - **Developed by:** [Caslow Chien](https://huggingface.co/Caslow) and [Chandrahas Aroori](https://huggingface.co/charoori)
30
+ - **License:** MIT
31
+ - **Finetuned from model:** [unsloth/Llama-3.2-3B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct)
32
+
33
+ ### Model Sources
34
+
35
+ - **Repository:** [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM)
36
+
37
+ ## Uses
38
+
39
+ ### Direct Use
40
+ The model can be used directly for code translation tasks. Users can input OCaml or Fortran code into the Gradio dashboard or via the API and receive C# or Rust code as output. It is particularly suitable for developers needing efficient, accurate language conversion in software migration or integration projects.
41
+
42
+ ### Downstream Use [optional]
43
+ Developers can integrate this model into larger IDE ecosystems, CI/CD pipelines, or automated code-refactoring systems for multi-language development projects.
44
+
45
+ ### Out-of-Scope Use
46
+ The model should not be used for:
47
+ + Translating non-code text.
48
+ + Translating between languages it is not trained for (e.g., Python to Java).
49
+ + Malicious purposes, such as creating obfuscated or harmful code.
50
+ +
51
+ ## Bias, Risks, and Limitations
52
+ While the model achieves high accuracy in most cases, it may introduce errors in certain edge cases or highly domain-specific code. Users must verify and test generated outputs thoroughly before deployment.
53
+
54
+ ### Recommendations
55
+ + Validation: Benchmark the output using standard tools and manual review.
56
+ + Testing: Integrate automated testing during translation workflows to catch potential bugs or inaccuracies.
57
+
58
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
59
+
60
+ ## How to Get Started with the Model
61
+
62
+ Please visit the [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) for a detailed guide.
63
+
64
+ **Quick Guide**
65
+ 1. Load the model
66
+ ```python
67
+ from unsloth import FastLanguageModel
68
+ from transformers import TextStreamer
69
+
70
+ max_seq_length = 2048
71
+ dtype = None
72
+ load_in_4bit = True
73
+
74
+ model, tokenizer = FastLanguageModel.from_pretrained(
75
+ model_name = "lora_model", # OUR MODEL YOU USED FOR TRAINING, put it under the same folder
76
+ max_seq_length = max_seq_length,
77
+ dtype = dtype,
78
+ load_in_4bit = load_in_4bit,
79
+ )
80
+ FastLanguageModel.for_inference(model)
81
+ ```
82
+
83
+ 2. Get your input
84
+ ```python
85
+ USER_INPUT_CODE = # YOUR FORTRAN CODE
86
+ USER_INPUT_EXPLANATION = # YOUR FORTRAN CODE EXPLANATION
87
+ messages = [
88
+ {
89
+ "role": "user",
90
+ "content": str("[Fortran Code]") + str(USER_INPUT_CODE) + str("[Fortran Code Explain]" )+ str(USER_INPUT_EXPLANATION)
91
+ },
92
+ ]
93
+ inputs = tokenizer.apply_chat_template(
94
+ messages,
95
+ tokenize = True,
96
+ add_generation_prompt = True, # Must add for generation
97
+ return_tensors = "pt",
98
+ ).to("cuda")
99
+ ```
100
+
101
+ 3. Run the model
102
+ ```python
103
+ text_streamer = TextStreamer(tokenizer, skip_prompt = True)
104
+ _ = model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = 2000,
105
+ use_cache = True, temperature = 1.5, min_p = 0.1)
106
+ ```
107
+
108
+ ## Training Details
109
+
110
+ Please visit the [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) for a detailed guide.
111
+
112
+ ### Training Data
113
+
114
+ Please visit the [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) for a detailed guide.
115
+
116
+ ### Training Procedure
117
+
118
+ Please visit the [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) for a detailed guide.