Text Generation
Transformers
Safetensors
Chinese
English
joyai_llm_flash
conversational
custom_code
fp8
Instructions to use jdopensource/JoyAI-LLM-Flash-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jdopensource/JoyAI-LLM-Flash-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jdopensource/JoyAI-LLM-Flash-FP8", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("jdopensource/JoyAI-LLM-Flash-FP8", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use jdopensource/JoyAI-LLM-Flash-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jdopensource/JoyAI-LLM-Flash-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jdopensource/JoyAI-LLM-Flash-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jdopensource/JoyAI-LLM-Flash-FP8
- SGLang
How to use jdopensource/JoyAI-LLM-Flash-FP8 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 "jdopensource/JoyAI-LLM-Flash-FP8" \ --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": "jdopensource/JoyAI-LLM-Flash-FP8", "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 "jdopensource/JoyAI-LLM-Flash-FP8" \ --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": "jdopensource/JoyAI-LLM-Flash-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jdopensource/JoyAI-LLM-Flash-FP8 with Docker Model Runner:
docker model run hf.co/jdopensource/JoyAI-LLM-Flash-FP8
| {%- macro render_extra_keys(json_dict, handled_keys) -%} | |
| {%- if json_dict is mapping -%} | |
| {%- for json_key in json_dict if json_key not in handled_keys -%} | |
| {%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) -%} | |
| {{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson | safe) ~ '</' ~ json_key ~ '>' -}} | |
| {%- else -%} | |
| {{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {%- endmacro -%} | |
| {%- if not add_generation_prompt is defined -%}{%- set add_generation_prompt = false -%}{%- endif -%} | |
| {%- set ns = namespace(system_prompt='', is_first_sp=true, is_last_user=false) -%} | |
| {%- set default_system = "You are JoyAI , a large language model trained by JD(京东)that can interact with a computer to solve tasks. Answer as concisely as possible." -%} | |
| {%- set ns.system_prompt = default_system -%} | |
| {%- for message in messages -%} | |
| {%- if message['role'] == 'system' -%} | |
| {%- if ns.is_first_sp -%} | |
| {%- set ns.system_prompt = message['content'] -%} | |
| {%- set ns.is_first_sp = false -%} | |
| {%- else -%} | |
| {%- set ns.system_prompt = ns.system_prompt + '\n\n' + message['content'] -%} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {{- bos_token -}}{{- ns.system_prompt -}} | |
| {%- if tools is iterable and tools | length > 0 -%} | |
| {{- "\n\n# Tools\n\nYou have access to the following functions:\n\n" }} | |
| {{- "<tools>" }} | |
| {%- for tool in tools %} | |
| {%- if tool.function is defined %} | |
| {%- set tool = tool.function %} | |
| {%- endif %} | |
| {{- "\n<function>\n<name>" ~ tool.name ~ "</name>" }} | |
| {%- if tool.description is defined %} | |
| {{- '\n<description>' ~ (tool.description | trim) ~ '</description>' }} | |
| {%- endif %} | |
| {{- '\n<parameters>' }} | |
| {%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %} | |
| {%- for param_name, param_fields in tool.parameters.properties|items %} | |
| {{- '\n<parameter>' }} | |
| {{- '\n<name>' ~ param_name ~ '</name>' }} | |
| {%- if param_fields.type is defined %} | |
| {{- '\n<type>' ~ (param_fields.type | string) ~ '</type>' }} | |
| {%- endif %} | |
| {%- if param_fields.description is defined %} | |
| {{- '\n<description>' ~ (param_fields.description | trim) ~ '</description>' }} | |
| {%- endif %} | |
| {%- set handled_keys = ['name', 'type', 'description'] %} | |
| {{- render_extra_keys(param_fields, handled_keys) }} | |
| {{- '\n</parameter>' }} | |
| {%- endfor %} | |
| {%- endif %} | |
| {% set handled_keys = ['type', 'properties'] %} | |
| {{- render_extra_keys(tool.parameters, handled_keys) }} | |
| {{- '\n</parameters>' }} | |
| {%- set handled_keys = ['type', 'name', 'description', 'parameters'] %} | |
| {{- render_extra_keys(tool, handled_keys) }} | |
| {{- '\n</function>' }} | |
| {%- endfor %} | |
| {{- "\n</tools>" }} | |
| {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }} | |
| {%- endif %} | |
| {%- for message in messages -%} | |
| {%- if message['role'] == 'user' -%} | |
| {%- set ns.is_last_user = true -%} | |
| {{- '<|User|>' + message['content'] -}} | |
| {%- elif message['role'] == 'assistant' -%} | |
| {%- if ns.is_last_user -%} | |
| {{ '<|Assistant|>' }} | |
| {%- endif -%} | |
| {%- set ns.is_last_user = false -%} | |
| {%- set content = message.get('content') | default('', true) -%} | |
| {{ '<|end_of_thought|>' + content }} | |
| {%- if message['tool_calls'] is defined and message['tool_calls'] is not none -%} | |
| {%- for tool in message['tool_calls'] -%} | |
| {%- if tool.function is defined %}{% set tool = tool.function %}{% endif -%} | |
| {{- '\n<tool_call>\n<function=' + tool.name + '>\n' -}} | |
| {%- if tool.arguments is defined -%} | |
| {%- if tool.arguments is string -%}{%- set args_data = tool.arguments | from_json -%}{%- else -%}{%- set args_data = tool.arguments -%}{%- endif -%} | |
| {%- for args_name, args_value in args_data.items() -%} | |
| {{- '<parameter=' + args_name + '>\n' -}} | |
| {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string -%} | |
| {{- args_value -}}{{- '\n</parameter>\n' -}} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {{- '</function>\n</tool_call>' -}} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {{ '<|end▁of▁sentence|>' }} | |
| {%- elif message['role'] == 'tool' -%} | |
| {%- set ns.is_last_user = true -%} | |
| {{ '\n<tool_response>\n' + message['content'] + '\n</tool_response>' }} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- if add_generation_prompt -%} | |
| {{ '<|Assistant|>' }}{{ '<|end_of_thought|>' }} | |
| {%- endif -%} |