|
Download README.md from CodeTranslatorLLM/LinguistLLM: direct link, hf CLI and curl.
- Browser
- Download file 4.28 kB
-
https://huggingface.co/CodeTranslatorLLM/LinguistLLM/resolve/main/README.md
- Command line
-
hf download hf://CodeTranslatorLLM/LinguistLLM/README.md
-
curl -L -o README.md https://huggingface.co/CodeTranslatorLLM/LinguistLLM/resolve/main/README.md
4.28 kB
| license: mit | |
| datasets: | |
| - CodeTranslatorLLM/Code-Translation | |
| language: | |
| - en | |
| base_model: | |
| - unsloth/Llama-3.2-3B-Instruct | |
| new_version: meta-llama/Llama-3.2-3B-Instruct | |
| pipeline_tag: text2text-generation | |
| tags: | |
| - Fortran | |
| - Rust | |
| - FortranToRust | |
| # Model Card for Model ID | |
| <!-- Provide a quick summary of what the model is/does. --> | |
| 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). | |
| ## Model Details | |
| ### Model Description | |
| 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. | |
| - **Developed by:** [Caslow Chien](https://huggingface.co/Caslow) and [Chandrahas Aroori](https://huggingface.co/charoori) | |
| - **License:** MIT | |
| - **Finetuned from model:** [unsloth/Llama-3.2-3B-Instruct](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) | |
| ### Model Sources | |
| - **Repository:** [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) | |
| ## Uses | |
| ### Direct Use | |
| 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. | |
| ### Downstream Use [optional] | |
| Developers can integrate this model into larger IDE ecosystems, CI/CD pipelines, or automated code-refactoring systems for multi-language development projects. | |
| ### Out-of-Scope Use | |
| The model should not be used for: | |
| + Translating non-code text. | |
| + Translating between languages it is not trained for (e.g., Python to Java). | |
| + Malicious purposes, such as creating obfuscated or harmful code. | |
| + | |
| ## Bias, Risks, and Limitations | |
| 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. | |
| ### Recommendations | |
| + Validation: Benchmark the output using standard tools and manual review. | |
| + Testing: Integrate automated testing during translation workflows to catch potential bugs or inaccuracies. | |
| Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations. | |
| ## How to Get Started with the Model | |
| Please visit the [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) for a detailed guide. | |
| **Quick Guide** | |
| 1. Load the model | |
| ```python | |
| from unsloth import FastLanguageModel | |
| from transformers import TextStreamer | |
| max_seq_length = 2048 | |
| dtype = None | |
| load_in_4bit = True | |
| model, tokenizer = FastLanguageModel.from_pretrained( | |
| model_name = "lora_model", # OUR MODEL YOU USED FOR TRAINING, put it under the same folder | |
| max_seq_length = max_seq_length, | |
| dtype = dtype, | |
| load_in_4bit = load_in_4bit, | |
| ) | |
| FastLanguageModel.for_inference(model) | |
| ``` | |
| 2. Get your input | |
| ```python | |
| USER_INPUT_CODE = # YOUR FORTRAN CODE | |
| USER_INPUT_EXPLANATION = # YOUR FORTRAN CODE EXPLANATION | |
| messages = [ | |
| { | |
| "role": "user", | |
| "content": str("[Fortran Code]") + str(USER_INPUT_CODE) + str("[Fortran Code Explain]" )+ str(USER_INPUT_EXPLANATION) | |
| }, | |
| ] | |
| inputs = tokenizer.apply_chat_template( | |
| messages, | |
| tokenize = True, | |
| add_generation_prompt = True, # Must add for generation | |
| return_tensors = "pt", | |
| ).to("cuda") | |
| ``` | |
| 3. Run the model | |
| ```python | |
| text_streamer = TextStreamer(tokenizer, skip_prompt = True) | |
| _ = model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = 2000, | |
| use_cache = True, temperature = 1.5, min_p = 0.1) | |
| ``` | |
| ## Training Details | |
| Please visit the [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) for a detailed guide. | |
| ### Training Data | |
| Please visit the [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) for a detailed guide. | |
| ### Training Procedure | |
| Please visit the [GitHub Repo](https://github.com/CodeTranslatorLLM/LinguistLLM) for a detailed guide. |