Menouar/LinearEquations
Viewer • Updated • 2M • 35 • 1
How to use Menouar/falcon7b-linear-equations-merged with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Menouar/falcon7b-linear-equations-merged", trust_remote_code=True) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Menouar/falcon7b-linear-equations-merged", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("Menouar/falcon7b-linear-equations-merged", trust_remote_code=True)How to use Menouar/falcon7b-linear-equations-merged with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Menouar/falcon7b-linear-equations-merged"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Menouar/falcon7b-linear-equations-merged",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Menouar/falcon7b-linear-equations-merged
How to use Menouar/falcon7b-linear-equations-merged with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Menouar/falcon7b-linear-equations-merged" \
--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": "Menouar/falcon7b-linear-equations-merged",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Menouar/falcon7b-linear-equations-merged" \
--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": "Menouar/falcon7b-linear-equations-merged",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Menouar/falcon7b-linear-equations-merged with Docker Model Runner:
docker model run hf.co/Menouar/falcon7b-linear-equations-merged
This model is a merged version of falcon7b-linear-equations with QLoRA.
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
model = AutoModelForCausalLM.from_pretrained("Menouar/falcon7b-linear-equations-merged")
tokenizer = AutoTokenizer.from_pretrained("Menouar/falcon7b-linear-equations-merged",
device_map="auto",
torch_dtype=torch.float16)
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
outputs = pipe("Solve for y: 10 + 4y -9y +5 = 4 +8y - 2y",
max_new_tokens=172,
do_sample=True,
temperature=0.1,
top_k=50, top_p=0.1,
eos_token_id=pipe.tokenizer.eos_token_id,
pad_token_id=pipe.tokenizer.pad_token_id)
for seq in outputs:
print(f"{seq['generated_text']}")