Instructions to use hubentu/cmd2cwl_Llama-3.2-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hubentu/cmd2cwl_Llama-3.2-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hubentu/cmd2cwl_Llama-3.2-3B")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hubentu/cmd2cwl_Llama-3.2-3B") model = AutoModelForCausalLM.from_pretrained("hubentu/cmd2cwl_Llama-3.2-3B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hubentu/cmd2cwl_Llama-3.2-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hubentu/cmd2cwl_Llama-3.2-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hubentu/cmd2cwl_Llama-3.2-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hubentu/cmd2cwl_Llama-3.2-3B
- SGLang
How to use hubentu/cmd2cwl_Llama-3.2-3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "hubentu/cmd2cwl_Llama-3.2-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hubentu/cmd2cwl_Llama-3.2-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "hubentu/cmd2cwl_Llama-3.2-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hubentu/cmd2cwl_Llama-3.2-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Desktop
- Docker Model Runner
How to use hubentu/cmd2cwl_Llama-3.2-3B with Docker Model Runner:
docker model run hf.co/hubentu/cmd2cwl_Llama-3.2-3B
Model Information
The cmd2cwl model is an instruction fine-tuned version of the unsloth/Llama-3.2-3B. This model has been trained on a custom dataset consisting of help documentation from various command-line tools and corresponding CWL (Common Workflow Language) scripts. Its purpose is to assist users in converting command-line tool documentation into clean and well-structured CWL scripts, enhancing automation and workflow reproducibility.
Example
Task
question = """
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Write a cwl script for md5sum with docker image alpine.
### Input:
With no FILE, or when FILE is -, read standard input.
-b, --binary read in binary mode
-c, --check read MD5 sums from the FILEs and check them
--tag create a BSD-style checksum
-t, --text read in text mode (default)
-z, --zero end each output line with NUL, not newline,
and disable file name escaping
The following five options are useful only when verifying checksums:
--ignore-missing don't fail or report status for missing files
--quiet don't print OK for each successfully verified file
--status don't output anything, status code shows success
--strict exit non-zero for improperly formatted checksum lines
-w, --warn warn about improperly formatted checksum lines
--help display this help and exit
--version output version information and exit
The sums are computed as described in RFC 1321. When checking, the input
should be a former output of this program. The default mode is to print a
line with checksum, a space, a character indicating input mode ('*' for binary,
' ' for text or where binary is insignificant), and name for each FILE.
### Response:
"""
Using unsloth
from unsloth import FastLanguageModel
from transformers import TextStreamer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "hubentu/cmd2cwl_Llama-3.2-3B",
load_in_4bit = False,
)
FastLanguageModel.for_inference(model)
inputs = tokenizer(
[question],
return_tensors = "pt").to("cuda")
text_streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, streamer = text_streamer)
Using AutoModelForCausalLM
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers import TextStreamer
model = AutoModelForCausalLM.from_pretrained("hubentu/cmd2cwl_Llama-3.2-3B")
tokenizer = AutoTokenizer.from_pretrained("hubentu/cmd2cwl_Llama-3.2-3B")
model.to('cuda')
text_streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, streamer = text_streamer, max_length=8192)
Using generator
from transformers import pipeline
generator = pipeline('text-generation', model="checkpoints/cmd2cwl_Llama-3.2-3B", device='cuda')
resp = generator(question, max_length=8192)
print(resp[0]['generated_text'].split("### Response:\n")[-1])
Output
cwlVersion: v1.0
class: CommandLineTool
baseCommand:
- md5sum
requirements:
- class: DockerRequirement
dockerPull: alpine:latest
label: md5sum
doc: Compute and check MD5 checksums
inputs:
files:
label: files
doc: Input files
type: File[]
inputBinding:
separate: true
outputs:
md5:
label: md5
doc: MD5 checksums
type: string[]
outputBinding:
glob: $(inputs.files.name)
Uploaded model
- Developed by: hubentu
- License: apache-2.0
- Finetuned from model : unsloth/Llama-3.2-3B
This llama model was trained 2x faster with Unsloth and Huggingface's TRL library.
- Downloads last month
- 52
