haijunlv commited on
Commit
87ce0b4
·
verified ·
1 Parent(s): f66c559

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +118 -0
README.md CHANGED
@@ -36,6 +36,8 @@ By extending professional scientific tasks into a full-chain training pipeline f
36
 
37
  - **Efficient RL reasoning with MTP and CoT compression.** During RL, Intern-S2-Preview adopts shared-weight MTP with KL loss to reduce the mismatch between training and inference behavior, substantially improving MTP accept rate and token generation speed. It also introduces CoT compression techniques to shorten responses while preserving strong reasoning capability, achieving improvements in both performance and efficiency.
38
 
 
 
39
  <figure>
40
  <img src="./figs/efficiency.jpg" alt="efficient RL reasoning with MTP and CoT compression">
41
  <figcaption>Fig1: Reasoning Efficiency on Complex Math Benchmarks. Accuracy vs. Average Response Length. Intern-S2-Preview (red star) significantly outperforms trillion-scale Intern-S1-Pro (red circle), and achieving higher accuracy with better token efficiency among medium-size models.</figcaption>
@@ -290,6 +292,122 @@ print(json.dumps(response.model_dump(), indent=2, ensure_ascii=False))
290
  > Note: We do not recommend disabling thinking mode for agentic tasks.
291
 
292
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  ## Agent Integration
294
 
295
  Intern-S2-Preview can be plugged into agent frameworks in two ways: connecting to a **self-hosted deployment**, or calling the **official InternLM API**. Below we cover both, with examples for agent frameworks (OpenClaw, Hermes, etc.) and for Claude Code.
 
36
 
37
  - **Efficient RL reasoning with MTP and CoT compression.** During RL, Intern-S2-Preview adopts shared-weight MTP with KL loss to reduce the mismatch between training and inference behavior, substantially improving MTP accept rate and token generation speed. It also introduces CoT compression techniques to shorten responses while preserving strong reasoning capability, achieving improvements in both performance and efficiency.
38
 
39
+ - **Upgraded time-series Modeling** for better physical signal representation; supports long, heterogeneous time-series (10^0–10^6 points).
40
+
41
  <figure>
42
  <img src="./figs/efficiency.jpg" alt="efficient RL reasoning with MTP and CoT compression">
43
  <figcaption>Fig1: Reasoning Efficiency on Complex Math Benchmarks. Accuracy vs. Average Response Length. Intern-S2-Preview (red star) significantly outperforms trillion-scale Intern-S1-Pro (red circle), and achieving higher accuracy with better token efficiency among medium-size models.</figcaption>
 
292
  > Note: We do not recommend disabling thinking mode for agentic tasks.
293
 
294
 
295
+ ### Time Series Demo
296
+
297
+ Time series inference is currently only supported in LMDeploy. To get started, download and deploy Intern-S2-Preview with LMDeploy by following the [Model Deployment Guide](./deployment_guide.md).
298
+ Below is an example of detecting earthquake events from a time series signal file. Additional data types and functionalities are also supported.
299
+
300
+ ```
301
+ from openai import OpenAI
302
+ from lmdeploy.vl.time_series_utils import encode_time_series_base64
303
+
304
+ openai_api_key = "EMPTY"
305
+ openai_api_base = "http://0.0.0.0:8000/v1"
306
+ client = OpenAI(
307
+ api_key=openai_api_key,
308
+ base_url=openai_api_base,
309
+ )
310
+ model_name = client.models.list().data[0].id
311
+
312
+
313
+ def send_base64(file_path: str, sampling_rate: int = 100):
314
+ """base64-encoded time-series data."""
315
+
316
+ # encode_time_series_base64 accepts local file paths and http urls,
317
+ # encoding time-series data (.npy, .csv, .wav, .mp3, .flac, etc.) into base64 strings.
318
+ base64_ts = encode_time_series_base64(file_path)
319
+
320
+ messages = [
321
+ {
322
+ "role": "user",
323
+ "content": [
324
+ {
325
+ "type": "text",
326
+ "text": "Please determine whether an Earthquake event has occurred in the provided time-series data. If so, please specify the starting time point indices of the P-wave and S-wave in the event."
327
+ },
328
+ {
329
+ "type": "time_series_url",
330
+ "time_series_url": {
331
+ "url": f"data:time_series/npy;base64,{base64_ts}",
332
+ "sampling_rate": sampling_rate
333
+ },
334
+ },
335
+ ],
336
+ }
337
+ ]
338
+
339
+ return client.chat.completions.create(
340
+ model=model_name,
341
+ messages=messages,
342
+ temperature=0,
343
+ max_tokens=200,
344
+ )
345
+
346
+
347
+ def send_http_url(url: str, sampling_rate: int = 100):
348
+ """http(s) url pointing to the time-series data."""
349
+ messages = [
350
+ {
351
+ "role": "user",
352
+ "content": [
353
+ {
354
+ "type": "text",
355
+ "text": "Please determine whether an Earthquake event has occurred in the provided time-series data. If so, please specify the starting time point indices of the P-wave and S-wave in the event."
356
+ },
357
+ {
358
+ "type": "time_series_url",
359
+ "time_series_url": {
360
+ "url": url,
361
+ "sampling_rate": sampling_rate
362
+ },
363
+ },
364
+ ],
365
+ }
366
+ ]
367
+
368
+ return client.chat.completions.create(
369
+ model=model_name,
370
+ messages=messages,
371
+ temperature=0,
372
+ max_tokens=200,
373
+ )
374
+
375
+
376
+ def send_file_url(file_path: str, sampling_rate: int = 100):
377
+ """file url pointing to the time-series data."""
378
+ messages = [
379
+ {
380
+ "role": "user",
381
+ "content": [
382
+ {
383
+ "type": "text",
384
+ "text": "Please determine whether an Earthquake event has occurred in the provided time-series data. If so, please specify the starting time point indices of the P-wave and S-wave in the event."
385
+ },
386
+ {
387
+ "type": "time_series_url",
388
+ "time_series_url": {
389
+ "url": f"file://{file_path}",
390
+ "sampling_rate": sampling_rate
391
+ },
392
+ },
393
+ ],
394
+ }
395
+ ]
396
+
397
+ return client.chat.completions.create(
398
+ model=model_name,
399
+ messages=messages,
400
+ temperature=0,
401
+ max_tokens=200,
402
+ )
403
+
404
+ response = send_base64("./0092638_seism.npy")
405
+ # response = send_http_url("https://huggingface.co/internlm/Intern-S1-Pro/raw/main/0092638_seism.npy")
406
+ # response = send_file_url("./0092638_seism.npy")
407
+
408
+ print(response.choices[0].message)
409
+ ```
410
+
411
  ## Agent Integration
412
 
413
  Intern-S2-Preview can be plugged into agent frameworks in two ways: connecting to a **self-hosted deployment**, or calling the **official InternLM API**. Below we cover both, with examples for agent frameworks (OpenClaw, Hermes, etc.) and for Claude Code.