Text Generation
Transformers
Safetensors
qwen3
dllm
diffusion
llm
text_generation
conversational
custom_code
text-generation-inference
Instructions to use GSAI-ML/ReFusion with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GSAI-ML/ReFusion with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GSAI-ML/ReFusion", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("GSAI-ML/ReFusion", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("GSAI-ML/ReFusion", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Local Apps Settings
- vLLM
How to use GSAI-ML/ReFusion with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GSAI-ML/ReFusion" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GSAI-ML/ReFusion", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GSAI-ML/ReFusion
- SGLang
How to use GSAI-ML/ReFusion 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 "GSAI-ML/ReFusion" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GSAI-ML/ReFusion", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "GSAI-ML/ReFusion" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GSAI-ML/ReFusion", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use GSAI-ML/ReFusion with Docker Model Runner:
docker model run hf.co/GSAI-ML/ReFusion
Add `library_name: transformers` to metadata
#2
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
| 3 |
tags:
|
| 4 |
- dllm
|
| 5 |
- diffusion
|
| 6 |
- llm
|
| 7 |
- text_generation
|
| 8 |
-
|
| 9 |
---
|
| 10 |
|
| 11 |
# ReFusion
|
|
@@ -91,7 +92,7 @@ def generate_refusion(model, tokenizer, prompt, gen_length=128, temperature=0.,
|
|
| 91 |
cur_gen_pos_ids = gen_pos_ids[:, serial_num_block*block_length:(serial_num_block+1)*block_length] # (batch_size, block_length)
|
| 92 |
|
| 93 |
cur_gen_blocks_x = cur_gen_x.reshape(batch_size, -1, cur_slot_size)
|
| 94 |
-
cur_gen_blocks_pos_ids =
|
| 95 |
|
| 96 |
# slot level generation
|
| 97 |
while cur_gen_blocks_x.numel() > 0:
|
|
@@ -416,7 +417,15 @@ def main():
|
|
| 416 |
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, torch_dtype=torch.bfloat16).to(device).eval()
|
| 417 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 418 |
|
| 419 |
-
prompt = "You are an expert Python programmer. Your task is to write a single Python function to solve the problem described below, and here is your task: Write a function to sum all amicable numbers from 1 to a specified number.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
m = [{"role": "user", "content": prompt}, ]
|
| 422 |
prompt = tokenizer.apply_chat_template(m, add_generation_prompt=True, tokenize=False, enable_thinking=True)
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
tags:
|
| 5 |
- dllm
|
| 6 |
- diffusion
|
| 7 |
- llm
|
| 8 |
- text_generation
|
| 9 |
+
library_name: transformers
|
| 10 |
---
|
| 11 |
|
| 12 |
# ReFusion
|
|
|
|
| 92 |
cur_gen_pos_ids = gen_pos_ids[:, serial_num_block*block_length:(serial_num_block+1)*block_length] # (batch_size, block_length)
|
| 93 |
|
| 94 |
cur_gen_blocks_x = cur_gen_x.reshape(batch_size, -1, cur_slot_size)
|
| 95 |
+
cur_gen_blocks_pos_ids = cur_gen_blocks_pos_ids.reshape(batch_size, -1, cur_slot_size)
|
| 96 |
|
| 97 |
# slot level generation
|
| 98 |
while cur_gen_blocks_x.numel() > 0:
|
|
|
|
| 417 |
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, torch_dtype=torch.bfloat16).to(device).eval()
|
| 418 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 419 |
|
| 420 |
+
prompt = "You are an expert Python programmer. Your task is to write a single Python function to solve the problem described below, and here is your task: Write a function to sum all amicable numbers from 1 to a specified number.
|
| 421 |
+
|
| 422 |
+
Directly after the '[BEGIN]' marker, you must write only the Python code for the function. Do not provide any explanations, comments, or introductory text. The function must include the 'def' line, its arguments, the function body, and a 'return' statement. Your code should pass these tests:
|
| 423 |
+
|
| 424 |
+
assert amicable_numbers_sum(999)==504
|
| 425 |
+
assert amicable_numbers_sum(9999)==31626
|
| 426 |
+
assert amicable_numbers_sum(99)==0
|
| 427 |
+
[BEGIN]
|
| 428 |
+
"
|
| 429 |
|
| 430 |
m = [{"role": "user", "content": prompt}, ]
|
| 431 |
prompt = tokenizer.apply_chat_template(m, add_generation_prompt=True, tokenize=False, enable_thinking=True)
|